From 647b96f29cb81832e698f863884fdba06674c9de Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Tue, 11 Nov 2014 12:26:26 +0000 Subject: Add support for long-to-int in the optimizing compiler. - Add support for the long-to-int Dex instruction in the optimizing compiler. - Generate x86, x86-64 and ARM (but not ARM64) code for long-to-int HTypeConversion nodes. - Add related tests to test/422-type-conversion. - Also fix comments in test/415-optimizing-arith-neg and in test/416-optimizing-arith-not. Change-Id: I3084af30f2a495d178362ae1154dc7ceb7bf3a58 --- compiler/optimizing/codegen_test.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'compiler/optimizing/codegen_test.cc') diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index ecee44392e..de2253b6fe 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -362,6 +362,23 @@ NOT_LONG_TEST(ReturnNotLongINT64_MAX, #undef NOT_LONG_TEST +TEST(CodegenTest, IntToLongOfLongToInt) { + const int64_t input = INT64_C(4294967296); // 2^32 + const uint16_t word0 = Low16Bits(Low32Bits(input)); // LSW. + const uint16_t word1 = High16Bits(Low32Bits(input)); + const uint16_t word2 = Low16Bits(High32Bits(input)); + const uint16_t word3 = High16Bits(High32Bits(input)); // MSW. + const uint16_t data[] = FIVE_REGISTERS_CODE_ITEM( + Instruction::CONST_WIDE | 0 << 8, word0, word1, word2, word3, + Instruction::CONST_WIDE | 2 << 8, 1, 0, 0, 0, + Instruction::ADD_LONG | 0, 0 << 8 | 2, // v0 <- 2^32 + 1 + Instruction::LONG_TO_INT | 4 << 8 | 0 << 12, + Instruction::INT_TO_LONG | 2 << 8 | 4 << 12, + Instruction::RETURN_WIDE | 2 << 8); + + TestCodeLong(data, true, 1); +} + TEST(CodegenTest, ReturnAdd1) { const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( Instruction::CONST_4 | 3 << 12 | 0, -- cgit v1.2.3-59-g8ed1b