summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 2170670a0b6..4cc86ed2d36 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3099,6 +3099,14 @@ SDValue DAGCombiner::visitMULHS(SDNode *N) {
EVT VT = N->getValueType(0);
SDLoc DL(N);
+ if (VT.isVector()) {
+ // fold (mulhs x, 0) -> 0
+ if (ISD::isBuildVectorAllZeros(N1.getNode()))
+ return N1;
+ if (ISD::isBuildVectorAllZeros(N0.getNode()))
+ return N0;
+ }
+
// fold (mulhs x, 0) -> 0
if (isNullConstant(N1))
return N1;
@@ -3138,6 +3146,14 @@ SDValue DAGCombiner::visitMULHU(SDNode *N) {
EVT VT = N->getValueType(0);
SDLoc DL(N);
+ if (VT.isVector()) {
+ // fold (mulhu x, 0) -> 0
+ if (ISD::isBuildVectorAllZeros(N1.getNode()))
+ return N1;
+ if (ISD::isBuildVectorAllZeros(N0.getNode()))
+ return N0;
+ }
+
// fold (mulhu x, 0) -> 0
if (isNullConstant(N1))
return N1;
OpenPOWER on IntegriCloud