Emit direction operand in binary insns that stores in memory.
authorSanjiv Gupta <sanjiv.gupta@microchip.com>
Sat, 19 Dec 2009 13:52:01 +0000 (13:52 +0000)
committerSanjiv Gupta <sanjiv.gupta@microchip.com>
Sat, 19 Dec 2009 13:52:01 +0000 (13:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91777 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PIC16/PIC16InstrInfo.td
test/CodeGen/PIC16/result_direction.ll [new file with mode: 0644]

index 5eec6c4e66b5c98ba13a43416a216ec76964f8a5..bf4baf394025db9198ec9d2ccb6765c0267d6df3 100644 (file)
@@ -151,7 +151,7 @@ let mayStore = 1 in
 class BinOpWF<bits<6> OpCode, string OpcStr, SDNode OpNode>:
   ByteFormat<OpCode, (outs),
              (ins GPR:$src, i8imm:$offset, i8mem:$ptrlo, i8imm:$ptrhi),
-              !strconcat(OpcStr, " $ptrlo + $offset"),
+              !strconcat(OpcStr, " $ptrlo + $offset, F"),
              [(PIC16Store (OpNode GPR:$src, (PIC16Load diraddr:$ptrlo,
                                              (i8 imm:$ptrhi),
                                              (i8 imm:$offset))),
diff --git a/test/CodeGen/PIC16/result_direction.ll b/test/CodeGen/PIC16/result_direction.ll
new file mode 100644 (file)
index 0000000..8549e21
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | llc -march=pic16 | FileCheck %s
+
+@a = common global i16 0, align 1                 ; <i16*> [#uses=2]
+
+define void @foo() nounwind {
+entry:
+  %tmp = load i16* @a                             ; <i16> [#uses=1]
+  %add = add nsw i16 %tmp, 1                      ; <i16> [#uses=1]
+  store i16 %add, i16* @a
+;CHECK: movlw 1
+;CHECK: addwf @a + 0, F
+  ret void
+}