diff options
| author | Ben Kimock <kimockb@gmail.com> | 2024-02-06 14:32:00 -0500 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2024-02-20 12:39:03 -0500 |
| commit | cc73b71e8e568c6421a23fc2954a86e1947aac66 (patch) | |
| tree | e6117f8e8a9b2f90ef4090177eaf8df615aecee5 /tests/codegen/simd | |
| parent | c9a7db6e20c8892f770b94dd6d5a16a03721b658 (diff) | |
| download | rust-cc73b71e8e568c6421a23fc2954a86e1947aac66.tar.gz rust-cc73b71e8e568c6421a23fc2954a86e1947aac66.zip | |
Add "algebraic" versions of the fast-math intrinsics
Diffstat (limited to 'tests/codegen/simd')
| -rw-r--r-- | tests/codegen/simd/issue-120720-reduce-nan.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/codegen/simd/issue-120720-reduce-nan.rs b/tests/codegen/simd/issue-120720-reduce-nan.rs new file mode 100644 index 00000000000..233131aa01c --- /dev/null +++ b/tests/codegen/simd/issue-120720-reduce-nan.rs @@ -0,0 +1,22 @@ +// compile-flags: -C opt-level=3 -C target-cpu=cannonlake +// only-x86_64 + +// In a previous implementation, _mm512_reduce_add_pd did the reduction with all fast-math flags +// enabled, making it UB to reduce a vector containing a NaN. + +#![crate_type = "lib"] +#![feature(stdarch_x86_avx512, avx512_target_feature)] +use std::arch::x86_64::*; + +// CHECK-label: @demo( +#[no_mangle] +#[target_feature(enable = "avx512f")] // Function-level target feature mismatches inhibit inlining +pub unsafe fn demo() -> bool { + // CHECK: %0 = tail call reassoc nsz arcp contract double @llvm.vector.reduce.fadd.v8f64( + // CHECK: %_0.i = fcmp uno double %0, 0.000000e+00 + // CHECK: ret i1 %_0.i + let res = unsafe { + _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)) + }; + res.is_nan() +} |
