From 8f018562ca05dfbc8f392c5431a419c5128fe0cd Mon Sep 17 00:00:00 2001 From: Paolo Teti Date: Mon, 29 Jan 2018 19:52:55 +0100 Subject: [PATCH] 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 --- README.md | 8 ++++---- build.rs | 4 ---- src/float/div.rs | 7 +++++++ src/float/mul.rs | 8 ++++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a7dabe7..cc4852a 100644 --- a/README.md +++ b/README.md @@ -96,9 +96,9 @@ features = ["c"] - [x] arm/aeabi_memset.S - [x] arm/aeabi_uidivmod.S - [x] arm/aeabi_uldivmod.S -- [ ] arm/divdf3vfp.S +- [x] arm/divdf3vfp.S - [ ] arm/divmodsi4.S (generic version is done) -- [ ] arm/divsf3vfp.S +- [x] arm/divsf3vfp.S - [ ] arm/divsi3.S (generic version is done) - [ ] arm/eqdf2vfp.S - [ ] arm/eqsf2vfp.S @@ -120,8 +120,8 @@ features = ["c"] - [ ] arm/ltdf2vfp.S - [ ] arm/ltsf2vfp.S - [ ] arm/modsi3.S (generic version is done) -- [ ] arm/muldf3vfp.S -- [ ] arm/mulsf3vfp.S +- [x] arm/muldf3vfp.S +- [x] arm/mulsf3vfp.S - [ ] arm/nedf2vfp.S - [ ] arm/negdf2vfp.S - [ ] arm/negsf2vfp.S diff --git a/build.rs b/build.rs index a7351cc..1bb2b0f 100644 --- a/build.rs +++ b/build.rs @@ -5511,8 +5511,6 @@ mod c { &[ "arm/adddf3vfp.S", "arm/addsf3vfp.S", - "arm/divdf3vfp.S", - "arm/divsf3vfp.S", "arm/eqdf2vfp.S", "arm/eqsf2vfp.S", "arm/extendsfdf2vfp.S", @@ -5532,8 +5530,6 @@ mod c { "arm/lesf2vfp.S", "arm/ltdf2vfp.S", "arm/ltsf2vfp.S", - "arm/muldf3vfp.S", - "arm/mulsf3vfp.S", "arm/nedf2vfp.S", "arm/nesf2vfp.S", "arm/restore_vfp_d8_d15_regs.S", diff --git a/src/float/div.rs b/src/float/div.rs index e0e287a..94be4f2 100644 --- a/src/float/div.rs +++ b/src/float/div.rs @@ -454,4 +454,11 @@ intrinsics! { div64(a, b) } + pub extern "C" fn __divsf3vfp(a: f32, b: f32) -> f32 { + a / b + } + + pub extern "C" fn __divdf3vfp(a: f64, b: f64) -> f64 { + a / b + } } diff --git a/src/float/mul.rs b/src/float/mul.rs index 696adea..c5c5403 100644 --- a/src/float/mul.rs +++ b/src/float/mul.rs @@ -188,4 +188,12 @@ intrinsics! { pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 { mul(a, b) } + + pub extern "C" fn __mulsf3vfp(a: f32, b: f32) -> f32 { + a * b + } + + pub extern "C" fn __muldf3vfp(a: f64, b: f64) -> f64 { + a * b + } }