https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81647
Bug ID: 81647 Summary: inconsistent LTGT behavior at different optimization levels on AArch64. Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: amker at gcc dot gnu.org Target Milestone: --- Given below test from Richard S, #include <fenv.h> double x[16], y[16]; int res[16]; int main (void) { for (int i = 0; i < 16; ++i) { x[i] = __builtin_nan (""); y[i] = i; } asm volatile ("" ::: "memory"); feclearexcept (FE_ALL_EXCEPT); for (int i = 0; i < 16; ++i) res[i] = __builtin_islessgreater (x[i], y[i]); asm volatile ("" ::: "memory"); return fetestexcept (FE_ALL_EXCEPT) != 0; } If we compile and run it with: $ ./g++ -O3 test.cc -o test.O3.exe $ ./test.O3.exe $ echo $? 1 If we compile and run it with: $ ./g++ -O2 test.cc -o test.O2.exe $ ./test.O2.exe $ echo $? 0 It is because of different implementation of LTGT w/o vectorization.