-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
| Bugzilla Link | 702 |
| Resolution | FIXED |
| Resolved on | Feb 22, 2010 12:55 |
| Version | 1.0 |
| OS | All |
Extended Description
It would be nice to add:
- an llvm intrinsic (llvm.copysign.f32/f64), that represents copysign[f] when negative zeros
and SNANs are not important (basically -ffast-math), the CFE could generate this. - a selectiondag node to represent the same condition, also when UnsafeFPMath is enabled.
Then the legalizer can turn copysign into either 1) stores to mem followed by bitfield stuff and a load,
or 2) fabs/fneg/setcc/select if the target has them.
With this, the PPC backend would codegen copysign as:
copysign(x, y) {
fabs xPos, x
fnabs xNeg, x
fsel x, y, xPos, xNeg
return x;
}
which is nice and fast. X86/SSE has a similar lowering, but it would be custom lowered.
This is important for codes that use the FORTRAN copysign intrinsic or the C99 copysign functions
heavily.
-Chris