Skip to content

Commit

Permalink
Add an implementation for f128 multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed May 11, 2024
1 parent 34db533 commit 7871c81
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ These builtins are needed to support `f16` and `f128`, which are in the process
- [ ] floatsitf.c
- [ ] floatunditf.c
- [ ] floatunsitf.c
- [ ] multf3.c
- [x] multf3.c
- [ ] powitf2.c
- [ ] ppc/fixtfdi.c
- [ ] ppc/fixunstfdi.c
Expand Down
3 changes: 0 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ mod c {
("__floatsitf", "floatsitf.c"),
("__floatunditf", "floatunditf.c"),
("__floatunsitf", "floatunsitf.c"),
("__multf3", "multf3.c"),
("__divtf3", "divtf3.c"),
("__powitf2", "powitf2.c"),
("__fe_getround", "fp_mode.c"),
Expand All @@ -504,7 +503,6 @@ mod c {
("__fixunstfsi", "fixunstfsi.c"),
("__floatunsitf", "floatunsitf.c"),
("__fe_getround", "fp_mode.c"),
("__divtf3", "divtf3.c"),
]);
}

Expand All @@ -517,7 +515,6 @@ mod c {
("__fixunstfsi", "fixunstfsi.c"),
("__floatunsitf", "floatunsitf.c"),
("__fe_getround", "fp_mode.c"),
("__divtf3", "divtf3.c"),
]);
}

Expand Down
5 changes: 5 additions & 0 deletions src/float/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ intrinsics! {
mul(a, b)
}

#[cfg(not(feature = "no-f16-f128"))]
pub extern "C" fn __multf3(a: f128, b: f128) -> f128 {
mul(a, b)
}

#[cfg(target_arch = "arm")]
pub extern "C" fn __mulsf3vfp(a: f32, b: f32) -> f32 {
a * b
Expand Down
14 changes: 14 additions & 0 deletions testcrate/tests/mul.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![allow(unused_macros)]
#![feature(f128)]
#![feature(f16)]

use core::ops::Mul;
use testcrate::*;
Expand Down Expand Up @@ -114,6 +116,18 @@ fn float_mul() {
f32, __mulsf3, Single, all();
f64, __muldf3, Double, all();
);

#[cfg(not(feature = "no-f16-f128"))]
{
use compiler_builtins::float::mul::__multf3;

float_mul!(
f128, __multf3, Quad,
// FIXME(llvm): there is a bug in LLVM rt.
// See <https://github.com/llvm/llvm-project/issues/91840>.
not(any(feature = "no-sys-f128", all(target_arch = "aarch64", target_os = "linux")));
);
}
}

#[cfg(target_arch = "arm")]
Expand Down

0 comments on commit 7871c81

Please sign in to comment.