Commit Graph

82 Commits

Author SHA1 Message Date
Tomasz Miąsko d0ea0765aa
Use crate visibility for traits (#358)
Co-authored-by: Tomasz Miąsko <tomasz.miasko@gmail.com>
2020-05-26 15:12:10 -05:00
Alex Crichton cf98161da7 Remove the need for #[cfg] in #[use_c_shim_if]
This commit tweaks the implementation of the synthetic
`#[use_c_shim_if]` attribute, renaming it to
`#[maybe_use_optimized_c_shim]` in the process. This no longer requires
specifying a `#[cfg]` clause indicating when the optimized intrinsic
should be used, but rather this is inferred and printed from the build
script.

The build script will now print out appropriate `#[cfg]` directives for
rustc to indicate what intrinsics it's compiling. This should remove the
need for us to keep the build script and the source in sync, but rather
the build script can simply take care of everything.
2019-05-15 12:59:31 -07:00
Alex Crichton c88c9502b7 Run rustfmt over everything 2019-05-14 14:40:38 -07:00
Alex Crichton 80a998df92 Fix duplicate floatdisf symbol on Windows MSVC 2019-05-02 14:22:19 -07:00
Alex Crichton 939cbca6e9 Revert "Conversion from a wider to a narrower IEEE-754 floating-point type"
This reverts commit baab4fd89c.
2018-10-30 10:51:11 -07:00
Paolo Teti baab4fd89c Conversion from a wider to a narrower IEEE-754 floating-point type
Adds generic conversion from a wider to a narrower IEEE-754
floating-point type.

Implement `__truncdfsf2` and `__truncdfsf2vfp` and associated test-cases.
2018-09-17 19:53:04 +02:00
Alex Crichton 0703bfa725 Fix some `use_c_shim_if` directives
This was an accidental regression introduced in #252 by removing compilation of
C files without adjusting the `#[use_c_shim_if]` directives. This restores the
compilation of the assembly files and updates the `#[use_c_shim_if]` directives.
2018-09-04 10:21:06 -07:00
Alex Crichton cb04a0718b
Merge pull request #234 from ketsuban/master
Add __floatdisf and __floatundisf intrinsics
2018-04-05 10:06:16 -05:00
Thomas Winwood 92b259c3ad Add __floatdisf and __floatundisf intrinsics 2018-03-14 14:56:01 +00:00
Paolo Teti 28c57e7212 Add __ledf2vfp and __lesf2vfp
Now that `73884ae` is in some nightly release We can add ledf2vfp/leds2vfp
and so these two functions be aliased to aeabi_fcmple/aeabi_dcmple on soft-float targets.
2018-02-25 17:50:56 +01:00
Paolo Teti e7bf03019c Collection of VFP intrinsics
Nothing really exciting here. LLVM on hard-float target use native instructions
for all listed VFP intrinsics and so resulting implementation is really trivial.

Implemented intrinsics:

 __gesf2vfp
 __gedf2vfp
 __gtsf2vfp
 __gtdf2vfp
 __ltsf2vfp
 __ltdf2vfp
 __nesf2vfp
 __nedf2vfp
 __eqsf2vfp
 __eqdf2vfp
 __extendsfdf2vfp
2018-02-11 23:46:56 +01:00
Paolo Teti 2cb290afa3 Fix __subsf3 and __subdf3 on x86
Be sure to do not mix hard-float and soft-float calls.
Disassembled code show exactly this.
So replace add with an explicit call to __addsf3/__adddf3

This seems the root cause of some sporadic failures.
2018-02-09 20:35:55 +01:00
Paolo Teti 306764b091 Fix issue extending f32::MIN/MAX to f64 and improve testcrate.
I was able to trigger an issue extending f32::MAX or f32::MIN to a f64.
Issue was not triggered by `testcrate` mainly because f32::MAX/MIN are
not in the list of special values to generate.

This PR fix the issue and improve `testcrate` adding MAX/MIN/MIN_POSITIVE
in the list of special values.
2018-02-09 17:23:16 +01:00
Paolo Teti 45f924ece5 Add generic conversion from a narrower to a wider FP type
Add `extend` module to implement conversion from a narrower to a wider
floating-point type.

This implementation is only intended to support *widening* operations.
Module to convert a *narrower* floating-point will be added in the future.
2018-02-08 18:20:45 +01:00
Paolo Teti 13db8bf436 Add support for sub*f3vfp and add*f3vfp
As done before for mul and div let's use extern "C" to generate `"aapcs"`
or `"aapcs-vfp"` depending on target configuration.
2018-02-04 18:34:31 +01:00
Paolo Teti 73884ae671 Fix __aeabi_fcmple and add test cases
`le` in __aeabi_fcmple means `less or equal`
2018-02-04 10:56:02 +01:00
Paolo Teti f42b9e0bad __[mul/div]sf3vfp and __[mul/div]df3vfp only on ARM 2018-01-30 18:48:20 +01:00
Paolo Teti 8f018562ca Add support for mul[s/d]f3vfp and div[s/d]f3vfp
Here using `"C"` the compiler will use `"aapcs"` or `"aapcs-vfp"`
depending on target configuration.

Of course this translates in a call to `__aeabi_fdiv` / `__aeabi_fmul`
on non-HF targets.

On `eabi` targets with +vfpv2/vfpv3 LLVM generate:

   vmov	s0, r1
   vmov	s2, r0
   vdiv.f32	s0, s2, s0
   vmov	r0, s0
   bx	lr

On `eabihf` targets with +vfpv3-d16/d32/f32 +fp-only-sp LLVM generate:

  vdiv.f32	s0, s0, s1
  bx	lr

That's exactly what We need for [div/mul][s/d]f3vfp.S
2018-01-29 20:49:55 +01:00
Alex Crichton 7d5fb94560 Fix some typos/bugs with float comparison intrinsics
* I believe `__gtdf2` erroneously used `f32` instead of `f64`
* Most of these needed `#[arm_aeabi_alias]` to ensure they're correctly called
  through the alias
* Some existing aliases were corrected with the right names
2018-01-24 17:01:04 -08:00
whitequark 07b446a9ab comparesf2/comparedf2: fix a signedness bug and add tests. 2017-12-29 07:58:34 +00:00
whitequark 6adcc9e9cb comparesf2/comparedf2: use i32 instead of bool for return type.
Note that this changes semantics:
    pub extern "C" fn __eqsf2(a: f32, b: f32) -> bool {
        cmp(a, b).to_le_abi() != 0
    }

is not the same as

    pub extern "C" fn __eqsf2(a: f32, b: f32) -> i32 {
        cmp(a, b).to_le_abi()
    }

However, compiler-rt does the latter, so this is actually
an improvement.
2017-12-29 06:14:51 +00:00
whitequark f5d86476a8 Implement comparesf2/comparedf2 intrinsics. 2017-12-28 03:45:32 +00:00
Oliver Geller 8bb30026c7 Implement divsf3 and divdf3 2017-11-13 20:22:27 -05:00
Oliver Geller 897048543f Implement mulsf3 and muldf3 2017-11-08 17:36:34 -05:00
est31 c781759498 Partially revert a272d753f5
This partially reverts commit "Convert float_to_int! into a function"
2017-09-29 02:20:27 +02:00
est31 a20840262e Partially revert 482d98318f
This partially reverts "Convert int_to_float! to a function".
2017-09-29 02:19:40 +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 a272d753f5 Don't use the Wrapping wrapper in float addition
Inspired by a patch by mattico.
2017-09-14 02:08:28 +02:00
est31 72ed4c8bce Don't use a macro for pow calculation 2017-09-14 01:59:02 +02:00
est31 8313cec597 Extend the Float trait by some constants and supertraits 2017-09-14 01:57:52 +02:00
est31 2c1d7dccc1 Use the newly added ONE constant in float addition 2017-09-14 00:10:16 +02:00
est31 46cfa05650 Introduce a float_impl! macro to avoid duplication 2017-09-13 22:44:56 +02:00
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
Alex Crichton 91eaa85902 Don't mangle probes all the time 2017-07-07 20:35:14 -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 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 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
Jorge Aparicio b2f72e1eb1 remove unused macros
to fix warnings
2017-06-01 07:40:50 -05: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