Add support for int-to-char in the optimizing compiler.
- Add support for the int-to-char Dex instruction in the
optimizing compiler.
- Implement the ARM and Thumb-2 UBFX instructions and add
tests for them.
- Generate x86, x86-64 and ARM (but not ARM64) code for
byte to char, short to char, int to char (and char to
char!) HTypeConversion nodes.
- Add related tests to test/422-type-conversion.
Change-Id: I5cd4c6d86f0f6a966c059715b98db35cc8f9de76
diff --git a/compiler/utils/arm/assembler_arm32_test.cc b/compiler/utils/arm/assembler_arm32_test.cc
index 4f5d4c3..277a9eb 100644
--- a/compiler/utils/arm/assembler_arm32_test.cc
+++ b/compiler/utils/arm/assembler_arm32_test.cc
@@ -116,4 +116,40 @@
DriverStr(expected, "sbfx");
}
+TEST_F(AssemblerArm32Test, Ubfx) {
+ GetAssembler()->ubfx(arm::R0, arm::R1, 0, 1);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 0, 8);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 0, 16);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 0, 32);
+
+ GetAssembler()->ubfx(arm::R0, arm::R1, 8, 1);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 8, 8);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 8, 16);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 8, 24);
+
+ GetAssembler()->ubfx(arm::R0, arm::R1, 16, 1);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 16, 8);
+ GetAssembler()->ubfx(arm::R0, arm::R1, 16, 16);
+
+ GetAssembler()->ubfx(arm::R0, arm::R1, 31, 1);
+
+ const char* expected =
+ "ubfx r0, r1, #0, #1\n"
+ "ubfx r0, r1, #0, #8\n"
+ "ubfx r0, r1, #0, #16\n"
+ "ubfx r0, r1, #0, #32\n"
+
+ "ubfx r0, r1, #8, #1\n"
+ "ubfx r0, r1, #8, #8\n"
+ "ubfx r0, r1, #8, #16\n"
+ "ubfx r0, r1, #8, #24\n"
+
+ "ubfx r0, r1, #16, #1\n"
+ "ubfx r0, r1, #16, #8\n"
+ "ubfx r0, r1, #16, #16\n"
+
+ "ubfx r0, r1, #31, #1\n";
+ DriverStr(expected, "ubfx");
+}
+
} // namespace art