]> git.lizzy.rs Git - rust.git/blob - src/test/ui/simd/libm_std_can_float.rs
Auto merge of #96869 - sunfishcode:main, r=joshtriplett
[rust.git] / src / test / ui / simd / libm_std_can_float.rs
1 // run-pass
2
3 // This is the converse of the other libm test.
4 #![feature(portable_simd)]
5 use std::simd::f32x4;
6 use std::simd::{SimdFloat, StdFloat};
7
8 // For SIMD float ops, the LLIR version which is used to implement the portable
9 // forms of them may become calls to math.h AKA libm. So, we can't guarantee
10 // we can compile them for #![no_std] crates.
11 //
12 // However, we can expose some of these ops via an extension trait.
13 fn main() {
14     let x = f32x4::from_array([0.1, 0.5, 0.6, -1.5]);
15     let x2 = x + x;
16     let _xc = x.ceil();
17     let _xf = x.floor();
18     let _xr = x.round();
19     let _xt = x.trunc();
20     let _xfma = x.mul_add(x, x);
21     let _xsqrt = x.sqrt();
22     let _ = x2.abs() * x2;
23 }