Why __builtin_sqrt do not totally replace sqrt in asm

BELBACHIR Selim selim.belbachir@fr.thalesgroup.com
Fri Jan 3 09:54:00 GMT 2014


Hi,

When the standard pattern 'sqrtm2' is defined I don't understand why calls to sqrt or __builtin_sqrt is always followed by a comparison of the result with itself (checking the NaN ?) and a conditional branch to sqrt symbol (so linking with libm is always mandatory).

-------------------------
mov $FP0,$FP1            
fsqrt $FP0, $FP0            << the builtin_sqrt
fcompare $FP0,$FP0     << strange compare of the result of builtin_sqrt
jmp.ifEQUAL .L2
mov $FP1,$FP0
branch sqrt                    << branch to sqrt symbol if $FP0 != $FP0
.L2
-------------------------

Is there a way to tell GCC that sqrt function is totally handled by __builtin_sqrt ?

Regards,

Selim





More information about the Gcc mailing list