https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119875
Bug ID: 119875
Summary: loop with floating point conditional move not
vectorized without -ffast-math
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
Target Milestone: ---
double a[1000];
double b[1000];
double c[1000];
double d[1000];
void test()
{
for (int i = 0; i < 1000; i++)
a[i] = b[i] > 0 ? c[i] + 1 : c[i] + 2;
}
is vectorized only with -ffast-math, while clang does it w/o:
.LBB0_1: # =>This Inner Loop Header: Depth=1
xorpd %xmm2, %xmm2
cmpltpd -16(%rcx,%rax,8), %xmm2
xorpd %xmm3, %xmm3
cmpltpd (%rcx,%rax,8), %xmm3
movapd %xmm1, %xmm4
andpd %xmm2, %xmm4
andnpd %xmm0, %xmm2
orpd %xmm4, %xmm2
movapd %xmm1, %xmm4
andpd %xmm3, %xmm4
andnpd %xmm0, %xmm3
orpd %xmm4, %xmm3
addpd -16(%rdx,%rax,8), %xmm2
addpd (%rdx,%rax,8), %xmm3
movapd %xmm2, -16(%rsi,%rax,8)
movapd %xmm3, (%rsi,%rax,8)
addq $4, %rax