summaryrefslogtreecommitdiffstats
path: root/tests/ui/simd/libm_no_std_cant_float.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/simd/libm_no_std_cant_float.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/simd/libm_no_std_cant_float.rs')
-rw-r--r--tests/ui/simd/libm_no_std_cant_float.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/simd/libm_no_std_cant_float.rs b/tests/ui/simd/libm_no_std_cant_float.rs
new file mode 100644
index 000000000..50ac8e208
--- /dev/null
+++ b/tests/ui/simd/libm_no_std_cant_float.rs
@@ -0,0 +1,22 @@
+#![crate_type = "rlib"]
+#![no_std]
+#![feature(portable_simd)]
+use core::simd::f32x4;
+use core::simd::SimdFloat;
+
+// For SIMD float ops, the LLIR version which is used to implement the portable
+// forms of them may become calls to math.h AKA libm. So, we can't guarantee
+// we can compile them for #![no_std] crates.
+// Someday we may solve this.
+// Until then, this test at least guarantees these functions require std.
+fn guarantee_no_std_nolibm_calls() -> f32x4 {
+ let x = f32x4::from_array([0.1, 0.5, 0.6, -1.5]);
+ let x2 = x + x;
+ let _xc = x.ceil(); //~ ERROR E0599
+ let _xf = x.floor(); //~ ERROR E0599
+ let _xr = x.round(); //~ ERROR E0599
+ let _xt = x.trunc(); //~ ERROR E0599
+ let _xfma = x.mul_add(x, x); //~ ERROR E0599
+ let _xsqrt = x.sqrt(); //~ ERROR E0599
+ x2.abs() * x2
+}