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 = []
23
23
# musl libc.
24
24
musl-reference-tests = [' rand' ]
25
25
26
+ # Used to prevent using any intrinsics or arch-specific code.
27
+ only-soft-floats = []
28
+
26
29
[workspace ]
27
30
members = [
28
31
" crates/compiler-builtins-smoke-test" ,
Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ bench = false
10
10
[features ]
11
11
unstable = []
12
12
checked = []
13
+ only-soft-floats = []
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ macro_rules! div {
76
76
77
77
macro_rules! llvm_intrinsically_optimized {
78
78
( #[ cfg( $( $clause: tt) * ) ] $e: expr) => {
79
- #[ cfg( all( feature = "unstable" , $( $clause) * ) ) ]
79
+ #[ cfg( all( feature = "unstable" , not ( feature = "only-soft-floats" ) , $( $clause) * ) ) ]
80
80
{
81
81
if true { // thwart the dead code lint
82
82
$e
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ pub fn sqrt(x: f64) -> f64 {
92
92
}
93
93
}
94
94
}
95
- #[ cfg( target_feature = "sse2" ) ]
95
+ #[ cfg( all ( target_feature = "sse2" , not ( feature = "only-soft-floats" ) ) ) ]
96
96
{
97
97
// Note: This path is unlikely since LLVM will usually have already
98
98
// optimized sqrt calls into hardware instructions if sse2 is available,
@@ -107,7 +107,7 @@ pub fn sqrt(x: f64) -> f64 {
107
107
_mm_cvtsd_f64 ( m_sqrt)
108
108
}
109
109
}
110
- #[ cfg( not( target_feature = "sse2" ) ) ]
110
+ #[ cfg( any ( not( target_feature = "sse2" ) , feature = "only-soft-floats ") ) ]
111
111
{
112
112
use core:: num:: Wrapping ;
113
113
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ pub fn sqrtf(x: f32) -> f32 {
27
27
}
28
28
}
29
29
}
30
- #[ cfg( target_feature = "sse" ) ]
30
+ #[ cfg( all ( target_feature = "sse" , not ( feature = "only-soft-floats" ) ) ) ]
31
31
{
32
32
// Note: This path is unlikely since LLVM will usually have already
33
33
// optimized sqrt calls into hardware instructions if sse is available,
@@ -42,7 +42,7 @@ pub fn sqrtf(x: f32) -> f32 {
42
42
_mm_cvtss_f32 ( m_sqrt)
43
43
}
44
44
}
45
- #[ cfg( not( target_feature = "sse" ) ) ]
45
+ #[ cfg( any ( not( target_feature = "sse" ) , feature = "only-soft-floats ") ) ]
46
46
{
47
47
const TINY : f32 = 1.0e-30 ;
48
48
You can’t perform that action at this time.
0 commit comments