summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2016-10-26 14:52:25 +0000
committerTom Stellard <thomas.stellard@amd.com>2016-10-26 14:52:25 +0000
commit284cf32ab4c6a7b6c8d1bca5363c6776273f340e (patch)
tree93baa79122f46e57a3eb0bc0540a83f9c454fee7 /llvm/lib
parentf8e6eaff6e6ef353736cfedf43abcd158ec43e34 (diff)
downloadbcm5719-llvm-284cf32ab4c6a7b6c8d1bca5363c6776273f340e.tar.gz
bcm5719-llvm-284cf32ab4c6a7b6c8d1bca5363c6776273f340e.zip
LegalizeDAG: Support promoting [US]DIV and [US]REM operations
Summary: 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 Reviewers: bogner, efriedma Subscribers: efriedma, wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D25699 llvm-svn: 285199
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index c468a0fabc1..e48e6fa8aee 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4148,6 +4148,10 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
ReplacedNode(Node);
break;
}
+ case ISD::SDIV:
+ case ISD::SREM:
+ case ISD::UDIV:
+ case ISD::UREM:
case ISD::AND:
case ISD::OR:
case ISD::XOR: {
@@ -4157,7 +4161,20 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
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.
OpenPOWER on IntegriCloud