CellSPU: Custom lower truncating stores of i8 to i1 (should not have been
authorScott Michel <scottm@aero.org>
Thu, 20 Nov 2008 05:01:09 +0000 (05:01 +0000)
committerScott Michel <scottm@aero.org>
Thu, 20 Nov 2008 05:01:09 +0000 (05:01 +0000)
promote), fix signed conversion of indexed offsets.

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

lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/CellSPU/SPUISelLowering.cpp

index 2fdac3376cc6b8349be46df8d0ee242abb7162ca..3037ba30fa3bef2a505d3c267a2c5559b2315b79 100644 (file)
@@ -189,9 +189,10 @@ namespace {
       assert(MO.isImm() &&
              "printMemRegImmS10 first operand is not immedate");
       int64_t value = int64_t(MI->getOperand(OpNo).getImm());
-      assert((value >= -(1 << (9+4)) && value <= (1 << (9+4)) - 1)
+      int16_t value16 = int16_t(value);
+      assert((value16 >= -(1 << (9+4)) && value16 <= (1 << (9+4)) - 1)
              && "Invalid dform s10 offset argument");
-      O << value << "(";
+      O << value16 << "(";
       printOperand(MI, OpNo+1);
       O << ")";
     }
index 002ef3f66126870ad60f25ae77e4212969ce5a4f..1ed3bab733bb9d75afda9242c387095fc7e25a41 100644 (file)
@@ -134,7 +134,7 @@ SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM)
   setLoadExtAction(ISD::EXTLOAD,  MVT::i1, Promote);
   setLoadExtAction(ISD::SEXTLOAD, MVT::i1, Promote);
   setLoadExtAction(ISD::ZEXTLOAD, MVT::i1, Promote);
-  setTruncStoreAction(MVT::i8,    MVT::i1, Promote);
+  setTruncStoreAction(MVT::i8,    MVT::i1, Custom);
   setTruncStoreAction(MVT::i16,   MVT::i1, Custom);
   setTruncStoreAction(MVT::i32,   MVT::i1, Custom);
   setTruncStoreAction(MVT::i64,   MVT::i1, Custom);