[Hexagon] Adding A2_sub instruction
authorColin LeMahieu <colinl@codeaurora.org>
Tue, 18 Nov 2014 21:51:51 +0000 (21:51 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Tue, 18 Nov 2014 21:51:51 +0000 (21:51 +0000)
Renaming test files.

llvm-svn: 222263

llvm/lib/Target/Hexagon/HexagonInstrInfo.td
llvm/test/MC/Hexagon/inst_add.ll [moved from llvm/test/MC/Hexagon/instructions.ll with 100% similarity]
llvm/test/MC/Hexagon/inst_sub.ll [new file with mode: 0644]

index 3acefd5..f06c1dc 100644 (file)
@@ -162,6 +162,7 @@ multiclass T_ALU32_3op_A2<string mnemonic, bits<3> MajOp, bits<3> MinOp,
 
 let isCodeGenOnly = 0 in
 defm add : T_ALU32_3op_A2<"add", 0b011, 0b000, 0, 1>;
+defm sub : T_ALU32_3op_A2<"sub", 0b011, 0b001, 1, 0>;
 
 // Pats for instruction selection.
 class BinOp32_pat<SDNode Op, InstHexagon MI, ValueType ResT>
@@ -169,6 +170,7 @@ class BinOp32_pat<SDNode Op, InstHexagon MI, ValueType ResT>
         (ResT (MI IntRegs:$Rs, IntRegs:$Rt))>;
 
 def: BinOp32_pat<add, A2_add, i32>;
+def: BinOp32_pat<sub, A2_sub, i32>;
 
 multiclass ALU32_Pbase<string mnemonic, RegisterClass RC, bit isNot,
                        bit isPredNew> {
diff --git a/llvm/test/MC/Hexagon/inst_sub.ll b/llvm/test/MC/Hexagon/inst_sub.ll
new file mode 100644 (file)
index 0000000..7523aa6
--- /dev/null
@@ -0,0 +1,10 @@
+;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \
+;; RUN: | llvm-objdump -s - | FileCheck %s
+
+define i32 @foo (i32 %a, i32 %b)
+{
+  %1 = sub i32 %a, %b
+  ret i32 %1
+}
+
+; CHECK:  0000 004021f3 00c09f52
\ No newline at end of file