Manuel López-Ibáñez <[email protected]> wrote:
> FWIW: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24021
Thanks.
So this bug may soon have a driver's license in some countries...
One more for the road:
$ cat wtf.c
double wtf(double x) {
return sqrt(x * x); // can the square ever be negative?
}
$ gcc -m64 -o- -O3 -S
...
mulsd %xmm0, %xmm0
pxor %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja .L10
sqrtsd %xmm0, %xmm0
ret
.L10:
jmp sqrt
...
Is the special case 0.0 worth the almost always taken, thus wrong
predicted branch?
JFTR: the PXOR incurs two cycles penalty on many Intel processors!
Better use XORPD there.
Stefan