[PATCH] D63463: [CodeGen] Add missing vector type legalization for ctlz_zero_undef

Roland Froese via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 16:06:09 PDT 2019


RolandF created this revision.
RolandF added a reviewer: nemanjai.
Herald added subscribers: jsji, hiraditya.
Herald added a project: LLVM.

The change to PPC vector cost model for D60160 <https://reviews.llvm.org/D60160> exposed a regression where the support for legalizing a vector ctlz_zero_undef with illegal type was missing.


https://reviews.llvm.org/D63463

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/test/CodeGen/PowerPC/vec_clz.ll


Index: llvm/test/CodeGen/PowerPC/vec_clz.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/vec_clz.ll
+++ llvm/test/CodeGen/PowerPC/vec_clz.ll
@@ -38,3 +38,21 @@
 ; CHECK: vclzd 2, 2
 ; CHECK: blr
 }
+
+declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1 immarg)
+
+define <2 x i32> @illegal_ctlz(<2 x i32> %v1) {
+  %v2 = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %v1, i1 true)
+  ret <2 x i32> %v2
+}
+; CHECK-LABEL: @illegal_ctlz
+; CHECK: vclzw
+
+declare <2 x i32> @llvm.cttz.v2i32(<2 x i32>, i1 immarg)
+
+define <2 x i32> @illegal_cttz(<2 x i32> %v1) {
+  %v2 = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %v1, i1 true)
+  ret <2 x i32> %v2
+}
+; CHECK-LABEL: @illegal_cttz
+; CHECK: vpopcntw
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -2818,8 +2818,10 @@
   case ISD::BITREVERSE:
   case ISD::BSWAP:
   case ISD::CTLZ:
+  case ISD::CTLZ_ZERO_UNDEF:
   case ISD::CTPOP:
   case ISD::CTTZ:
+  case ISD::CTTZ_ZERO_UNDEF:
   case ISD::FNEG:
   case ISD::FCANONICALIZE:
     Res = WidenVecRes_Unary(N);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63463.205205.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190617/cec47133/attachment.bin>


More information about the llvm-commits mailing list