[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
Tue Jun 18 10:47:25 PDT 2019
RolandF updated this revision to Diff 205399.
RolandF added a comment.
Add X86 test.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63463/new/
https://reviews.llvm.org/D63463
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/test/CodeGen/PowerPC/vec_clz.ll
llvm/test/CodeGen/X86/vec_clz.ll
Index: llvm/test/CodeGen/X86/vec_clz.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/vec_clz.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -x86-experimental-vector-widening-legalization | FileCheck %s
+
+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: retq
+
+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: retq
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.205399.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190618/f462174e/attachment.bin>
More information about the llvm-commits
mailing list