Only enable 64-bit bswap DAG combines for PPC64
authorHal Finkel <hfinkel@anl.gov>
Thu, 28 Mar 2013 20:23:46 +0000 (20:23 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 28 Mar 2013 20:23:46 +0000 (20:23 +0000)
Compiling in 32-bit mode on a P7 would assert after 64-bit DAG combines were
added for bswap with load/store. This is because these combines are really only
valid in 64-bit mode, regardless of the CPU (and this was not being checked).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178286 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/bswap-load-store.ll

index e8b94bca6802d344584c17ef667a0190d3eb5aad..74e811b35cf6b9b6b471bc648ab58995bac67069 100644 (file)
@@ -6606,6 +6606,7 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N,
         (N->getOperand(1).getValueType() == MVT::i32 ||
          N->getOperand(1).getValueType() == MVT::i16 ||
          (TM.getSubtarget<PPCSubtarget>().hasLDBRX() &&
+          TM.getSubtarget<PPCSubtarget>().isPPC64() &&
           N->getOperand(1).getValueType() == MVT::i64))) {
       SDValue BSwapOp = N->getOperand(1).getOperand(0);
       // Do an any-extend to 32-bits if this is a half-word input.
@@ -6629,6 +6630,7 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N,
         N->getOperand(0).hasOneUse() &&
         (N->getValueType(0) == MVT::i32 || N->getValueType(0) == MVT::i16 ||
          (TM.getSubtarget<PPCSubtarget>().hasLDBRX() &&
+          TM.getSubtarget<PPCSubtarget>().isPPC64() &&
           N->getValueType(0) == MVT::i64))) {
       SDValue Load = N->getOperand(0);
       LoadSDNode *LD = cast<LoadSDNode>(Load);
index 2aae4150efb64975fab172143c3195859d1e4e5e..6b60fdd6e1ab4ab5f769e887e5bd34a273c38fe4 100644 (file)
@@ -1,6 +1,7 @@
 ; RUN: llc < %s -march=ppc32 | FileCheck %s -check-prefix=X32
 ; RUN: llc < %s -march=ppc64 | FileCheck %s -check-prefix=X64
 ; RUN: llc < %s -march=ppc64 -mcpu=pwr7 | FileCheck %s -check-prefix=PWR7
+; RUN: llc < %s -march=ppc32 -mcpu=pwr7 | FileCheck %s -check-prefix=X32
 
 
 define void @STWBRX(i32 %i, i8* %ptr, i32 %off) {