summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp9
-rw-r--r--llvm/test/CodeGen/PowerPC/vec_shuffle_p8vector.ll11
2 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 171f6bf0938..43ffef2dcff 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -1164,13 +1164,20 @@ bool PPC::isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind,
}
/// isVPKUDUMShuffleMask - Return true if this is the shuffle mask for a
-/// VPKUDUM instruction.
+/// VPKUDUM instruction, AND the VPKUDUM instruction exists for the
+/// current subtarget.
+///
/// The ShuffleKind distinguishes between big-endian operations with
/// two different inputs (0), either-endian operations with two identical
/// inputs (1), and little-endian operations with two different inputs (2).
/// For the latter, the input operands are swapped (see PPCInstrAltivec.td).
bool PPC::isVPKUDUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind,
SelectionDAG &DAG) {
+ const PPCSubtarget& Subtarget =
+ static_cast<const PPCSubtarget&>(DAG.getSubtarget());
+ if (!Subtarget.hasP8Vector())
+ return false;
+
bool IsLE = DAG.getTarget().getDataLayout()->isLittleEndian();
if (ShuffleKind == 0) {
if (IsLE)
diff --git a/llvm/test/CodeGen/PowerPC/vec_shuffle_p8vector.ll b/llvm/test/CodeGen/PowerPC/vec_shuffle_p8vector.ll
index d81aa729f8e..77802348d8e 100644
--- a/llvm/test/CodeGen/PowerPC/vec_shuffle_p8vector.ll
+++ b/llvm/test/CodeGen/PowerPC/vec_shuffle_p8vector.ll
@@ -1,4 +1,5 @@
; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu -mattr=+power8-vector < %s | FileCheck %s
+; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck -check-prefix=CHECK-PWR7 %s
define void @VPKUDUM_unary(<2 x i64>* %A) {
entry:
@@ -17,7 +18,12 @@ entry:
; CHECK-LABEL: @VPKUDUM_unary
; CHECK-NOT: vperm
+; CHECK-NOT: vmrglw
+; CHECK-NOT: vmrghw
; CHECK: vpkudum
+; CHECK-PWR7: vmrglw
+; CHECK-PWR7: vmrghw
+; CHECK-PWR7: vmrglw
define void @VPKUDUM(<2 x i64>* %A, <2 x i64>* %B) {
entry:
@@ -40,4 +46,9 @@ entry:
; CHECK-LABEL: @VPKUDUM
; CHECK-NOT: vperm
+; CHECK-NOT: vmrglw
+; CHECK-NOT: vmrghw
; CHECK: vpkudum
+; CHECK-PWR7: vmrglw
+; CHECK-PWR7: vmrghw
+; CHECK-PWR7: vmrglw
OpenPOWER on IntegriCloud