summaryrefslogtreecommitdiff
path: root/compiler/optimizing/codegen_test.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2014-03-31 10:44:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2014-03-31 10:44:47 +0000
commit7414375acad6170606903013d331f653173c299f (patch)
treeeb09d8f2e17811b2a8e9bbb34087ce0538439e58 /compiler/optimizing/codegen_test.cc
parent8732bf96433bbc177de509390d285b2d5477c83d (diff)
parentd8ee737fdbf380c5bb90c9270c8d1087ac23e76c (diff)
Merge "Add support for adding two integers in optimizing compiler."
Diffstat (limited to 'compiler/optimizing/codegen_test.cc')
-rw-r--r--compiler/optimizing/codegen_test.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index ff743d8ed3..d40990e86b 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -196,4 +196,42 @@ TEST(CodegenTest, ReturnIf2) {
TestCode(data, true, 0);
}
+TEST(CodegenTest, ReturnAdd1) {
+ const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
+ Instruction::CONST_4 | 3 << 12 | 0,
+ Instruction::CONST_4 | 4 << 12 | 1 << 8,
+ Instruction::ADD_INT, 1 << 8 | 0,
+ Instruction::RETURN);
+
+ TestCode(data, true, 7);
+}
+
+TEST(CodegenTest, ReturnAdd2) {
+ const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
+ Instruction::CONST_4 | 3 << 12 | 0,
+ Instruction::CONST_4 | 4 << 12 | 1 << 8,
+ Instruction::ADD_INT_2ADDR | 1 << 12,
+ Instruction::RETURN);
+
+ TestCode(data, true, 7);
+}
+
+TEST(CodegenTest, ReturnAdd3) {
+ const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
+ Instruction::CONST_4 | 4 << 12 | 0 << 8,
+ Instruction::ADD_INT_LIT8, 3 << 8 | 0,
+ Instruction::RETURN);
+
+ TestCode(data, true, 7);
+}
+
+TEST(CodegenTest, ReturnAdd4) {
+ const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
+ Instruction::CONST_4 | 4 << 12 | 0 << 8,
+ Instruction::ADD_INT_LIT16, 3,
+ Instruction::RETURN);
+
+ TestCode(data, true, 7);
+}
+
} // namespace art