[X86] Possible wrong compilation of scalar comparison into cmpnltpd #63561
Labels
backend:X86
question
A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Hello,
I experienced a bug in code generation for the x86-64 target. For the minimal test case
test.txt
compiled on
with
I get the assembly code
see also https://godbolt.org/z/s3v3rdfsd
Prior content in the register
xmm2
from before entering this function in the upper lane can trigger a floating point exception in the second to last line forcmpnltpd xmm3, xmm2
. Specifically, I seeshowing that the upper lane contains an invalid entry. The generated code does not give the FPE with clang-15, nor does it with the optimization level
-O0
. Using-O2
,-O3
also leads to the invalid code according to godbolt both for clang-15 and clang-16.Please let me know if I should provide a main function to invoke this. All one needs to do is to set
xmm2
to_mm_set1_pd(std::numeric_limits<float>::signaling_NaN());
and callfeenableexcept(FE_DIVBYZERO | FE_INVALID);
before callingf(0.2, 0.2, 2, false);
. I could be wrong and something might be disallowed by my code, but I believe this is valid code and wrong within LLVM.Note that the code is extracted from a big project, dealii/dealii#15496 (comment)
The text was updated successfully, but these errors were encountered: