[llvm] r178286 - Only enable 64-bit bswap DAG combines for PPC64

Hal Finkel hfinkel at anl.gov
Thu Mar 28 13:23:47 PDT 2013


Author: hfinkel
Date: Thu Mar 28 15:23:46 2013
New Revision: 178286

URL: http://llvm.org/viewvc/llvm-project?rev=178286&view=rev
Log:
Only enable 64-bit bswap DAG combines for PPC64

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).

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/trunk/test/CodeGen/PowerPC/bswap-load-store.ll

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=178286&r1=178285&r2=178286&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Mar 28 15:23:46 2013
@@ -6606,6 +6606,7 @@ SDValue PPCTargetLowering::PerformDAGCom
         (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::PerformDAGCom
         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);

Modified: llvm/trunk/test/CodeGen/PowerPC/bswap-load-store.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/bswap-load-store.ll?rev=178286&r1=178285&r2=178286&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/bswap-load-store.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/bswap-load-store.ll Thu Mar 28 15:23:46 2013
@@ -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) {





More information about the llvm-commits mailing list