[PATCH] D64960: [PowerPC] Expand v1i128 smin
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 12:04:24 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369797: [PowerPC] Expand v1i128 smin (authored by froese, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D64960?vs=210701&id=216919#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64960/new/
https://reviews.llvm.org/D64960
Files:
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/test/CodeGen/PowerPC/vec-min-max.ll
Index: llvm/trunk/test/CodeGen/PowerPC/vec-min-max.ll
===================================================================
--- llvm/trunk/test/CodeGen/PowerPC/vec-min-max.ll
+++ llvm/trunk/test/CodeGen/PowerPC/vec-min-max.ll
@@ -237,3 +237,51 @@
ret <2 x double> %1
}
+define i128 @invalidv1i128(<2 x i128> %v1, <2 x i128> %v2) {
+; CHECK-LABEL: invalidv1i128:
+; CHECK: # %bb.0:
+; CHECK-NEXT: xxswapd 0, 36
+; CHECK-NEXT: mfvsrd 4, 36
+; CHECK-NEXT: mfvsrd 5, 34
+; CHECK-NEXT: mfvsrd 3, 0
+; CHECK-NEXT: xxswapd 0, 34
+; CHECK-NEXT: cmpld 5, 4
+; CHECK-NEXT: cmpd 1, 5, 4
+; CHECK-NEXT: crandc 20, 4, 2
+; CHECK-NEXT: mfvsrd 6, 0
+; CHECK-NEXT: cmpld 1, 6, 3
+; CHECK-NEXT: crand 21, 2, 4
+; CHECK-NEXT: cror 20, 21, 20
+; CHECK-NEXT: bc 12, 20, .LBB12_2
+; CHECK-NEXT: # %bb.1:
+; CHECK-NEXT: vmr 2, 4
+; CHECK-NEXT: .LBB12_2:
+; CHECK-NEXT: xxswapd 0, 34
+; CHECK-NEXT: mfvsrd 4, 34
+; CHECK-NEXT: mfvsrd 3, 0
+; CHECK-NEXT: blr
+;
+; NOP8VEC-LABEL: invalidv1i128:
+; NOP8VEC: # %bb.0:
+; NOP8VEC-NEXT: cmpld 4, 8
+; NOP8VEC-NEXT: cmpd 1, 4, 8
+; NOP8VEC-NEXT: addi 5, 1, -32
+; NOP8VEC-NEXT: crandc 20, 4, 2
+; NOP8VEC-NEXT: cmpld 1, 3, 7
+; NOP8VEC-NEXT: crand 21, 2, 4
+; NOP8VEC-NEXT: cror 20, 21, 20
+; NOP8VEC-NEXT: isel 3, 3, 7, 20
+; NOP8VEC-NEXT: isel 4, 4, 8, 20
+; NOP8VEC-NEXT: std 3, -32(1)
+; NOP8VEC-NEXT: addi 3, 1, -16
+; NOP8VEC-NEXT: std 4, -24(1)
+; NOP8VEC-NEXT: lxvd2x 0, 0, 5
+; NOP8VEC-NEXT: stxvd2x 0, 0, 3
+; NOP8VEC-NEXT: ld 3, -16(1)
+; NOP8VEC-NEXT: ld 4, -8(1)
+; NOP8VEC-NEXT: blr
+%1 = icmp slt <2 x i128> %v1, %v2
+%2 = select <2 x i1> %1, <2 x i128> %v1, <2 x i128> %v2
+%3 = extractelement <2 x i128> %2, i32 0
+ret i128 %3
+}
Index: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -558,10 +558,18 @@
// For v2i64, these are only valid with P8Vector. This is corrected after
// the loop.
- setOperationAction(ISD::SMAX, VT, Legal);
- setOperationAction(ISD::SMIN, VT, Legal);
- setOperationAction(ISD::UMAX, VT, Legal);
- setOperationAction(ISD::UMIN, VT, Legal);
+ if (VT.getSizeInBits() <= 128 && VT.getScalarSizeInBits() <= 64) {
+ setOperationAction(ISD::SMAX, VT, Legal);
+ setOperationAction(ISD::SMIN, VT, Legal);
+ setOperationAction(ISD::UMAX, VT, Legal);
+ setOperationAction(ISD::UMIN, VT, Legal);
+ }
+ else {
+ setOperationAction(ISD::SMAX, VT, Expand);
+ setOperationAction(ISD::SMIN, VT, Expand);
+ setOperationAction(ISD::UMAX, VT, Expand);
+ setOperationAction(ISD::UMIN, VT, Expand);
+ }
if (Subtarget.hasVSX()) {
setOperationAction(ISD::FMAXNUM, VT, Legal);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64960.216919.patch
Type: text/x-patch
Size: 2952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190823/0eae3563/attachment.bin>
More information about the llvm-commits
mailing list