[LLVMbugs] [Bug 4093] New: LegalizeDAG does not allow expansion of subtraction operation
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Apr 27 17:10:33 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4093
Summary: LegalizeDAG does not allow expansion of subtraction
operation
Product: libraries
Version: 2.5
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: Common Code Generator Code
AssignedTo: unassignedbugs at nondot.org
ReportedBy: micah.villmow at amd.com
CC: llvmbugs at cs.uiuc.edu
I ran into a problem where setOperationAction(ISD::SUB, MVT::i64, Expand) was
giving an assertion.
I wrote this code to expand subtraction into multiple instructions.
It goes at line 3352 of LegalizeDAG.cpp.
if (Node->getOpcode() == ISD::SUB &&
TLI.isOperationLegalOrCustom(ISD::ADD, VT)) {
if (VT.isFloatingPoint() &&
TLI.isOperationLegalOrCustom(ISD::MUL, VT)) {
SDValue t1 = SDValue(DAG.getNode(ISD::MUL, dl,
VT, Tmp2,
DAG.getConstantFP(-1, VT)
).getNode(), 0);
Result = SDValue(DAG.getNode(ISD::ADD, dl, VT, Tmp1,
t1).getNode(), 0);
break;
} else if (VT.isInteger() &&
TLI.isOperationLegalOrCustom(ISD::XOR, VT)) {
SDValue t1 = SDValue(DAG.getNode(ISD::XOR, dl,
VT, Tmp2,DAG.getConstant(
(uint64_t)-1, VT)
).getNode(), 0);
SDValue t2 = SDValue(DAG.getNode(ISD::ADD, dl,
VT, t1, DAG.getConstant(1, VT)
).getNode(), 0);
Result = SDValue(DAG.getNode(ISD::ADD, dl, VT, Tmp1,
t2).getNode(), 0);
break;
}
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list