Commit Graph

199 Commits

Author SHA1 Message Date
est31
9bdedec38e Refactor float builtins to use associated consts 2017-09-13 22:09:52 +02:00
est31
c9a261895e Refactor int builtins to use associated consts 2017-09-13 22:09:31 +02:00
Tim Neumann
c138713df1 Avoid memcpy references in unoptimized code 2017-07-22 23:10:30 +02:00
Oliver Middleton
064452423a Don't include custom chkstk on MSVC
MSVC includes its own __chkstk so these aren't used.
2017-07-12 22:40:49 +01:00
Alex Crichton
91eaa85902 Don't mangle probes all the time 2017-07-07 20:35:14 -07:00
Alex Crichton
f9f6bd0589 Tweak definition of probestack functions
It looks like the old `__rust_probestack` routine is incompatible with newer
linux kernels. My best guess for this is that the kernel's auto-growth logic is
failing to trigger, causing what looks like a legitimate segfault to get
delivered. My best guess for why *that's* happening is that the faulting address
is below `%rsp`, whereas previously all faulting stack addresses were above
`%rsp`. The probestack routine does not modify `%rsp` as it's probing the stack,
and presumably newer kernels are interpreting this as a legitimate violation.

This commit tweaks the probestack routine to instead update `%rsp` incrementally
as probing happens. The ABI of the function, however, requires that `%rsp`
isn't changed as part of the function so it's restored at the end to the
previous value.
2017-07-07 10:16:03 -07:00
Alex Crichton
7ccf8408d0 Add __rust_probestack intrinsic
Will be required for rust-lang/rust#42816
2017-07-06 06:58:32 -07:00
Alex Crichton
238647af80 Fix unused imports on iOS 2017-07-03 19:11:34 -07:00
Alex Crichton
681aaa914d Use the Rust implementation of udivsi3 on ARM
Although compiler-rt presumably has a more optimized implementation written in
assembly, it appears buggy for whatever reason, causing #173.

For now let's see if integration into rust-lang/rust will work with the
Rust-defined implementation!
2017-07-03 09:48:11 -07:00
Jorge Aparicio
b8a662040e no aeabi_mem* symbols on iOS, weak symbols on thumb, normal symbols elsewhere 2017-06-30 18:06:25 -05:00
Jorge Aparicio
75c6ccca71 optimize 32-bit aligned mem{cpy,clr,set} intrinsics for ARM
this reduces the execution time of all these routines by 40-70%
2017-06-29 22:40:58 -05:00
Alex Crichton
0ebbcaede4 Enable the intrinsics program on thumb 2017-06-25 10:09:50 -07:00
Alex Crichton
afe5c717a9 Address review comments 2017-06-24 21:51:34 -07:00
Alex Crichton
c193113721 Don't test mangled names on thumb
We are both the "real compiler-rt" and the "to be tested one".
2017-06-24 12:54:35 -07:00
Alex Crichton
acaa2f071a Don't check for references to panics with debug assertions 2017-06-24 11:44:50 -07:00
Alex Crichton
d051480eff Don't generate unmangled aeabi with gen-tests
The symbols they delgate to also don't exist...
2017-06-24 11:34:10 -07:00
Alex Crichton
91b1291dc5 Don't try to work with cargo test 2017-06-24 10:22:49 -07:00
Alex Crichton
734ec3d31c Tweak testing and such:
* Don't run `intrinsics` tests on thumb
* Disable `compiler_builtins` attribute on `feature = "gen-tests"`
* Disable mangling on `feature = "gen-tests"` instead of `cfg(test)`
2017-06-24 10:10:04 -07:00
Alex Crichton
2147753559 Remove usage of unwrap_or_else 2017-06-23 21:31:54 -07:00
Alex Crichton
4dac0be751 Don't derive Debug for Sign 2017-06-23 21:11:31 -07:00
Alex Crichton
b42d267065 Don't compile assembly on x86_64 Windows
They've all got the wrong ABI...
2017-06-23 21:09:24 -07:00
Alex Crichton
eabb6fab4a Shore up docs in the macros module 2017-06-23 16:28:50 -07:00
Alex Crichton
7de57cd4f9 Handle aeabi aliasing
Objects in compiler-rt may have two symbols, so this makes sure that we don't
bring in those objects by accident by defining the aliases ourselves.
2017-06-23 15:55:11 -07:00
Alex Crichton
a839d53a02 Deal with floatdidf on x86_64
Apparently LLVM will lower this down to just an instruction
2017-06-23 13:28:24 -07:00
Alex Crichton
5172f8c218 Tweak usage of C shims on MSVC 2017-06-23 12:03:33 -07:00
Alex Crichton
a16ebb0dcb Use nm to weed out panics 2017-06-23 11:52:22 -07:00
Alex Crichton
5a444d58f2 Remove unused rust file 2017-06-23 11:21:36 -07:00
Alex Crichton
7c4745061a Remove executable bit on arm.rs 2017-06-23 11:21:15 -07:00
Alex Crichton
83d63eaa9b Convert float intrinsics to the intrinsics! macro 2017-06-23 11:05:25 -07:00
Alex Crichton
93fed264c1 Remove executable bit from conv.rs 2017-06-23 10:44:59 -07:00
Alex Crichton
4c41b5649f Fix use_c_shim_if 2017-06-23 07:54:31 -07:00
Alex Crichton
47ff81325c Use more intrinsics on msvc 2017-06-23 07:53:34 -07:00
Alex Crichton
12a0038250 Fix the abi hack on windows 2017-06-22 23:36:50 -07:00
Alex Crichton
d17042106f Port udiv to the intrinsics! macro 2017-06-22 23:23:36 -07:00
Alex Crichton
7886ae275b Port sdiv to traits + intrinsics!
Enhance `intrinsics!` along the way!
2017-06-22 23:09:28 -07:00
Alex Crichton
275d1032b5 Port mul intrinsics to traits
Also add a few features to the `intrinsics!` macro
2017-06-22 22:36:37 -07:00
Alex Crichton
eeb44abacf Remove executable bit from mod.rs 2017-06-22 22:04:40 -07:00
Alex Crichton
2f2bb32e40 Use traits instead of macros for shift intrinsics
This is an attempt to tidy up the definition of intrinsics by making them more
rust-like at the definition site and using traits instead of macros for the
definition. Additionally the helper macro, `intrinsics!`, now fills in a
definition for #[cfg]'d off intrinsics when compiling with C code
2017-06-22 22:03:07 -07:00
Jorge Aparicio
b2f72e1eb1 remove unused macros
to fix warnings
2017-06-01 07:40:50 -05:00
est31
673a6f9948 Fix overflow bug when creating the absolute value
Previously, the tests failed on some platforms due to it.
2017-05-08 04:30:48 +02:00
est31
f90792e1bc Add i128 <-> float conversion functions 2017-05-06 02:22:54 +02:00
est31
144e54d7b0 Rename float conversion macros to something nicer 2017-05-05 23:31:41 +02:00
Jorge Aparicio
19b2efdf36 move intrinsics test from src/bin to examples
with this change the libc crate is not required when calling `cargo build -p
compiler-builtins`
2017-04-11 17:09:05 -05:00
Jorge Aparicio
d34c51f74a remove arm tests from the old test suite 2017-04-10 16:35:08 -05:00
Jorge Aparicio
b8e8c7f693 no_std compatible tester 2017-04-10 14:38:17 -05:00
Jorge Aparicio
cc0d8ba2d1 remove the current test suite 2017-04-10 11:14:05 -05:00
bors
28ac4908f8 Auto merge of #147 - rust-lang-nursery:conv, r=japaric
Conversion from&to float<->integer

this is a rebased version of #139

cc @ithinuel
2017-04-08 15:20:35 +00:00
Jorge Aparicio
109c33ed0a test out of range condition using f64
to avoid imprecision due to rounding to f32
2017-04-08 10:18:19 -05:00
Jorge Aparicio
2faec6a4fb fix debug assertion in modsi3 / moddi3
fixes #151
this fix is very similar to #149
2017-03-13 20:40:44 -05:00
bors
9681358dc5 Auto merge of #149 - rust-lang-nursery:gh148, r=alexcrichton
fix debug assertion in divdi3

fixes #148

r? @alexcrichton
2017-03-07 00:38:33 +00:00
Jorge Aparicio
c93b32b3e5 fix debug assertion in divdi3
fixes #148
2017-03-06 17:46:11 -05:00
Jorge Aparicio
4c556dc9e7 fix quickcheck tests
the check! macro syntax has changed
2017-03-06 12:17:41 -05:00
Jorge Aparicio
c6e06f4157 refactor 'impl Int' 2017-03-06 12:17:10 -05:00
Wilfried Chauveau
09d2f2f1f5 exclude from tests values out of integer range (and NaN). 2017-03-06 11:56:52 -05:00
Wilfried Chauveau
d96102d270 implement float/double to (u)int conversion. 2017-03-06 11:56:52 -05:00
Wilfried Chauveau
293fef5ebe impl (unsigned/signed) int to single/double precision float conversion based on llvm algorithms. 2017-03-06 11:55:57 -05:00
Jorge Aparicio
644a1c9ac9 fix infinite recursion in divmoddi4 / mulodi4
on ARMv7-M processors, divmoddi4 was calling mulodi4 and mulodi4 was calling
divmoddi4 leading to infinite recursion. This commit breaks the cycle by using
wrapping multiplication in divmoddi4.

fixes #145
2017-03-06 10:38:19 -05:00
Jorge Aparicio
5bb969d8f5 implement float subtraction
as a + (-b)
2017-02-08 10:10:40 -05:00
Jorge Aparicio
47b45d1d62 adjust the check! macro to accept AAPCS intrinsics 2017-02-07 23:07:51 -05:00
Jorge Aparicio
57085be2ea ARM: keep some non-aeabi symbols around
- multi3: there's no aeabi equivalent
- divmod{s,d}i4: these are directly called by __aeabi_{l,i}divmod
- add{s,d}f3: required by the C sub{s,d}f3 implementation

but make sure they also use the AAPCS calling convention
2017-02-07 14:28:02 -05:00
Jorge Aparicio
dfa7b161aa use AAPCS calling convention on all aeabi intrinsics
also, on ARM, inline(always) the actual implementation of the intrinsics so we
end with code like this:

```
00000000 <__aeabi_dadd>:
    (implementation here)
```

instead of "trampolines" like this:

```
00000000 <__aeabi_dadd>:
    (shuffle registers)
    (call __adddf3)

00000000 <__adddf3>:
    (implementation here)
```

closes #116
2017-02-07 09:41:26 -05:00
est31
37d349015e Disable quickcheck tests on mips
Two reasons:
    * the C versions __divti3 and __modti3 are apparently broken,
      at least when used in quickcheck. They change their own arguments.
    * compiler_rt's support for mips is disabled already on clang [1].
      Its desireable to support working "cargo test" on that compiler
      as well, and not greet the tester with linker errors.

[1]: http://llvm.org/viewvc/llvm-project?view=revision&revision=224488
2017-02-04 12:23:45 +01:00
est31
f8a4e3fd70 Panic when invalid overflow value is returned 2017-02-04 01:39:19 +01:00
est31
b78e956f08 Add quickcheck tests 2017-02-03 23:46:15 +01:00
est31
417b07b821 Add newly implemented intrinsics to test file 2017-02-03 01:51:46 +01:00
est31
9013dbef02 u128 sdiv intrinsics 2017-02-02 22:13:28 +01:00
est31
2f3c534cfe u128 udiv intrinsics 2017-02-02 22:11:14 +01:00
est31
8fe50d813c Macro-ify udivmod 2017-02-02 22:03:42 +01:00
est31
1e27c3f937 i128 shift intrinsics 2017-02-02 22:02:51 +01:00
est31
3055aa21b6 i128 mul intrinsics 2017-02-02 21:36:56 +01:00
est31
b356429374 int module: macro-ify trait impls and add {u,i}128 support 2017-02-02 21:36:02 +01:00
est31
a2e2ec1a18 Add i128 to lib.rs as feature 2017-02-02 21:27:11 +01:00
Jorge Aparicio
b6f059d627 fix the build
the unused macro_use crate lint has tightened; fix the new warnings
2017-01-26 16:17:23 -05:00
James Duley
ee0aacf4be mul.rs: use wrapping_mul not plain
rustc in debug mode with a plain multiplication will call @llvm.umul.with.overflow.* which may call the builtin resulting in infinite recursion.
2017-01-02 22:57:38 +13:00
Jorge Aparicio
53da94d74f more #[no_mangle] 2016-12-31 10:04:40 -05:00
Jorge Aparicio
3992ed1e7a CI: use a recent nightly
- add #[no_mangle] to the panic_fmt lang item to adjust to changes in
the visibility algorithm

- adjust to changes in the layout of Cargo's target directory

- use a newer Xargo to reduce the build time of the sysroot (only core
is compiled as part of the sysroot now)
2016-12-31 10:04:40 -05:00
Vadzim Dambrouski
9897bfb8a9 Fix memset arguments for MSP430 target.
On MSP430 second argument to memset has i16 type instead of i32.
2016-12-19 05:31:20 +03:00
Jorge Aparicio
a1caa7ccac add implementations of memcpy et al
behind the "mem" Cargo feature, which used to be named "weak"

fixes #126
2016-12-17 23:06:37 -05:00
Jorge Aparicio
3484b2b68e by default, mark this crate as the #![compiler_builtins] crate
as this is how most users will want to use this crate
2016-12-11 16:18:43 -05:00
Matt Ickstadt
f68475e080 Use better cfg name for arm-linux tests 2016-11-12 15:52:59 -06:00
Matt Ickstadt
77ca63c511 Use correct lib name in qc test failure 2016-11-12 15:30:57 -06:00
Matt Ickstadt
655f642d3f Add float quickcheck 2016-11-12 14:55:28 -06:00
Christopher Serr
4733417140 Fix a few clippy warnings 2016-10-16 13:53:31 +02:00
Jorge Aparicio
5d164a4eda fix the powerpc64le target
by selecting a CPU that's compatible with the instructions that `rustc`
generates
2016-10-14 09:59:21 -05:00
Jorge Aparicio
a163ca7ac3 fix more warnings 2016-10-10 20:21:11 -05:00
Jorge Aparicio
e05caa1227 fix warnings 2016-10-10 19:45:34 -05:00
Jorge Aparicio
8f0847eb94 rename to compiler_builtins, add rust-lang/rust-ish crate attributes 2016-10-10 19:05:21 -05:00
Jorge Aparicio
24c0247c6a add the compiler_builtins feature to src/lib.rs 2016-10-10 16:45:24 -05:00
Jorge Aparicio
d2a3c45a29 set crate_name and crate_type in src/lib.rs 2016-10-10 16:43:38 -05:00
Jorge Aparicio
96ddd4ed8d use test::black_box instead of ptr::*_volatile
both prevent LLVM from optimizing away the intrinsics but the former
doesn't produce an `intrinsics` binary that segfaults
2016-10-07 18:26:21 -05:00
Jorge Aparicio
c82403551d fix unsafe warnings 2016-10-07 18:19:40 -05:00
Jorge Aparicio
fd69beba29 get profile.dev (-debug-assertions) + LTO working 2016-10-07 18:19:40 -05:00
Jorge Aparicio
a21fb956f9 insert more abort() calls where division by zero may occur 2016-10-07 18:19:40 -05:00
Jorge Aparicio
a2ffc799d0 check that we don't have any call to panic in our implementations 2016-10-07 18:19:40 -05:00
Jorge Aparicio
534d22e287 panic! -> abort
closes #79
2016-10-07 18:19:40 -05:00
Matt Ickstadt
6622c49be6 Implement powi_f2 2016-10-03 11:20:42 -05:00
Matt Ickstadt
02140cddc9 Initial implementation of multitester 2016-10-02 14:38:40 -05:00
Jorge Aparicio
3b8dedd416 Revert "Merge pull request #48 from mattico/add_float_quickcheck"
This reverts commit e34a6058df, reversing
changes made to cab88e6133.
2016-09-30 19:12:17 -05:00
Matt Ickstadt
010d153966 Add Quickcheck types for float tests 2016-09-30 14:29:52 -05:00
Matt Ickstadt
9b1fed8d3f Cleanup add builtin assignments 2016-09-30 14:29:52 -05:00