[PATCH] D86268: [DAGTypeLegalizer] Handle ZERO_EXTEND of promoted integer in WidenVecRes_Convert.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 01:12:26 PDT 2020
jonpa created this revision.
jonpa added reviewers: eli.friedman, uweigand, craig.topper.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
jonpa requested review of this revision.
On SystemZ, a ZERO_EXTEND of an i1 vector handled by WidenVecRes_Convert() always ended up being scalarized, because the type action of the input is promotion which was previously an unhandled case in this method.
This fixes https://bugs.llvm.org/show_bug.cgi?id=47132.
Patch by Eli Friedman.
https://reviews.llvm.org/D86268
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/test/CodeGen/SystemZ/vec-zext.ll
Index: llvm/test/CodeGen/SystemZ/vec-zext.ll
===================================================================
--- llvm/test/CodeGen/SystemZ/vec-zext.ll
+++ llvm/test/CodeGen/SystemZ/vec-zext.ll
@@ -92,3 +92,19 @@
ret <8 x i16> %z
}
+define <2 x i32> @fun11(<2 x i64> %Arg1, <2 x i64> %Arg2) {
+; CHECK-LABEL: fun11:
+; CHECK: vgbm %v0, 0
+; CHECK-NEXT: vceqg %v1, %v24, %v0
+; CHECK-NEXT: vceqg %v0, %v26, %v0
+; CHECK-NEXT: vo %v0, %v1, %v0
+; CHECK-NEXT: vrepig %v1, 1
+; CHECK-NEXT: vn %v0, %v0, %v1
+; CHECK-NEXT: vpkg %v24, %v0, %v0
+; CHECK-NEXT: br %r14
+ %i3 = icmp eq <2 x i64> %Arg1, zeroinitializer
+ %i5 = icmp eq <2 x i64> %Arg2, zeroinitializer
+ %i6 = or <2 x i1> %i3, %i5
+ %i7 = zext <2 x i1> %i6 to <2 x i32>
+ ret <2 x i32> %i7
+}
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -3304,6 +3304,18 @@
unsigned Opcode = N->getOpcode();
unsigned InVTNumElts = InVT.getVectorNumElements();
const SDNodeFlags Flags = N->getFlags();
+
+ if (N->getOpcode() == ISD::ZERO_EXTEND &&
+ getTypeAction(InVT) == TargetLowering::TypePromoteInteger) {
+ InOp = ZExtPromotedInteger(InOp);
+ InVT = InOp.getValueType();
+ InEltVT = InVT.getVectorElementType();
+ InWidenVT = EVT::getVectorVT(*DAG.getContext(), InEltVT, WidenNumElts);
+ InVTNumElts = InVT.getVectorNumElements();
+ if (WidenVT.getScalarSizeInBits() < InVT.getScalarSizeInBits())
+ Opcode = ISD::TRUNCATE;
+ }
+
if (getTypeAction(InVT) == TargetLowering::TypeWidenVector) {
InOp = GetWidenedVector(N->getOperand(0));
InVT = InOp.getValueType();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86268.286731.patch
Type: text/x-patch
Size: 1808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/7a155014/attachment.bin>
More information about the llvm-commits
mailing list