[LLVMbugs] [Bug 702] NEW: [codegen] Compile copysign more optimally
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Jan 24 14:22:20 PST 2006
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=702
Summary: [codegen] Compile copysign more optimally
Product: libraries
Version: 1.0
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Common Code Generator Code
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sabre at nondot.org
CC: natebegeman at mac.com
It would be nice to add:
1. 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.
2. 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
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list