Mark rotl/rotr as expand. This generates pretty ugly code, but this is better than...
authorAnton Korobeynikov <asl@math.spbu.ru>
Sun, 17 May 2009 10:16:28 +0000 (10:16 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sun, 17 May 2009 10:16:28 +0000 (10:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71976 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/MSP430/MSP430ISelLowering.cpp
test/CodeGen/MSP430/2009-05-17-Rot.ll [new file with mode: 0644]

index 387cebffc0b574336a7df9a0227e69edc771a057..14db20e5fcd6269fc12146a3b0bca105fc38c324 100644 (file)
@@ -73,6 +73,10 @@ MSP430TargetLowering::MSP430TargetLowering(MSP430TargetMachine &tm) :
   setOperationAction(ISD::SRA,              MVT::i16,   Custom);
   setOperationAction(ISD::SHL,              MVT::i16,   Custom);
   setOperationAction(ISD::SRL,              MVT::i16,   Custom);
+  setOperationAction(ISD::ROTL,             MVT::i8,    Expand);
+  setOperationAction(ISD::ROTR,             MVT::i8,    Expand);
+  setOperationAction(ISD::ROTL,             MVT::i16,   Expand);
+  setOperationAction(ISD::ROTR,             MVT::i16,   Expand);
   setOperationAction(ISD::RET,              MVT::Other, Custom);
   setOperationAction(ISD::GlobalAddress,    MVT::i16,   Custom);
   setOperationAction(ISD::ExternalSymbol,   MVT::i16,   Custom);
diff --git a/test/CodeGen/MSP430/2009-05-17-Rot.ll b/test/CodeGen/MSP430/2009-05-17-Rot.ll
new file mode 100644 (file)
index 0000000..c25a906
--- /dev/null
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | llc -march=msp430
+
+define i16 @rol1u16(i16 %x.arg) nounwind {
+        %retval = alloca i16
+        %x = alloca i16
+        store i16 %x.arg, i16* %x
+        %1 = load i16* %x
+        %2 = shl i16 %1, 1
+        %3 = load i16* %x
+        %4 = lshr i16 %3, 15
+        %5 = or i16 %2, %4
+        store i16 %5, i16* %retval
+        br label %return
+return:
+        %6 = load i16* %retval
+        ret i16 %6
+}
\ No newline at end of file