Miscompilation in _mm512_reduce_add_pd, assumes values not NaN · Issue #120720 · rust-lang/rust (original) (raw)
The following example should obviously compile to a panic, as the documentation of _mm512_reduce_add_pd
mentions nothing about NaNs not being respected:
#![feature(stdsimd)] use core::arch::x86_64::*;
#[no_mangle] unsafe fn test() -> f64 { let ret = _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)); if ret.is_nan() { panic!("hi") } ret }
However, when compiled with -C opt-level=3 -C target-cpu=cannonlake
on the latest nightly there is no panic generated, despite the output being NaN regardless:
.LCPI0_0: .quad 0x7ff8000000000000 test: vmovsd xmm0, qword ptr [rip + .LCPI0_0] ret