https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109052
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
The original testcase is:
double foo (double a, double b)
{
double z = __builtin_fmod (a, 3.14);
return z * b;
}
-O2 -fno-math-errno:
foo:
fldl .LC0(%rip)
movsd %xmm0, -8(%rsp)
fldl -8(%rsp)
.L2:
fprem
fnstsw %ax
testb $4, %ah
jne .L2
fstp %st(1)
fstpl -8(%rsp)
--> movsd -8(%rsp), %xmm0
mulsd %xmm1, %xmm0
ret
and with -mavx:
foo:
fldl .LC0(%rip)
vmovsd %xmm0, -8(%rsp)
fldl -8(%rsp)
.L2:
fprem
fnstsw %ax
testb $4, %ah
jne .L2
fstp %st(1)
fstpl -8(%rsp)
--> vmovsd -8(%rsp), %xmm0
vmulsd %xmm1, %xmm0, %xmm0
ret