[PATCH] D25699: LegalizeDAG: Support promoting [US]DIV and [US]REM operations
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 14:12:01 PDT 2016
tstellarAMD created this revision.
tstellarAMD added a reviewer: bogner.
tstellarAMD added a subscriber: llvm-commits.
Herald added a subscriber: wdng.
AMDGPU will need this one i16 is added as a legal type. This is tested by:
test/CodeGen/AMDGPU/sdiv.ll
test/CodeGen/AMDGPU/sdivrem24.ll
test/CodeGen/AMDGPU/udiv.ll
test/CodeGen/AMDGPU/udivrem24.ll
https://reviews.llvm.org/D25699
Files:
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4131,6 +4131,10 @@
ReplacedNode(Node);
break;
}
+ case ISD::SDIV:
+ case ISD::SREM:
+ case ISD::UDIV:
+ case ISD::UREM:
case ISD::AND:
case ISD::OR:
case ISD::XOR: {
@@ -4140,7 +4144,20 @@
TruncOp = ISD::BITCAST;
} else {
assert(OVT.isInteger() && "Cannot promote logic operation");
- ExtOp = ISD::ANY_EXTEND;
+
+ switch (Node->getOpcode()) {
+ default:
+ ExtOp = ISD::ANY_EXTEND;
+ break;
+ case ISD::SDIV:
+ case ISD::SREM:
+ ExtOp = ISD::SIGN_EXTEND;
+ break;
+ case ISD::UDIV:
+ case ISD::UREM:
+ ExtOp = ISD::ZERO_EXTEND;
+ break;
+ }
TruncOp = ISD::TRUNCATE;
}
// Promote each of the values to the new type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25699.74903.patch
Type: text/x-patch
Size: 970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161017/4a8e5296/attachment.bin>
More information about the llvm-commits
mailing list