diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/optimizing_cfi_test.cc | 27 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_cfi_test_expected.inc | 12 |
2 files changed, 35 insertions, 4 deletions
diff --git a/compiler/optimizing/optimizing_cfi_test.cc b/compiler/optimizing/optimizing_cfi_test.cc index 013e110b87..0e02311672 100644 --- a/compiler/optimizing/optimizing_cfi_test.cc +++ b/compiler/optimizing/optimizing_cfi_test.cc @@ -24,12 +24,22 @@ #include "optimizing/code_generator.h" #include "optimizing/optimizing_unit_test.h" #include "utils/assembler.h" +#ifdef ART_USE_VIXL_ARM_BACKEND +#include "utils/arm/assembler_arm_vixl.h" +#else #include "utils/arm/assembler_thumb2.h" +#endif #include "utils/mips/assembler_mips.h" #include "utils/mips64/assembler_mips64.h" #include "optimizing/optimizing_cfi_test_expected.inc" +#ifdef ART_USE_VIXL_ARM_BACKEND +namespace vixl32 = vixl::aarch32; + +using vixl32::r0; +#endif + namespace art { // Run the tests only on host. @@ -158,8 +168,7 @@ class OptimizingCFITest : public CFITest { TestImpl(isa, #isa, expected_asm, expected_cfi); \ } -// TODO(VIXL): Support this test for the VIXL backend. -#if defined(ART_ENABLE_CODEGEN_arm) && !defined(ART_USE_VIXL_ARM_BACKEND) +#ifdef ART_ENABLE_CODEGEN_arm TEST_ISA(kThumb2) #endif #ifdef ART_ENABLE_CODEGEN_arm64 @@ -178,8 +187,7 @@ TEST_ISA(kMips) TEST_ISA(kMips64) #endif -// TODO(VIXL): Support this test for the VIXL backend. -#if defined(ART_ENABLE_CODEGEN_arm) && !defined(ART_USE_VIXL_ARM_BACKEND) +#ifdef ART_ENABLE_CODEGEN_arm TEST_F(OptimizingCFITest, kThumb2Adjust) { std::vector<uint8_t> expected_asm( expected_asm_kThumb2_adjust, @@ -188,6 +196,16 @@ TEST_F(OptimizingCFITest, kThumb2Adjust) { expected_cfi_kThumb2_adjust, expected_cfi_kThumb2_adjust + arraysize(expected_cfi_kThumb2_adjust)); SetUpFrame(kThumb2); +#ifdef ART_USE_VIXL_ARM_BACKEND +#define __ down_cast<arm::ArmVIXLAssembler*>(GetCodeGenerator() \ + ->GetAssembler())->GetVIXLAssembler()-> + vixl32::Label target; + __ CompareAndBranchIfZero(r0, &target); + // Push the target out of range of CBZ. + for (size_t i = 0; i != 65; ++i) { + __ Ldr(r0, vixl32::MemOperand(r0)); + } +#else #define __ down_cast<arm::Thumb2Assembler*>(GetCodeGenerator()->GetAssembler())-> Label target; __ CompareAndBranchIfZero(arm::R0, &target); @@ -195,6 +213,7 @@ TEST_F(OptimizingCFITest, kThumb2Adjust) { for (size_t i = 0; i != 65; ++i) { __ ldr(arm::R0, arm::Address(arm::R0)); } +#endif __ Bind(&target); #undef __ Finish(); diff --git a/compiler/optimizing/optimizing_cfi_test_expected.inc b/compiler/optimizing/optimizing_cfi_test_expected.inc index f735dc8cb3..82670c38fe 100644 --- a/compiler/optimizing/optimizing_cfi_test_expected.inc +++ b/compiler/optimizing/optimizing_cfi_test_expected.inc @@ -223,8 +223,16 @@ static constexpr uint8_t expected_cfi_kMips64[] = { // 0x00000040: .cfi_def_cfa_offset: 64 static constexpr uint8_t expected_asm_kThumb2_adjust[] = { +#ifdef ART_USE_VIXL_ARM_BACKEND + // VIXL emits an extra 2 bytes here for a 32-bit beq as there is no + // optimistic 16-bit emit and subsequent fixup for out of reach targets + // as with the current assembler. + 0x60, 0xB5, 0x2D, 0xED, 0x02, 0x8A, 0x8B, 0xB0, 0x00, 0x28, 0x00, 0xF0, + 0x41, 0x80, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, +#else 0x60, 0xB5, 0x2D, 0xED, 0x02, 0x8A, 0x8B, 0xB0, 0x00, 0x28, 0x40, 0xD0, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, +#endif 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, 0x00, 0x68, @@ -239,7 +247,11 @@ static constexpr uint8_t expected_asm_kThumb2_adjust[] = { }; static constexpr uint8_t expected_cfi_kThumb2_adjust[] = { 0x42, 0x0E, 0x0C, 0x85, 0x03, 0x86, 0x02, 0x8E, 0x01, 0x44, 0x0E, 0x14, +#ifdef ART_USE_VIXL_ARM_BACKEND + 0x05, 0x50, 0x05, 0x05, 0x51, 0x04, 0x42, 0x0E, 0x40, 0x02, 0x88, 0x0A, +#else 0x05, 0x50, 0x05, 0x05, 0x51, 0x04, 0x42, 0x0E, 0x40, 0x02, 0x86, 0x0A, +#endif 0x42, 0x0E, 0x14, 0x44, 0x0E, 0x0C, 0x06, 0x50, 0x06, 0x51, 0x42, 0x0B, 0x0E, 0x40, }; |