Commit Graph

51 Commits (0cd476220bafefc2e23e5c1cf37b6fb151d55f42)

Author SHA1 Message Date
est31 0cd476220b Remove duplication by adding a macro 2017-09-14 17:39:25 +02:00
est31 3efae7f7d9 Convert add! to a function 2017-09-14 17:33:44 +02:00
est31 482d98318f Convert int_to_float! to a function 2017-09-14 16:32:50 +02:00
est31 ff63f7b80f Convert float_to_int! into a function 2017-09-14 14:59:32 +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
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
Alex Crichton 2147753559 Remove usage of unwrap_or_else 2017-06-23 21:31:54 -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 a16ebb0dcb Use `nm` to weed out panics 2017-06-23 11:52:22 -07:00
Alex Crichton 83d63eaa9b Convert float intrinsics to the `intrinsics!` macro 2017-06-23 11:05:25 -07:00
Alex Crichton 47ff81325c Use more intrinsics on msvc 2017-06-23 07:53:34 -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
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
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 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 c6e06f4157 refactor 'impl Int' 2017-03-06 12:17:10 -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 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 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
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
Christopher Serr 4733417140 Fix a few clippy warnings 2016-10-16 13:53:31 +02: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 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 534d22e287 panic! -> abort
closes #79
2016-10-07 18:19:40 -05:00
Jorge Aparicio f77ca915c4 add an opt-in cargo feature to build intrinsics from compiler-rt source
closes #63
cc #66
2016-09-29 16:06:24 -05:00
Alex Crichton 8e161a791a Expand and refactor teting infrastructure
This commit moves over most of the testing infrastructure to in-tree docker
images that are all dispatched to from Travis (no other test configuration).
This allows versioning modifications to the test infrastructure as well as the
code itself. Additionally separate docker images allows for easy modification of
one without worrying about tampering of others as well as easy addition of new
targets by simply adding a new `Dockerfile`.

Additionally this commit bundles the master version of the `compiler-rt` source
repository from `llvm-mirror/compiler-rt` to test against. The compiler-rt
library itself is compiled as a `cdylib` which is then dynamically located at
runtime and we look for symbols in. There's a few hoops here, but they currently
get the job done.

All tests now execute against both gcc_s and compiler-rt, and this
testing strategy is now all hidden behind a macro as well (refactoring
all existing tests along the way).
2016-09-28 22:09:55 -07:00
Jorge Aparicio 384c48ce9b don't test always against gcc_s
instead test half of the time against gcc_s and the other half test
against the native operation (\*).

(\*) Not all the targets have available a native version of the
intrinsics under test. On those targets we'll end up testing our
implementation against itself half of the time. This is not much of a
problem because we do several quickcheck runs per intrinsic.
2016-09-21 21:38:06 -05:00
Jorge Aparicio 9493c37455 test our implementations against gcc_s
if it exposes the same intrinsics that we implement -- gcc_s doesn't
implement all the intrinsics for all the architectures.

closes #65
2016-09-16 15:53:14 -05:00