Merge pull request #155 from rust-lang-nursery/utest
no-std friendly test suite
This commit is contained in:
commit
7b98ecebfd
@ -1,11 +0,0 @@
|
||||
[target.thumbv6m-none-eabi]
|
||||
rustflags = ["-C", "link-arg=-nostartfiles"]
|
||||
|
||||
[target.thumbv7m-none-eabi]
|
||||
rustflags = ["-C", "link-arg=-nostartfiles"]
|
||||
|
||||
[target.thumbv7em-none-eabi]
|
||||
rustflags = ["-C", "link-arg=-nostartfiles"]
|
||||
|
||||
[target.thumbv7em-none-eabihf]
|
||||
rustflags = ["-C", "link-arg=-nostartfiles"]
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "compiler-rt/compiler-rt-cdylib/compiler-rt"]
|
||||
path = compiler-rt/compiler-rt-cdylib/compiler-rt
|
||||
path = compiler-rt
|
||||
url = https://github.com/rust-lang/compiler-rt
|
||||
|
12
.travis.yml
12
.travis.yml
@ -22,10 +22,10 @@ matrix:
|
||||
- env: TARGET=powerpc-unknown-linux-gnu
|
||||
- env: TARGET=powerpc64-unknown-linux-gnu
|
||||
- env: TARGET=powerpc64le-unknown-linux-gnu
|
||||
- env: TARGET=thumbv6m-none-eabi
|
||||
- env: TARGET=thumbv7em-none-eabi
|
||||
- env: TARGET=thumbv7em-none-eabihf
|
||||
- env: TARGET=thumbv7m-none-eabi
|
||||
- env: TARGET=thumbv6m-linux-eabi
|
||||
- env: TARGET=thumbv7em-linux-eabi
|
||||
- env: TARGET=thumbv7em-linux-eabihf
|
||||
- env: TARGET=thumbv7m-linux-eabi
|
||||
- env: TARGET=x86_64-apple-darwin
|
||||
os: osx
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
@ -34,11 +34,9 @@ before_install:
|
||||
- test "$TRAVIS_OS_NAME" = "osx" || docker run --rm --privileged multiarch/qemu-user-static:register
|
||||
|
||||
install:
|
||||
- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
|
||||
- source ~/.cargo/env
|
||||
- case $TARGET in
|
||||
x86_64-apple-darwin | x86_64-unknown-linux-gnu) ;;
|
||||
thumbv*-none-eabi*) rustup component add rust-src ;;
|
||||
thumbv*eabi*) rustup component add rust-src ;;
|
||||
*) rustup target add $TARGET;;
|
||||
esac
|
||||
|
||||
|
21
Cargo.toml
21
Cargo.toml
@ -5,26 +5,27 @@ name = "compiler_builtins"
|
||||
version = "0.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
rustc-cfg = "0.3.0"
|
||||
cast = { version = "0.2.0", optional = true }
|
||||
rand = { version = "0.3.15", optional = true }
|
||||
|
||||
[build-dependencies.gcc]
|
||||
optional = true
|
||||
version = "0.3.36"
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "0.3.1"
|
||||
rand = "0.3.14"
|
||||
gcc_s = { path = "gcc_s" }
|
||||
compiler-rt = { path = "compiler-rt" }
|
||||
|
||||
[features]
|
||||
# Build the missing intrinsics from compiler-rt C source code
|
||||
c = ["gcc"]
|
||||
# Mark this crate as the #![compiler_builtins] crate
|
||||
compiler-builtins = []
|
||||
default = ["compiler-builtins"]
|
||||
# Include implementations of memory operations like memcpy
|
||||
mem = []
|
||||
rustbuild = ["compiler-builtins"]
|
||||
# generate tests
|
||||
gen-tests = ["cast", "rand"]
|
||||
|
||||
[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
|
||||
test = { git = "https://github.com/japaric/utest" }
|
||||
utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" }
|
||||
utest-macros = { git = "https://github.com/japaric/utest" }
|
||||
|
||||
|
||||
|
||||
[workspace]
|
||||
|
@ -6,8 +6,9 @@ environment:
|
||||
install:
|
||||
- git submodule update --init
|
||||
- curl -sSf -o rustup-init.exe https://win.rustup.rs
|
||||
- rustup-init.exe --default-host %TARGET% --default-toolchain nightly -y
|
||||
- rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain nightly -y
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- if "%TARGET%"=="i686-pc-windows-msvc" ( rustup target add %TARGET% )
|
||||
- rustc -Vv
|
||||
- cargo -V
|
||||
|
||||
@ -16,5 +17,5 @@ build: false
|
||||
test_script:
|
||||
- cargo build --target %TARGET%
|
||||
- cargo build --release --target %TARGET%
|
||||
- cargo test --no-default-features --target %TARGET%
|
||||
- cargo test --no-default-features --release --target %TARGET%
|
||||
- cargo test --no-default-features --features gen-tests --target %TARGET%
|
||||
- cargo test --no-default-features --features gen-tests --release --target %TARGET%
|
||||
|
@ -1,9 +1,9 @@
|
||||
FROM ubuntu:16.04
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev qemu-user-static
|
||||
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
|
||||
ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7m_none_eabi=arm-none-eabi-gcc \
|
||||
ENV AR_thumbv6m_linux_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV6M_LINUX_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv6m_linux_eabi=arm-none-eabi-gcc \
|
@ -1,9 +1,9 @@
|
||||
FROM ubuntu:16.04
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev qemu-user-static
|
||||
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
|
||||
ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7em_none_eabi=arm-none-eabi-gcc \
|
||||
ENV AR_thumbv7em_linux_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7EM_LINUX_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7em_linux_eabi=arm-none-eabi-gcc \
|
@ -1,9 +1,9 @@
|
||||
FROM ubuntu:16.04
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev qemu-user-static
|
||||
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
|
||||
ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \
|
||||
ENV AR_thumbv7em_linux_eabihf=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7EM_LINUX_EABIHF_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7em_linux_eabihf=arm-none-eabi-gcc \
|
@ -1,9 +1,9 @@
|
||||
FROM ubuntu:16.04
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev
|
||||
ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev qemu-user-static
|
||||
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- --git japaric/xargo --tag v0.3.1 --target x86_64-unknown-linux-gnu --to /usr/bin
|
||||
ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv6m_none_eabi=arm-none-eabi-gcc \
|
||||
ENV AR_thumbv7m_linux_eabi=arm-none-eabi-ar \
|
||||
CARGO_TARGET_THUMBV7M_LINUX_EABI_LINKER=arm-none-eabi-gcc \
|
||||
CC_thumbv7m_linux_eabi=arm-none-eabi-gcc \
|
34
ci/run.sh
34
ci/run.sh
@ -3,12 +3,38 @@ set -ex
|
||||
# Test our implementation
|
||||
case $1 in
|
||||
thumb*)
|
||||
xargo build --target $1
|
||||
xargo build --target $1 --release
|
||||
for t in $(ls tests); do
|
||||
t=${t%.rs}
|
||||
|
||||
# TODO(#154) enable these tests when aeabi_*mul are implemented
|
||||
case $t in
|
||||
powi*f2)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
# FIXME(#150) debug assertion in divmoddi4
|
||||
case $1 in
|
||||
thumbv6m-*)
|
||||
case $t in
|
||||
divdi3 | divmoddi4 | moddi3 | modsi3 | udivmoddi4 | udivmodsi4 | umoddi3 | \
|
||||
umodsi3)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
|
||||
qemu-arm-static target/${1}/debug/$t-*
|
||||
|
||||
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
|
||||
qemu-arm-static target/${1}/release/$t-*
|
||||
done
|
||||
;;
|
||||
*)
|
||||
cargo test --no-default-features --target $1
|
||||
cargo test --no-default-features --target $1 --release
|
||||
cargo test --no-default-features --features gen-tests --target $1
|
||||
cargo test --no-default-features --features gen-tests --target $1 --release
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
[package]
|
||||
name = "compiler-rt"
|
||||
version = "0.1.0"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
|
||||
[dependencies]
|
||||
compiler-rt-cdylib = { path = "compiler-rt-cdylib" }
|
||||
libloading = "0.3"
|
@ -1,12 +0,0 @@
|
||||
[package]
|
||||
name = "compiler-rt-cdylib"
|
||||
version = "0.1.0"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[build-dependencies]
|
||||
gcc = "0.3.36"
|
||||
|
@ -1,104 +0,0 @@
|
||||
extern crate gcc;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
struct Sources {
|
||||
files: Vec<&'static str>,
|
||||
}
|
||||
|
||||
impl Sources {
|
||||
fn new() -> Sources {
|
||||
Sources { files: Vec::new() }
|
||||
}
|
||||
|
||||
fn extend(&mut self, sources: &[&'static str]) {
|
||||
self.files.extend(sources);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if !Path::new("compiler-rt/.git").exists() {
|
||||
let _ = Command::new("git").args(&["submodule", "update", "--init"])
|
||||
.status();
|
||||
}
|
||||
|
||||
let target = env::var("TARGET").expect("TARGET was not set");
|
||||
let cfg = &mut gcc::Config::new();
|
||||
|
||||
if target.contains("msvc") {
|
||||
cfg.define("__func__", Some("__FUNCTION__"));
|
||||
} else {
|
||||
cfg.flag("-fno-builtin");
|
||||
cfg.flag("-fomit-frame-pointer");
|
||||
cfg.flag("-ffreestanding");
|
||||
}
|
||||
|
||||
let mut sources = Sources::new();
|
||||
|
||||
sources.extend(&[
|
||||
"muldi3.c",
|
||||
"mulosi4.c",
|
||||
"mulodi4.c",
|
||||
"divsi3.c",
|
||||
"divdi3.c",
|
||||
"modsi3.c",
|
||||
"moddi3.c",
|
||||
"divmodsi4.c",
|
||||
"divmoddi4.c",
|
||||
"ashldi3.c",
|
||||
"ashrdi3.c",
|
||||
"lshrdi3.c",
|
||||
"udivdi3.c",
|
||||
"umoddi3.c",
|
||||
"udivmoddi4.c",
|
||||
"udivsi3.c",
|
||||
"umodsi3.c",
|
||||
"udivmodsi4.c",
|
||||
"adddf3.c",
|
||||
"addsf3.c",
|
||||
"powidf2.c",
|
||||
"powisf2.c",
|
||||
"subdf3.c",
|
||||
"subsf3.c",
|
||||
"floatsisf.c",
|
||||
"floatsidf.c",
|
||||
"floatdidf.c",
|
||||
"floatunsisf.c",
|
||||
"floatunsidf.c",
|
||||
"floatundidf.c",
|
||||
"fixsfsi.c",
|
||||
"fixsfdi.c",
|
||||
"fixdfsi.c",
|
||||
"fixdfdi.c",
|
||||
"fixunssfsi.c",
|
||||
"fixunssfdi.c",
|
||||
"fixunsdfsi.c",
|
||||
"fixunsdfdi.c",
|
||||
// 128 bit integers
|
||||
"lshrti3.c",
|
||||
"modti3.c",
|
||||
"muloti4.c",
|
||||
"multi3.c",
|
||||
"udivmodti4.c",
|
||||
"udivti3.c",
|
||||
"umodti3.c",
|
||||
"ashlti3.c",
|
||||
"ashrti3.c",
|
||||
"divti3.c",
|
||||
]);
|
||||
|
||||
let builtins_dir = Path::new("compiler-rt/lib/builtins");
|
||||
for src in sources.files.iter() {
|
||||
cfg.file(builtins_dir.join(src));
|
||||
}
|
||||
|
||||
cfg.compile("libcompiler-rt.a");
|
||||
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
for source in sources.files.iter() {
|
||||
println!("cargo:rerun-if-changed={}", builtins_dir.join(source).display());
|
||||
}
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
#![feature(lang_items)]
|
||||
#![no_std]
|
||||
|
||||
extern {
|
||||
fn __ashldi3();
|
||||
fn __ashrdi3();
|
||||
fn __divdi3();
|
||||
fn __divmoddi4();
|
||||
fn __divmodsi4();
|
||||
fn __divsi3();
|
||||
fn __lshrdi3();
|
||||
fn __moddi3();
|
||||
fn __modsi3();
|
||||
fn __muldi3();
|
||||
fn __mulodi4();
|
||||
fn __mulosi4();
|
||||
fn __udivdi3();
|
||||
fn __udivmoddi4();
|
||||
fn __udivmodsi4();
|
||||
fn __udivsi3();
|
||||
fn __umoddi3();
|
||||
fn __umodsi3();
|
||||
fn __addsf3();
|
||||
fn __adddf3();
|
||||
fn __powisf2();
|
||||
fn __powidf2();
|
||||
fn __subsf3();
|
||||
fn __subdf3();
|
||||
fn __floatsisf();
|
||||
fn __floatsidf();
|
||||
fn __floatdidf();
|
||||
fn __floatunsisf();
|
||||
fn __floatunsidf();
|
||||
fn __floatundidf();
|
||||
fn __fixsfsi();
|
||||
fn __fixsfdi();
|
||||
fn __fixdfsi();
|
||||
fn __fixdfdi();
|
||||
fn __fixunssfsi();
|
||||
fn __fixunssfdi();
|
||||
fn __fixunsdfsi();
|
||||
fn __fixunsdfdi();
|
||||
}
|
||||
|
||||
macro_rules! declare {
|
||||
($func:ident, $sym:ident) => {
|
||||
#[no_mangle]
|
||||
pub extern fn $func() -> usize {
|
||||
$sym as usize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare!(___ashldi3, __ashldi3);
|
||||
declare!(___ashrdi3, __ashrdi3);
|
||||
declare!(___divdi3, __divdi3);
|
||||
declare!(___divmoddi4, __divmoddi4);
|
||||
declare!(___divmodsi4, __divmodsi4);
|
||||
declare!(___divsi3, __divsi3);
|
||||
declare!(___lshrdi3, __lshrdi3);
|
||||
declare!(___moddi3, __moddi3);
|
||||
declare!(___modsi3, __modsi3);
|
||||
declare!(___muldi3, __muldi3);
|
||||
declare!(___mulodi4, __mulodi4);
|
||||
declare!(___mulosi4, __mulosi4);
|
||||
declare!(___udivdi3, __udivdi3);
|
||||
declare!(___udivmoddi4, __udivmoddi4);
|
||||
declare!(___udivmodsi4, __udivmodsi4);
|
||||
declare!(___udivsi3, __udivsi3);
|
||||
declare!(___umoddi3, __umoddi3);
|
||||
declare!(___umodsi3, __umodsi3);
|
||||
declare!(___addsf3, __addsf3);
|
||||
declare!(___adddf3, __adddf3);
|
||||
declare!(___powisf2, __powisf2);
|
||||
declare!(___powidf2, __powidf2);
|
||||
declare!(___subsf3, __subsf3);
|
||||
declare!(___subdf3, __subdf3);
|
||||
declare!(___floatsisf, __floatsisf);
|
||||
declare!(___floatsidf, __floatsidf);
|
||||
declare!(___floatdidf, __floatdidf);
|
||||
declare!(___floatunsisf, __floatunsisf);
|
||||
declare!(___floatunsidf, __floatunsidf);
|
||||
declare!(___floatundidf, __floatundidf);
|
||||
declare!(___fixsfsi, __fixsfsi);
|
||||
declare!(___fixsfdi, __fixsfdi);
|
||||
declare!(___fixdfsi, __fixdfsi);
|
||||
declare!(___fixdfdi, __fixdfdi);
|
||||
declare!(___fixunssfsi, __fixunssfsi);
|
||||
declare!(___fixunssfdi, __fixunssfdi);
|
||||
declare!(___fixunsdfsi, __fixunsdfsi);
|
||||
declare!(___fixunsdfdi, __fixunsdfdi);
|
||||
|
||||
#[cfg(all(not(windows),
|
||||
not(target_arch = "mips64"),
|
||||
not(target_arch = "mips64el"),
|
||||
target_pointer_width="64"))]
|
||||
pub mod int_128 {
|
||||
extern {
|
||||
fn __lshrti3();
|
||||
fn __modti3();
|
||||
fn __muloti4();
|
||||
fn __multi3();
|
||||
fn __udivmodti4();
|
||||
fn __udivti3();
|
||||
fn __umodti3();
|
||||
fn __ashlti3();
|
||||
fn __ashrti3();
|
||||
fn __divti3();
|
||||
}
|
||||
|
||||
declare!(___lshrti3, __lshrti3);
|
||||
declare!(___modti3, __modti3);
|
||||
declare!(___muloti4, __muloti4);
|
||||
declare!(___multi3, __multi3);
|
||||
declare!(___udivmodti4, __udivmodti4);
|
||||
declare!(___udivti3, __udivti3);
|
||||
declare!(___umodti3, __umodti3);
|
||||
declare!(___ashlti3, __ashlti3);
|
||||
declare!(___ashrti3, __ashrti3);
|
||||
declare!(___divti3, __divti3);
|
||||
}
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
fn eh_personality() {}
|
||||
#[lang = "panic_fmt"]
|
||||
fn panic_fmt() {}
|
@ -1,35 +0,0 @@
|
||||
#![feature(drop_types_in_const)]
|
||||
|
||||
extern crate libloading;
|
||||
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
use std::env;
|
||||
|
||||
use libloading::Library;
|
||||
|
||||
fn compiler_rt() -> &'static Library {
|
||||
let dir = env::current_exe().unwrap();
|
||||
let cdylib = dir.parent().unwrap().read_dir().unwrap().map(|c| {
|
||||
c.unwrap().path()
|
||||
}).find(|path| {
|
||||
path.file_name().unwrap().to_str().unwrap().contains("compiler_rt_cdylib")
|
||||
}).unwrap();
|
||||
|
||||
unsafe {
|
||||
static mut COMPILER_RT: Option<Library> = None;
|
||||
static INIT: Once = ONCE_INIT;
|
||||
|
||||
INIT.call_once(|| {
|
||||
COMPILER_RT = Some(Library::new(&cdylib).unwrap());
|
||||
});
|
||||
COMPILER_RT.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(sym: &str) -> usize {
|
||||
unsafe {
|
||||
let sym = format!("_{}", sym);
|
||||
let f: fn() -> usize = *compiler_rt().get(sym.as_bytes()).unwrap();
|
||||
f()
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
[package]
|
||||
authors = ["Jorge Aparicio <japaricious@gmail.com>"]
|
||||
name = "gcc_s"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
libloading = "0.3.0"
|
@ -1,39 +0,0 @@
|
||||
#![feature(drop_types_in_const)]
|
||||
|
||||
extern crate libloading;
|
||||
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
use libloading::Library;
|
||||
|
||||
static mut GCC_S: Option<Library> = None;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn gcc_s() -> &'static Library {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
const LIBGCC_S: &'static str = "libgcc_s.so.1";
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
const LIBGCC_S: &'static str = "libgcc_s.1.dylib";
|
||||
|
||||
unsafe {
|
||||
static INIT: Once = ONCE_INIT;
|
||||
|
||||
INIT.call_once(|| {
|
||||
GCC_S = Some(Library::new(LIBGCC_S).unwrap());
|
||||
});
|
||||
GCC_S.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn get(_sym: &str) -> Option<usize> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub fn get(sym: &str) -> Option<usize> {
|
||||
unsafe {
|
||||
gcc_s().get(sym.as_bytes()).ok().map(|s| *s)
|
||||
}
|
||||
}
|
81
src/arm.rs
81
src/arm.rs
@ -180,84 +180,3 @@ pub unsafe extern "aapcs" fn __aeabi_memclr4(dest: *mut u8, n: usize) {
|
||||
pub unsafe extern "aapcs" fn __aeabi_memclr8(dest: *mut u8, n: usize) {
|
||||
memset(dest, 0, n);
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use quickcheck::TestResult;
|
||||
use qc::{U32, U64};
|
||||
|
||||
quickcheck!{
|
||||
fn uldivmod(n: U64, d: U64) -> TestResult {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let q: u64;
|
||||
let r: u64;
|
||||
unsafe {
|
||||
// The inline asm is a bit tricky here, LLVM will allocate
|
||||
// both r0 and r1 when we specify a 64-bit value for {r0}.
|
||||
asm!("bl __aeabi_uldivmod"
|
||||
: "={r0}" (q), "={r2}" (r)
|
||||
: "{r0}" (n), "{r2}" (d)
|
||||
: "r12", "lr", "flags");
|
||||
}
|
||||
TestResult::from_bool(q == n / d && r == n % d)
|
||||
}
|
||||
}
|
||||
|
||||
fn uidivmod(n: U32, d: U32) -> TestResult {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let q: u32;
|
||||
let r: u32;
|
||||
unsafe {
|
||||
asm!("bl __aeabi_uidivmod"
|
||||
: "={r0}" (q), "={r1}" (r)
|
||||
: "{r0}" (n), "{r1}" (d)
|
||||
: "r2", "r3", "r12", "lr", "flags");
|
||||
}
|
||||
TestResult::from_bool(q == n / d && r == n % d)
|
||||
}
|
||||
}
|
||||
|
||||
fn ldivmod(n: U64, d: U64) -> TestResult {
|
||||
let (n, d) = (n.0 as i64, d.0 as i64);
|
||||
if d == 0 {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let q: i64;
|
||||
let r: i64;
|
||||
unsafe {
|
||||
// The inline asm is a bit tricky here, LLVM will allocate
|
||||
// both r0 and r1 when we specify a 64-bit value for {r0}.
|
||||
asm!("bl __aeabi_ldivmod"
|
||||
: "={r0}" (q), "={r2}" (r)
|
||||
: "{r0}" (n), "{r2}" (d)
|
||||
: "r12", "lr", "flags");
|
||||
}
|
||||
TestResult::from_bool(q == n / d && r == n % d)
|
||||
}
|
||||
}
|
||||
|
||||
fn idivmod(n: U32, d: U32) -> TestResult {
|
||||
let (n, d) = (n.0 as i32, d.0 as i32);
|
||||
if d == 0 || (n == i32::min_value() && d == -1) {
|
||||
TestResult::discard()
|
||||
} else {
|
||||
let q: i32;
|
||||
let r: i32;
|
||||
unsafe {
|
||||
asm!("bl __aeabi_idivmod"
|
||||
: "={r0}" (q), "={r1}" (r)
|
||||
: "{r0}" (n), "{r1}" (d)
|
||||
: "r2", "r3", "r12", "lr", "flags");
|
||||
}
|
||||
TestResult::from_bool(q == n / d && r == n % d)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,28 +192,3 @@ add!("aapcs", __adddf3: f64);
|
||||
|
||||
#[cfg(not(target_arch = "arm"))]
|
||||
add!("C", __adddf3: f64);
|
||||
|
||||
// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabi*, our implementation doesn't
|
||||
// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll
|
||||
// just avoid testing against them on those targets. Do note that our implementation gives the
|
||||
// correct answer; gcc_s and compiler-rt are incorrect in this case.
|
||||
#[cfg(all(test, not(arm_linux)))]
|
||||
mod tests {
|
||||
use core::{f32, f64};
|
||||
use qc::{F32, F64};
|
||||
|
||||
check! {
|
||||
fn __addsf3(f: extern "C" fn(f32, f32) -> f32,
|
||||
a: F32,
|
||||
b: F32)
|
||||
-> Option<F32> {
|
||||
Some(F32(f(a.0, b.0)))
|
||||
}
|
||||
|
||||
fn __adddf3(f: extern "C" fn(f64, f64) -> f64,
|
||||
a: F64,
|
||||
b: F64) -> Option<F64> {
|
||||
Some(F64(f(a.0, b.0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ enum Sign {
|
||||
Positive,
|
||||
Negative
|
||||
}
|
||||
|
||||
macro_rules! fp_fix {
|
||||
($intrinsic:ident: $fty:ty, $ity:ty) => {
|
||||
pub extern "C" fn $intrinsic(f: $fty) -> $ity {
|
||||
@ -155,112 +156,3 @@ fp_fix!(__fixunssfsi: f32, u32);
|
||||
fp_fix!(__fixunssfdi: f32, u64);
|
||||
fp_fix!(__fixunsdfsi: f64, u32);
|
||||
fp_fix!(__fixunsdfdi: f64, u64);
|
||||
|
||||
// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabihf, our implementation doesn't
|
||||
// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll
|
||||
// just avoid testing against them on those targets. Do note that our implementation gives the
|
||||
// correct answer; gcc_s and compiler-rt are incorrect in this case.
|
||||
//
|
||||
#[cfg(all(test, not(arm_linux)))]
|
||||
mod tests {
|
||||
use qc::{I32, U32, I64, U64, F32, F64};
|
||||
|
||||
check! {
|
||||
fn __floatsisf(f: extern "C" fn(i32) -> f32,
|
||||
a: I32)
|
||||
-> Option<F32> {
|
||||
Some(F32(f(a.0)))
|
||||
}
|
||||
fn __floatsidf(f: extern "C" fn(i32) -> f64,
|
||||
a: I32)
|
||||
-> Option<F64> {
|
||||
Some(F64(f(a.0)))
|
||||
}
|
||||
fn __floatdidf(f: extern "C" fn(i64) -> f64,
|
||||
a: I64)
|
||||
-> Option<F64> {
|
||||
Some(F64(f(a.0)))
|
||||
}
|
||||
fn __floatunsisf(f: extern "C" fn(u32) -> f32,
|
||||
a: U32)
|
||||
-> Option<F32> {
|
||||
Some(F32(f(a.0)))
|
||||
}
|
||||
fn __floatunsidf(f: extern "C" fn(u32) -> f64,
|
||||
a: U32)
|
||||
-> Option<F64> {
|
||||
Some(F64(f(a.0)))
|
||||
}
|
||||
fn __floatundidf(f: extern "C" fn(u64) -> f64,
|
||||
a: U64)
|
||||
-> Option<F64> {
|
||||
Some(F64(f(a.0)))
|
||||
}
|
||||
|
||||
fn __fixsfsi(f: extern "C" fn(f32) -> i32,
|
||||
a: F32)
|
||||
-> Option<I32> {
|
||||
if (a.0 as f64) > (i32::max_value() as f64) ||
|
||||
(a.0 as f64) < (i32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I32(f(a.0))) }
|
||||
}
|
||||
fn __fixsfdi(f: extern "C" fn(f32) -> i64,
|
||||
a: F32)
|
||||
-> Option<I64> {
|
||||
if (a.0 as f64) > (i64::max_value() as f64) ||
|
||||
(a.0 as f64) < (i64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I64(f(a.0))) }
|
||||
}
|
||||
fn __fixdfsi(f: extern "C" fn(f64) -> i32,
|
||||
a: F64)
|
||||
-> Option<I32> {
|
||||
if a.0 > (i32::max_value() as f64) ||
|
||||
a.0 < (i32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I32(f(a.0))) }
|
||||
}
|
||||
fn __fixdfdi(f: extern "C" fn(f64) -> i64,
|
||||
a: F64)
|
||||
-> Option<I64> {
|
||||
if a.0 > (i64::max_value() as f64) ||
|
||||
a.0 < (i64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I64(f(a.0))) }
|
||||
}
|
||||
|
||||
fn __fixunssfsi(f: extern "C" fn(f32) -> u32,
|
||||
a: F32)
|
||||
-> Option<U32> {
|
||||
if (a.0 as f64) > (u32::max_value() as f64) ||
|
||||
(a.0 as f64) < (u32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U32(f(a.0))) }
|
||||
}
|
||||
fn __fixunssfdi(f: extern "C" fn(f32) -> u64,
|
||||
a: F32)
|
||||
-> Option<U64> {
|
||||
if (a.0 as f64) > (u64::max_value() as f64) ||
|
||||
(a.0 as f64) < (u64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U64(f(a.0))) }
|
||||
}
|
||||
fn __fixunsdfsi(f: extern "C" fn(f64) -> u32,
|
||||
a: F64)
|
||||
-> Option<U32> {
|
||||
if a.0 > (u32::max_value() as f64) ||
|
||||
a.0 < (u32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U32(f(a.0))) }
|
||||
}
|
||||
fn __fixunsdfdi(f: extern "C" fn(f64) -> u64,
|
||||
a: F64)
|
||||
-> Option<U64> {
|
||||
if a.0 <= (u64::max_value() as f64) ||
|
||||
a.0 >= (u64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U64(f(a.0))) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,22 +28,3 @@ macro_rules! pow {
|
||||
|
||||
pow!(__powisf2: f32, i32);
|
||||
pow!(__powidf2: f64, i32);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use qc::{I32, F32, F64};
|
||||
|
||||
check! {
|
||||
fn __powisf2(f: extern "C" fn(f32, i32) -> f32,
|
||||
a: F32,
|
||||
b: I32) -> Option<F32> {
|
||||
Some(F32(f(a.0, b.0)))
|
||||
}
|
||||
|
||||
fn __powidf2(f: extern "C" fn(f64, i32) -> f64,
|
||||
a: F64,
|
||||
b: I32) -> Option<F64> {
|
||||
Some(F64(f(a.0, b.0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,28 +18,3 @@ sub!(#[cfg_attr(all(not(test), not(target_arch = "arm")), no_mangle)]
|
||||
sub!(#[cfg_attr(all(not(test), not(target_arch = "arm")), no_mangle)]
|
||||
#[cfg_attr(all(not(test), target_arch = "arm"), inline(always))]
|
||||
| __subdf3: f64);
|
||||
|
||||
// NOTE(cfg) for some reason, on arm*-unknown-linux-gnueabi*, our implementation doesn't
|
||||
// match the output of its gcc_s or compiler-rt counterpart. Until we investigate further, we'll
|
||||
// just avoid testing against them on those targets. Do note that our implementation gives the
|
||||
// correct answer; gcc_s and compiler-rt are incorrect in this case.
|
||||
#[cfg(all(test, not(arm_linux)))]
|
||||
mod tests {
|
||||
use core::{f32, f64};
|
||||
use qc::{F32, F64};
|
||||
|
||||
check! {
|
||||
fn __subsf3(f: extern "C" fn(f32, f32) -> f32,
|
||||
a: F32,
|
||||
b: F32)
|
||||
-> Option<F32> {
|
||||
Some(F32(f(a.0, b.0)))
|
||||
}
|
||||
|
||||
fn __subdf3(f: extern "C" fn(f64, f64) -> f64,
|
||||
a: F64,
|
||||
b: F64) -> Option<F64> {
|
||||
Some(F64(f(a.0, b.0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,66 +93,3 @@ mulo!(__mulodi4: i64);
|
||||
mulo!(__muloti4: i128, "unadjusted");
|
||||
#[cfg(not(all(windows, target_pointer_width="64")))]
|
||||
mulo!(__muloti4: i128);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use qc::{I32, I64, U64};
|
||||
|
||||
check! {
|
||||
fn __muldi3(f: extern "C" fn(u64, u64) -> u64, a: U64, b: U64)
|
||||
-> Option<u64> {
|
||||
Some(f(a.0, b.0))
|
||||
}
|
||||
|
||||
fn __mulosi4(f: extern "C" fn(i32, i32, &mut i32) -> i32,
|
||||
a: I32,
|
||||
b: I32) -> Option<(i32, i32)> {
|
||||
let (a, b) = (a.0, b.0);
|
||||
let mut overflow = 2;
|
||||
let r = f(a, b, &mut overflow);
|
||||
if overflow != 0 && overflow != 1 {
|
||||
panic!("Invalid value {} for overflow", overflow);
|
||||
}
|
||||
Some((r, overflow))
|
||||
}
|
||||
|
||||
fn __mulodi4(f: extern "C" fn(i64, i64, &mut i32) -> i64,
|
||||
a: I64,
|
||||
b: I64) -> Option<(i64, i32)> {
|
||||
let (a, b) = (a.0, b.0);
|
||||
let mut overflow = 2;
|
||||
let r = f(a, b, &mut overflow);
|
||||
if overflow != 0 && overflow != 1 {
|
||||
panic!("Invalid value {} for overflow", overflow);
|
||||
}
|
||||
Some((r, overflow))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(not(windows),
|
||||
not(target_arch = "mips64"),
|
||||
not(target_arch = "mips64el"),
|
||||
target_pointer_width="64"))]
|
||||
mod tests_i128 {
|
||||
use qc::I128;
|
||||
|
||||
check! {
|
||||
fn __multi3(f: extern "C" fn(i128, i128) -> i128, a: I128, b: I128)
|
||||
-> Option<i128> {
|
||||
Some(f(a.0, b.0))
|
||||
}
|
||||
fn __muloti4(f: extern "C" fn(i128, i128, &mut i32) -> i128,
|
||||
a: I128,
|
||||
b: I128) -> Option<(i128, i32)> {
|
||||
let (a, b) = (a.0, b.0);
|
||||
let mut overflow = 2;
|
||||
let r = f(a, b, &mut overflow);
|
||||
if overflow != 0 && overflow != 1 {
|
||||
panic!("Invalid value {} for overflow", overflow);
|
||||
}
|
||||
Some((r, overflow))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
117
src/int/sdiv.rs
117
src/int/sdiv.rs
@ -100,120 +100,3 @@ divmod!("aapcs", __divmoddi4, __divdi3: i64);
|
||||
|
||||
#[cfg(not(target_arch = "arm"))]
|
||||
divmod!("C", __divmoddi4, __divdi3: i64);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use qc::{U32, U64};
|
||||
|
||||
check! {
|
||||
fn __divdi3(f: extern "C" fn(i64, i64) -> i64, n: U64, d: U64) -> Option<i64> {
|
||||
let (n, d) = (n.0 as i64, d.0 as i64);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __moddi3(f: extern "C" fn(i64, i64) -> i64, n: U64, d: U64) -> Option<i64> {
|
||||
let (n, d) = (n.0 as i64, d.0 as i64);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
fn __divmoddi4(f: extern "aapcs" fn(i64, i64, &mut i64) -> i64,
|
||||
n: U64,
|
||||
d: U64) -> Option<(i64, i64)> {
|
||||
let (n, d) = (n.0 as i64, d.0 as i64);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut r = 0;
|
||||
let q = f(n, d, &mut r);
|
||||
Some((q, r))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "arm"))]
|
||||
fn __divmoddi4(f: extern "C" fn(i64, i64, &mut i64) -> i64,
|
||||
n: U64,
|
||||
d: U64) -> Option<(i64, i64)> {
|
||||
let (n, d) = (n.0 as i64, d.0 as i64);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut r = 0;
|
||||
let q = f(n, d, &mut r);
|
||||
Some((q, r))
|
||||
}
|
||||
}
|
||||
|
||||
fn __divsi3(f: extern "C" fn(i32, i32) -> i32,
|
||||
n: U32,
|
||||
d: U32) -> Option<i32> {
|
||||
let (n, d) = (n.0 as i32, d.0 as i32);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __modsi3(f: extern "C" fn(i32, i32) -> i32,
|
||||
n: U32,
|
||||
d: U32) -> Option<i32> {
|
||||
let (n, d) = (n.0 as i32, d.0 as i32);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __divmodsi4(f: extern "C" fn(i32, i32, &mut i32) -> i32,
|
||||
n: U32,
|
||||
d: U32) -> Option<(i32, i32)> {
|
||||
let (n, d) = (n.0 as i32, d.0 as i32);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut r = 0;
|
||||
let q = f(n, d, &mut r);
|
||||
Some((q, r))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(not(windows),
|
||||
not(target_arch = "mips64"),
|
||||
not(target_arch = "mips64el"),
|
||||
target_pointer_width="64"))]
|
||||
mod tests_i128 {
|
||||
use qc::U128;
|
||||
check! {
|
||||
|
||||
fn __divti3(f: extern "C" fn(i128, i128) -> i128, n: U128, d: U128) -> Option<i128> {
|
||||
let (n, d) = (n.0 as i128, d.0 as i128);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __modti3(f: extern "C" fn(i128, i128) -> i128, n: U128, d: U128) -> Option<i128> {
|
||||
let (n, d) = (n.0 as i128, d.0 as i128);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,77 +72,3 @@ ashr!(__ashrti3: i128);
|
||||
lshr!(__lshrdi3: u64);
|
||||
|
||||
lshr!(__lshrti3: u128);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use qc::{I64, U64};
|
||||
|
||||
// NOTE We purposefully stick to `u32` for `b` here because we want "small" values (b < 64)
|
||||
check! {
|
||||
fn __ashldi3(f: extern "C" fn(u64, u32) -> u64, a: U64, b: u32) -> Option<u64> {
|
||||
let a = a.0;
|
||||
if b >= 64 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
|
||||
fn __ashrdi3(f: extern "C" fn(i64, u32) -> i64, a: I64, b: u32) -> Option<i64> {
|
||||
let a = a.0;
|
||||
if b >= 64 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
|
||||
fn __lshrdi3(f: extern "C" fn(u64, u32) -> u64, a: U64, b: u32) -> Option<u64> {
|
||||
let a = a.0;
|
||||
if b >= 64 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(not(windows),
|
||||
not(target_arch = "mips64"),
|
||||
not(target_arch = "mips64el"),
|
||||
target_pointer_width="64"))]
|
||||
mod tests_i128 {
|
||||
use qc::{I128, U128};
|
||||
|
||||
// NOTE We purposefully stick to `u32` for `b` here because we want "small" values (b < 64)
|
||||
check! {
|
||||
fn __ashlti3(f: extern "C" fn(u128, u32) -> u128, a: U128, b: u32) -> Option<u128> {
|
||||
let a = a.0;
|
||||
if b >= 64 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
|
||||
fn __ashrti3(f: extern "C" fn(i128, u32) -> i128, a: I128, b: u32) -> Option<i128> {
|
||||
let a = a.0;
|
||||
if b >= 64 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
|
||||
fn __lshrti3(f: extern "C" fn(u128, u32) -> u128, a: U128, b: u32) -> Option<u128> {
|
||||
let a = a.0;
|
||||
if b >= 128 {
|
||||
None
|
||||
} else {
|
||||
Some(f(a, b))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
117
src/int/udiv.rs
117
src/int/udiv.rs
@ -312,120 +312,3 @@ udivmodti4!(::U64x2, ::conv);
|
||||
|
||||
#[cfg(not(all(windows, target_pointer_width="64")))]
|
||||
udivmodti4!(u128, |i|{ i });
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use qc::{U32, U64};
|
||||
|
||||
check! {
|
||||
fn __udivdi3(f: extern "C" fn(u64, u64) -> u64, n: U64, d: U64) -> Option<u64> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __umoddi3(f: extern "C" fn(u64, u64) -> u64, n: U64, d: U64) -> Option<u64> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __udivmoddi4(f: extern "C" fn(u64, u64, Option<&mut u64>) -> u64,
|
||||
n: U64,
|
||||
d: U64) -> Option<(u64, u64)> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut r = 0;
|
||||
let q = f(n, d, Some(&mut r));
|
||||
Some((q, r))
|
||||
}
|
||||
}
|
||||
|
||||
fn __udivsi3(f: extern "C" fn(u32, u32) -> u32, n: U32, d: U32) -> Option<u32> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __umodsi3(f: extern "C" fn(u32, u32) -> u32, n: U32, d: U32) -> Option<u32> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __udivmodsi4(f: extern "C" fn(u32, u32, Option<&mut u32>) -> u32,
|
||||
n: U32,
|
||||
d: U32) -> Option<(u32, u32)> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
let mut r = 0;
|
||||
let q = f(n, d, Some(&mut r));
|
||||
Some((q, r))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(not(windows),
|
||||
not(target_arch = "mips64"),
|
||||
not(target_arch = "mips64el"),
|
||||
target_pointer_width="64"))]
|
||||
mod tests_i128 {
|
||||
use qc::U128;
|
||||
|
||||
check! {
|
||||
fn __udivti3(f: extern "C" fn(u128, u128) -> u128,
|
||||
n: U128,
|
||||
d: U128) -> Option<u128> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __umodti3(f: extern "C" fn(u128, u128) -> u128,
|
||||
n: U128,
|
||||
d: U128) -> Option<u128> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(f(n, d))
|
||||
}
|
||||
}
|
||||
|
||||
fn __udivmodti4(f: extern "C" fn(u128, u128, Option<&mut u128>) -> u128,
|
||||
n: U128,
|
||||
d: U128) -> Option<u128> {
|
||||
let (n, d) = (n.0, d.0);
|
||||
if d == 0 {
|
||||
None
|
||||
} else {
|
||||
// FIXME fix the segfault when the remainder is requested
|
||||
/*let mut r = 0;
|
||||
let q = f(n, d, Some(&mut r));
|
||||
Some((q, r))*/
|
||||
Some(f(n, d, None))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
src/lib.rs
17
src/lib.rs
@ -111,26 +111,9 @@ fn sconv(i: i128) -> U64x2 {
|
||||
U64x2(j.low(), j.high())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg_attr(target_arch = "arm", macro_use)]
|
||||
extern crate quickcheck;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate core;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate gcc_s;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate compiler_rt;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate rand;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
mod qc;
|
||||
|
||||
pub mod int;
|
||||
pub mod float;
|
||||
|
||||
|
8
tests/adddf3.rs
Normal file
8
tests/adddf3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/adddf3.rs"));
|
8
tests/addsf3.rs
Normal file
8
tests/addsf3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/addsf3.rs"));
|
8
tests/ashldi3.rs
Normal file
8
tests/ashldi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/ashldi3.rs"));
|
8
tests/ashlti3.rs
Normal file
8
tests/ashlti3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/ashlti3.rs"));
|
8
tests/ashrdi3.rs
Normal file
8
tests/ashrdi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/ashrdi3.rs"));
|
8
tests/ashrti3.rs
Normal file
8
tests/ashrti3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/ashrti3.rs"));
|
8
tests/divdi3.rs
Normal file
8
tests/divdi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/divdi3.rs"));
|
8
tests/divmoddi4.rs
Normal file
8
tests/divmoddi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/divmoddi4.rs"));
|
8
tests/divmodsi4.rs
Normal file
8
tests/divmodsi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/divmodsi4.rs"));
|
8
tests/divsi3.rs
Normal file
8
tests/divsi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/divsi3.rs"));
|
11
tests/divti3.rs
Normal file
11
tests/divti3.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
// FIXME(#158)
|
||||
#[cfg(not(any(target_arch = "mips", windows)))]
|
||||
include!(concat!(env!("OUT_DIR"), "/divti3.rs"));
|
8
tests/fixdfdi.rs
Normal file
8
tests/fixdfdi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixdfdi.rs"));
|
8
tests/fixdfsi.rs
Normal file
8
tests/fixdfsi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixdfsi.rs"));
|
8
tests/fixsfdi.rs
Normal file
8
tests/fixsfdi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixsfdi.rs"));
|
8
tests/fixsfsi.rs
Normal file
8
tests/fixsfsi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixsfsi.rs"));
|
8
tests/fixunsdfdi.rs
Normal file
8
tests/fixunsdfdi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixunsdfdi.rs"));
|
8
tests/fixunsdfsi.rs
Normal file
8
tests/fixunsdfsi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixunsdfsi.rs"));
|
8
tests/fixunssfdi.rs
Normal file
8
tests/fixunssfdi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixunssfdi.rs"));
|
8
tests/fixunssfsi.rs
Normal file
8
tests/fixunssfsi.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/fixunssfsi.rs"));
|
8
tests/floatdidf.rs
Normal file
8
tests/floatdidf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatdidf.rs"));
|
8
tests/floatsidf.rs
Normal file
8
tests/floatsidf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatsidf.rs"));
|
8
tests/floatsisf.rs
Normal file
8
tests/floatsisf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatsisf.rs"));
|
8
tests/floatundidf.rs
Normal file
8
tests/floatundidf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatundidf.rs"));
|
8
tests/floatunsidf.rs
Normal file
8
tests/floatunsidf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatunsidf.rs"));
|
8
tests/floatunsisf.rs
Normal file
8
tests/floatunsisf.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/floatunsisf.rs"));
|
8
tests/lshrdi3.rs
Normal file
8
tests/lshrdi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/lshrdi3.rs"));
|
8
tests/lshrti3.rs
Normal file
8
tests/lshrti3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/lshrti3.rs"));
|
8
tests/moddi3.rs
Normal file
8
tests/moddi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/moddi3.rs"));
|
8
tests/modsi3.rs
Normal file
8
tests/modsi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/modsi3.rs"));
|
11
tests/modti3.rs
Normal file
11
tests/modti3.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
// FIXME(#158)
|
||||
#[cfg(not(any(target_arch = "mips", windows)))]
|
||||
include!(concat!(env!("OUT_DIR"), "/modti3.rs"));
|
8
tests/muldi3.rs
Normal file
8
tests/muldi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/muldi3.rs"));
|
8
tests/mulodi4.rs
Normal file
8
tests/mulodi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/mulodi4.rs"));
|
8
tests/mulosi4.rs
Normal file
8
tests/mulosi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/mulosi4.rs"));
|
10
tests/muloti4.rs
Normal file
10
tests/muloti4.rs
Normal file
@ -0,0 +1,10 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
#[cfg(not(target_arch = "mips"))]
|
||||
include!(concat!(env!("OUT_DIR"), "/muloti4.rs"));
|
8
tests/multi3.rs
Normal file
8
tests/multi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/multi3.rs"));
|
8
tests/powidf2.rs
Normal file
8
tests/powidf2.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/powidf2.rs"));
|
8
tests/powisf2.rs
Normal file
8
tests/powisf2.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/powisf2.rs"));
|
8
tests/subdf3.rs
Normal file
8
tests/subdf3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/subdf3.rs"));
|
8
tests/subsf3.rs
Normal file
8
tests/subsf3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/subsf3.rs"));
|
8
tests/udivdi3.rs
Normal file
8
tests/udivdi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/udivdi3.rs"));
|
8
tests/udivmoddi4.rs
Normal file
8
tests/udivmoddi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/udivmoddi4.rs"));
|
8
tests/udivmodsi4.rs
Normal file
8
tests/udivmodsi4.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/udivmodsi4.rs"));
|
11
tests/udivmodti4.rs
Normal file
11
tests/udivmodti4.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
// FIXME(#158)
|
||||
#[cfg(not(any(target_arch = "mips", windows)))]
|
||||
include!(concat!(env!("OUT_DIR"), "/udivmodti4.rs"));
|
8
tests/udivsi3.rs
Normal file
8
tests/udivsi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/udivsi3.rs"));
|
11
tests/udivti3.rs
Normal file
11
tests/udivti3.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
// FIXME(#158)
|
||||
#[cfg(not(any(target_arch = "mips", windows)))]
|
||||
include!(concat!(env!("OUT_DIR"), "/udivti3.rs"));
|
8
tests/umoddi3.rs
Normal file
8
tests/umoddi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/umoddi3.rs"));
|
8
tests/umodsi3.rs
Normal file
8
tests/umodsi3.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/umodsi3.rs"));
|
11
tests/umodti3.rs
Normal file
11
tests/umodti3.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(i128_type)]
|
||||
#![cfg_attr(all(target_arch = "arm",
|
||||
not(any(target_env = "gnu", target_env = "musl")),
|
||||
target_os = "linux",
|
||||
test), no_std)]
|
||||
|
||||
// FIXME(#137)
|
||||
// FIXME(#158)
|
||||
#[cfg(not(any(target_arch = "mips", windows)))]
|
||||
include!(concat!(env!("OUT_DIR"), "/umodti3.rs"));
|
27
thumbv6m-linux-eabi.json
Normal file
27
thumbv6m-linux-eabi.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"abi-blacklist": [
|
||||
"stdcall",
|
||||
"fastcall",
|
||||
"vectorcall",
|
||||
"win64",
|
||||
"sysv64"
|
||||
],
|
||||
"arch": "arm",
|
||||
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
|
||||
"env": "",
|
||||
"executables": true,
|
||||
"features": "+strict-align",
|
||||
"linker": "arm-none-eabi-gcc",
|
||||
"linker-flavor": "gcc",
|
||||
"llvm-target": "thumbv6m-none-eabi",
|
||||
"max-atomic-width": 0,
|
||||
"os": "linux",
|
||||
"panic-strategy": "abort",
|
||||
"pre-link-args": {
|
||||
"gcc": ["-nostartfiles"]
|
||||
},
|
||||
"relocation-model": "static",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "32",
|
||||
"vendor": ""
|
||||
}
|
26
thumbv7em-linux-eabi.json
Normal file
26
thumbv7em-linux-eabi.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"abi-blacklist": [
|
||||
"stdcall",
|
||||
"fastcall",
|
||||
"vectorcall",
|
||||
"win64",
|
||||
"sysv64"
|
||||
],
|
||||
"arch": "arm",
|
||||
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
|
||||
"env": "",
|
||||
"executables": true,
|
||||
"linker": "arm-none-eabi-gcc",
|
||||
"linker-flavor": "gcc",
|
||||
"llvm-target": "thumbv7em-none-eabi",
|
||||
"max-atomic-width": 32,
|
||||
"os": "linux",
|
||||
"panic-strategy": "abort",
|
||||
"pre-link-args": {
|
||||
"gcc": ["-nostartfiles"]
|
||||
},
|
||||
"relocation-model": "static",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "32",
|
||||
"vendor": ""
|
||||
}
|
27
thumbv7em-linux-eabihf.json
Normal file
27
thumbv7em-linux-eabihf.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"abi-blacklist": [
|
||||
"stdcall",
|
||||
"fastcall",
|
||||
"vectorcall",
|
||||
"win64",
|
||||
"sysv64"
|
||||
],
|
||||
"arch": "arm",
|
||||
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
|
||||
"env": "",
|
||||
"executables": true,
|
||||
"features": "+vfp4,+d16,+fp-only-sp",
|
||||
"linker": "arm-none-eabi-gcc",
|
||||
"linker-flavor": "gcc",
|
||||
"llvm-target": "thumbv7em-none-eabihf",
|
||||
"max-atomic-width": 32,
|
||||
"os": "linux",
|
||||
"panic-strategy": "abort",
|
||||
"pre-link-args": {
|
||||
"gcc": ["-nostartfiles"]
|
||||
},
|
||||
"relocation-model": "static",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "32",
|
||||
"vendor": ""
|
||||
}
|
26
thumbv7m-linux-eabi.json
Normal file
26
thumbv7m-linux-eabi.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"abi-blacklist": [
|
||||
"stdcall",
|
||||
"fastcall",
|
||||
"vectorcall",
|
||||
"win64",
|
||||
"sysv64"
|
||||
],
|
||||
"arch": "arm",
|
||||
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
|
||||
"env": "",
|
||||
"executables": true,
|
||||
"linker": "arm-none-eabi-gcc",
|
||||
"linker-flavor": "gcc",
|
||||
"llvm-target": "thumbv7m-none-eabi",
|
||||
"max-atomic-width": 32,
|
||||
"os": "linux",
|
||||
"panic-strategy": "abort",
|
||||
"pre-link-args": {
|
||||
"gcc": ["-nostartfiles"]
|
||||
},
|
||||
"relocation-model": "static",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "32",
|
||||
"vendor": ""
|
||||
}
|
Loading…
Reference in New Issue
Block a user