summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/codegen_test.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-03-28 15:43:40 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-03-31 11:41:39 +0100
commitd8ee737fdbf380c5bb90c9270c8d1087ac23e76c (patch)
treebecdbf2b4e2a3c84952bd7b1db60a2daccd47206 /compiler/optimizing/codegen_test.cc
parent7f466c08888129a9923cb973a4dc73ee4a71574e (diff)
downloadart-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.zip
art-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.tar.gz
art-d8ee737fdbf380c5bb90c9270c8d1087ac23e76c.tar.bz2
Add support for adding two integers in optimizing compiler.
Change-Id: I5524e193cd07f2692a57c6b4f8069904471b2928
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 ff743d8..d40990e 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