[PATCH] D84238: [PowerPC] Set v1i128 to expand for SETCC to avoid crash
Zhang Kang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 19:30:03 PDT 2020
ZhangKang updated this revision to Diff 279697.
ZhangKang added a comment.
Add more test cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84238/new/
https://reviews.llvm.org/D84238
Files:
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/setcc-vector.ll
Index: llvm/test/CodeGen/PowerPC/setcc-vector.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/setcc-vector.ll
@@ -0,0 +1,52 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown \
+; RUN: -ppc-asm-full-reg-names < %s | FileCheck -check-prefixes=CHECK-PWR9 %s
+; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown \
+; RUN: -ppc-asm-full-reg-names < %s | FileCheck -check-prefixes=CHECK-PWR8 %s
+; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc64le-unknown-unknown \
+; RUN: -ppc-asm-full-reg-names < %s | FileCheck -check-prefixes=CHECK-PWR7 %s
+
+define <2 x i1> @setcc_v1i128([1 x i128] %a) {
+; CHECK-PWR9-LABEL: setcc_v1i128:
+; CHECK-PWR9: # %bb.0: # %entry
+; CHECK-PWR9-NEXT: cmpldi r3, 35708
+; CHECK-PWR9-NEXT: cmpdi cr1, r4, 0
+; CHECK-PWR9-NEXT: li r3, -1
+; CHECK-PWR9-NEXT: crnand 4*cr5+lt, 4*cr1+eq, lt
+; CHECK-PWR9-NEXT: isel r3, 0, r3, 4*cr5+lt
+; CHECK-PWR9-NEXT: mtvsrdd vs34, 0, r3
+; CHECK-PWR9-NEXT: blr
+;
+; CHECK-PWR8-LABEL: setcc_v1i128:
+; CHECK-PWR8: # %bb.0: # %entry
+; CHECK-PWR8-NEXT: cmpldi r3, 35708
+; CHECK-PWR8-NEXT: cmpdi cr1, r4, 0
+; CHECK-PWR8-NEXT: li r3, -1
+; CHECK-PWR8-NEXT: li r4, 0
+; CHECK-PWR8-NEXT: crnand 4*cr5+lt, 4*cr1+eq, lt
+; CHECK-PWR8-NEXT: mtfprd f1, r4
+; CHECK-PWR8-NEXT: isel r3, 0, r3, 4*cr5+lt
+; CHECK-PWR8-NEXT: mtfprd f0, r3
+; CHECK-PWR8-NEXT: xxmrghd vs34, vs1, vs0
+; CHECK-PWR8-NEXT: blr
+;
+; CHECK-PWR7-LABEL: setcc_v1i128:
+; CHECK-PWR7: # %bb.0: # %entry
+; CHECK-PWR7-NEXT: cmpldi r3, 35708
+; CHECK-PWR7-NEXT: cmpdi cr1, r4, 0
+; CHECK-PWR7-NEXT: li r3, 0
+; CHECK-PWR7-NEXT: li r4, -1
+; CHECK-PWR7-NEXT: crnand 4*cr5+lt, 4*cr1+eq, lt
+; CHECK-PWR7-NEXT: std r3, -8(r1)
+; CHECK-PWR7-NEXT: isel r3, 0, r4, 4*cr5+lt
+; CHECK-PWR7-NEXT: std r3, -16(r1)
+; CHECK-PWR7-NEXT: addi r3, r1, -16
+; CHECK-PWR7-NEXT: lxvd2x vs0, 0, r3
+; CHECK-PWR7-NEXT: xxswapd vs34, vs0
+; CHECK-PWR7-NEXT: blr
+entry:
+ %b = extractvalue [1 x i128] %a, 0
+ %0 = insertelement <2 x i128> undef, i128 %b, i32 0
+ %1 = icmp ult <2 x i128> %0, <i128 35708, i128 1005868>
+ ret <2 x i1> %1
+}
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -906,6 +906,7 @@
setOperationAction(ISD::SRL, MVT::v1i128, Expand);
setOperationAction(ISD::SRA, MVT::v1i128, Expand);
+ setOperationAction(ISD::SETCC, MVT::v1i128, Expand);
setOperationAction(ISD::SETCC, MVT::v2i64, Legal);
}
else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84238.279697.patch
Type: text/x-patch
Size: 2880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/e56eda68/attachment.bin>
More information about the llvm-commits
mailing list