]> git.lizzy.rs Git - rust.git/blob - src/test/ui/simd/libm_no_std_cant_float.rs
Rollup merge of #102685 - nbdd0121:unwind, r=m-ou-se
[rust.git] / src / test / ui / simd / libm_no_std_cant_float.rs
1 #![crate_type = "rlib"]
2 #![no_std]
3 #![feature(portable_simd)]
4 use core::simd::f32x4;
5 use core::simd::SimdFloat;
6
7 // For SIMD float ops, the LLIR version which is used to implement the portable
8 // forms of them may become calls to math.h AKA libm. So, we can't guarantee
9 // we can compile them for #![no_std] crates.
10 // Someday we may solve this.
11 // Until then, this test at least guarantees these functions require std.
12 fn guarantee_no_std_nolibm_calls() -> f32x4 {
13     let x = f32x4::from_array([0.1, 0.5, 0.6, -1.5]);
14     let x2 = x + x;
15     let _xc = x.ceil(); //~ ERROR E0599
16     let _xf = x.floor(); //~ ERROR E0599
17     let _xr = x.round(); //~ ERROR E0599
18     let _xt = x.trunc(); //~ ERROR E0599
19     let _xfma = x.mul_add(x, x); //~ ERROR E0599
20     let _xsqrt = x.sqrt(); //~ ERROR E0599
21     x2.abs() * x2
22 }