[Nios2] Arithmetic instructions for R1 and R2 ISA.
Summary:
This commit enables some of the arithmetic instructions for Nios2 ISA (for both
R1 and R2 revisions), implements facilities required to emit those instructions
and provides LIT tests for added instructions.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D41236
Author: belickim <mateusz.belicki@intel.com>
llvm-svn: 322069
diff --git a/llvm/test/CodeGen/Nios2/add-sub.ll b/llvm/test/CodeGen/Nios2/add-sub.ll
new file mode 100644
index 0000000..7c9a289
--- /dev/null
+++ b/llvm/test/CodeGen/Nios2/add-sub.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -march=nios2 2>&1 | FileCheck %s
+; RUN: llc < %s -march=nios2 -target-abi=nios2r2 2>&1 | FileCheck %s
+
+define i32 @add_reg(i32 %a, i32 %b) nounwind {
+entry:
+; CHECK: add_reg:
+; CHECK: add r2, r4, r5
+ %c = add i32 %a, %b
+ ret i32 %c
+}
+
+define i32 @sub_reg(i32 %a, i32 %b) nounwind {
+entry:
+; CHECK: sub_reg:
+; CHECK: sub r2, r4, r5
+ %c = sub i32 %a, %b
+ ret i32 %c
+}
+