When compiling
double isnan(double x){
return x!=x
}
both clang and gcc utilize the parity-flag PF
:
_Z6is_nand: # @_Z6is_nand
ucomisd %xmm0, %xmm0
setp %al
retq
However, the two possible outcomes of the comparison are:
NaN Not-Nan
ZF 1 1
PF 1 0
CF 1 0
that means it would be also possible to use the CF
-flag as alternative, i.e. setb
instead of setp
.
Are there any advantages of using setp
over setb
, or is it a coincidence, that both compilers use the parity flag?
PS: This question is the following up to Understanding compilation result for std::isnan