Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 10abed4

Browse files
committed
Properly gate wasm32 intrinsics
1 parent f17db10 commit 10abed4

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

src/math/ceil.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn ceil(x: f64) -> f64 {
1212
// `f64.ceil` native instruction, so we can leverage this for both code size
1313
// and speed.
1414
llvm_intrinsically_optimized! {
15-
#[cfg(target_arch = "wasm32")] {
15+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1616
return unsafe { ::core::intrinsics::ceilf64(x) }
1717
}
1818
}

src/math/ceilf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn ceilf(x: f32) -> f32 {
1010
// `f32.ceil` native instruction, so we can leverage this for both code size
1111
// and speed.
1212
llvm_intrinsically_optimized! {
13-
#[cfg(target_arch = "wasm32")] {
13+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1414
return unsafe { ::core::intrinsics::ceilf32(x) }
1515
}
1616
}

src/math/fabs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn fabs(x: f64) -> f64 {
1010
// `f64.abs` native instruction, so we can leverage this for both code size
1111
// and speed.
1212
llvm_intrinsically_optimized! {
13-
#[cfg(target_arch = "wasm32")] {
13+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1414
return unsafe { ::core::intrinsics::fabsf64(x) }
1515
}
1616
}

src/math/fabsf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn fabsf(x: f32) -> f32 {
88
// `f32.abs` native instruction, so we can leverage this for both code size
99
// and speed.
1010
llvm_intrinsically_optimized! {
11-
#[cfg(target_arch = "wasm32")] {
11+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1212
return unsafe { ::core::intrinsics::fabsf32(x) }
1313
}
1414
}

src/math/floor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn floor(x: f64) -> f64 {
1212
// `f64.floor` native instruction, so we can leverage this for both code size
1313
// and speed.
1414
llvm_intrinsically_optimized! {
15-
#[cfg(target_arch = "wasm32")] {
15+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1616
return unsafe { ::core::intrinsics::floorf64(x) }
1717
}
1818
}

src/math/floorf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn floorf(x: f32) -> f32 {
1010
// `f32.floor` native instruction, so we can leverage this for both code size
1111
// and speed.
1212
llvm_intrinsically_optimized! {
13-
#[cfg(target_arch = "wasm32")] {
13+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1414
return unsafe { ::core::intrinsics::floorf32(x) }
1515
}
1616
}

src/math/sqrt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn sqrt(x: f64) -> f64 {
8888
// `f64.sqrt` native instruction, so we can leverage this for both code size
8989
// and speed.
9090
llvm_intrinsically_optimized! {
91-
#[cfg(target_arch = "wasm32")] {
91+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
9292
return if x < 0.0 {
9393
f64::NAN
9494
} else {

src/math/sqrtf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn sqrtf(x: f32) -> f32 {
2222
// `f32.sqrt` native instruction, so we can leverage this for both code size
2323
// and speed.
2424
llvm_intrinsically_optimized! {
25-
#[cfg(target_arch = "wasm32")] {
25+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
2626
return if x < 0.0 {
2727
::core::f32::NAN
2828
} else {

src/math/trunc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn trunc(x: f64) -> f64 {
77
// `f64.trunc` native instruction, so we can leverage this for both code size
88
// and speed.
99
llvm_intrinsically_optimized! {
10-
#[cfg(target_arch = "wasm32")] {
10+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1111
return unsafe { ::core::intrinsics::truncf64(x) }
1212
}
1313
}

src/math/truncf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn truncf(x: f32) -> f32 {
77
// `f32.trunc` native instruction, so we can leverage this for both code size
88
// and speed.
99
llvm_intrinsically_optimized! {
10-
#[cfg(target_arch = "wasm32")] {
10+
#[cfg(all(target_arch = "wasm32", not(feature = "stable")))] {
1111
return unsafe { ::core::intrinsics::truncf32(x) }
1212
}
1313
}

0 commit comments

Comments
 (0)