https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95060
Bug ID: 95060
Summary: vfnmsub132ps is not generated with -ffast-math
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
Following testcase:
--cut here--
float r[8], a[8], b[8], c[8];
void
test_fnms (void)
{
for (int i = 0; i < 8; i++)
r[i] = -(a[i] * b[i]) - c[i];
}
--cut here--
compiles on x86_64 with "-O3 -mfma" to
vmovaps b(%rip), %ymm0
vmovaps c(%rip), %ymm1
vfnmsub132ps a(%rip), %ymm1, %ymm0
vmovaps %ymm0, r(%rip)
vzeroupper
ret
However, when -ffast-math is added, negation gets moved out of the insn:
vmovaps b(%rip), %ymm0
vmovaps c(%rip), %ymm1
vfmadd132ps a(%rip), %ymm1, %ymm0
-> vxorps .LC0(%rip), %ymm0, %ymm0
vmovaps %ymm0, r(%rip)
vzeroupper
ret