summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRoland Froese <froese@ca.ibm.com>2019-08-23 19:04:47 +0000
committerRoland Froese <froese@ca.ibm.com>2019-08-23 19:04:47 +0000
commitb4051e57b104d17ed4f5be21e3c54f80d170b97f (patch)
treed462669ee1de1942eea776be640c3d6becae06ac /llvm
parent0366168f3ac6c838fa41cddc02db84d48403f21e (diff)
downloadbcm5719-llvm-b4051e57b104d17ed4f5be21e3c54f80d170b97f.tar.gz
bcm5719-llvm-b4051e57b104d17ed4f5be21e3c54f80d170b97f.zip
[PowerPC] Expand v1i128 smin
The smin opcode and friends for v1i128 are incorrectly marked as legal for PPC. Change them to expand. Differential Revision: https://reviews.llvm.org/D64960 llvm-svn: 369797
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp16
-rw-r--r--llvm/test/CodeGen/PowerPC/vec-min-max.ll48
2 files changed, 60 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index f422b355d69..06df60c0266 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -558,10 +558,18 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
// 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);
diff --git a/llvm/test/CodeGen/PowerPC/vec-min-max.ll b/llvm/test/CodeGen/PowerPC/vec-min-max.ll
index 4b53d15e01e..8269e1c3c7b 100644
--- a/llvm/test/CodeGen/PowerPC/vec-min-max.ll
+++ b/llvm/test/CodeGen/PowerPC/vec-min-max.ll
@@ -237,3 +237,51 @@ entry:
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
+}
OpenPOWER on IntegriCloud