[Bug target/81647] New: inconsistent LTGT behavior at different optimization levels on AArch64.
amker at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 1 13:43:00 GMT 2017
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.
More information about the Gcc-bugs
mailing list