2024-02-06 19:32:00 +00:00
|
|
|
//@ 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::*;
|
|
|
|
|
2024-05-11 10:09:21 +00:00
|
|
|
// CHECK-LABEL: @demo(
|
2024-02-06 19:32:00 +00:00
|
|
|
#[no_mangle]
|
|
|
|
#[target_feature(enable = "avx512f")] // Function-level target feature mismatches inhibit inlining
|
|
|
|
pub unsafe fn demo() -> bool {
|
2024-02-18 08:36:36 +00:00
|
|
|
// CHECK: %0 = tail call reassoc double @llvm.vector.reduce.fadd.v8f64(
|
2024-02-06 19:32:00 +00:00
|
|
|
// CHECK: %_0.i = fcmp uno double %0, 0.000000e+00
|
|
|
|
// CHECK: ret i1 %_0.i
|
2024-05-29 04:11:20 +00:00
|
|
|
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)) };
|
2024-02-06 19:32:00 +00:00
|
|
|
res.is_nan()
|
|
|
|
}
|