Skip to content

Commit f654edb

Browse files
committed
Remove truncdfsf2.c from sources in build.rs and add test for __truncdfsf2vfp
Also fixed the calling convention for truncdfsf2 on ARM
1 parent 13051ed commit f654edb

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ features = ["c"]
126126
- [x] arm/softfloat-alias.list
127127
- [x] arm/subdf3vfp.S
128128
- [x] arm/subsf3vfp.S
129-
- [ ] arm/truncdfsf2vfp.S
129+
- [x] arm/truncdfsf2vfp.S
130130
- [ ] arm/udivmodsi4.S (generic version is done)
131131
- [ ] arm/udivsi3.S (generic version is done)
132132
- [ ] arm/umodsi3.S (generic version is done)

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ mod c {
227227
("__negsf2", "negsf2.c"),
228228
("__powixf2", "powixf2.c"),
229229
("__truncdfhf2", "truncdfhf2.c"),
230-
("__truncdfsf2", "truncdfsf2.c"),
231230
("__truncsfhf2", "truncsfhf2.c"),
232231
]);
233232
}

examples/intrinsics.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,9 @@ extern "C" {}
2424
// have an additional comment: the function name is the ARM name for the intrinsic and the comment
2525
// in the non-ARM name for the intrinsic.
2626
mod intrinsics {
27-
// trunccdfsf2
27+
// truncdfsf2
2828
pub fn aeabi_d2f(x: f64) -> f32 {
29-
// This is only implemented in C currently, so only test it there.
30-
#[cfg(feature = "c")]
31-
return x as f32;
32-
#[cfg(not(feature = "c"))]
33-
{
34-
drop(x);
35-
0.0
36-
}
29+
x as f32
3730
}
3831

3932
// fixdfsi

src/float/trunc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ where
112112
}
113113

114114
intrinsics! {
115+
#[aapcs_on_arm]
115116
#[arm_aeabi_alias = __aeabi_d2f]
116117
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {
117118
trunc(a)

testcrate/tests/misc.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,11 @@ fn float_trunc() {
204204

205205
trunc!(f64, f32, __truncdfsf2);
206206
}
207+
208+
#[cfg(target_arch = "arm")]
209+
#[test]
210+
fn float_trunc_arm() {
211+
use compiler_builtins::float::trunc::__truncdfsf2vfp;
212+
213+
trunc!(f64, f32, __truncdfsf2vfp);
214+
}

0 commit comments

Comments
 (0)