Commit Graph

69 Commits

Author SHA1 Message Date
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
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
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 4c556dc9e7 fix quickcheck tests
the check! macro syntax has changed
2017-03-06 12:17:41 -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 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
Matt Ickstadt f68475e080 Use better cfg name for arm-linux tests 2016-11-12 15:52:59 -06:00
Matt Ickstadt 655f642d3f Add float quickcheck 2016-11-12 14:55:28 -06:00