This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +9
-5
lines changed
crates/compiler-builtins-smoke-test Expand file tree Collapse file tree 5 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ unstable = []
2323# musl libc.
2424musl-reference-tests = [' rand' ]
2525
26+ # Used to prevent using any intrinsics or arch-specific code.
27+ force-soft-floats = []
28+
2629[workspace ]
2730members = [
2831 " crates/compiler-builtins-smoke-test" ,
Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ bench = false
1010[features ]
1111unstable = []
1212checked = []
13+ force-soft-floats = []
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ macro_rules! div {
7676
7777macro_rules! llvm_intrinsically_optimized {
7878 ( #[ cfg( $( $clause: tt) * ) ] $e: expr) => {
79- #[ cfg( all( feature = "unstable" , $( $clause) * ) ) ]
79+ #[ cfg( all( feature = "unstable" , not ( feature = "force-soft-floats" ) , $( $clause) * ) ) ]
8080 {
8181 if true { // thwart the dead code lint
8282 $e
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ pub fn sqrt(x: f64) -> f64 {
9292 }
9393 }
9494 }
95- #[ cfg( target_feature = "sse2" ) ]
95+ #[ cfg( all ( target_feature = "sse2" , not ( feature = "force-soft-floats" ) ) ) ]
9696 {
9797 // Note: This path is unlikely since LLVM will usually have already
9898 // optimized sqrt calls into hardware instructions if sse2 is available,
@@ -107,7 +107,7 @@ pub fn sqrt(x: f64) -> f64 {
107107 _mm_cvtsd_f64 ( m_sqrt)
108108 }
109109 }
110- #[ cfg( not( target_feature = "sse2" ) ) ]
110+ #[ cfg( any ( not( target_feature = "sse2" ) , feature = "force-soft-floats ") ) ]
111111 {
112112 use core:: num:: Wrapping ;
113113
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ pub fn sqrtf(x: f32) -> f32 {
2727 }
2828 }
2929 }
30- #[ cfg( target_feature = "sse" ) ]
30+ #[ cfg( all ( target_feature = "sse" , not ( feature = "force-soft-floats" ) ) ) ]
3131 {
3232 // Note: This path is unlikely since LLVM will usually have already
3333 // optimized sqrt calls into hardware instructions if sse is available,
@@ -42,7 +42,7 @@ pub fn sqrtf(x: f32) -> f32 {
4242 _mm_cvtss_f32 ( m_sqrt)
4343 }
4444 }
45- #[ cfg( not( target_feature = "sse" ) ) ]
45+ #[ cfg( any ( not( target_feature = "sse" ) , feature = "force-soft-floats ") ) ]
4646 {
4747 const TINY : f32 = 1.0e-30 ;
4848
You can’t perform that action at this time.
0 commit comments