diff options
Diffstat (limited to 'compiler/optimizing/codegen_test.cc')
| -rw-r--r-- | compiler/optimizing/codegen_test.cc | 15 | 
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 7ec0c84167..bfdc30f26b 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -48,10 +48,17 @@ class InternalCodeAllocator : public CodeAllocator {  };  #if defined(__i386__) || defined(__arm__) || defined(__x86_64__) -static void Run(const InternalCodeAllocator& allocator, bool has_result, int32_t expected) { +static void Run(const InternalCodeAllocator& allocator, +                const CodeGenerator& codegen, +                bool has_result, +                int32_t expected) {    typedef int32_t (*fptr)();    CommonCompilerTest::MakeExecutable(allocator.GetMemory(), allocator.GetSize());    fptr f = reinterpret_cast<fptr>(allocator.GetMemory()); +  if (codegen.GetInstructionSet() == kThumb2) { +    // For thumb we need the bottom bit set. +    f = reinterpret_cast<fptr>(reinterpret_cast<uintptr_t>(f) + 1); +  }    int32_t result = f();    if (has_result) {      CHECK_EQ(result, expected); @@ -71,19 +78,19 @@ static void TestCode(const uint16_t* data, bool has_result = false, int32_t expe    CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, kX86);    codegen->CompileBaseline(&allocator);  #if defined(__i386__) -  Run(allocator, has_result, expected); +  Run(allocator, *codegen, has_result, expected);  #endif    codegen = CodeGenerator::Create(&arena, graph, kArm);    codegen->CompileBaseline(&allocator);  #if defined(__arm__) -  Run(allocator, has_result, expected); +  Run(allocator, *codegen, has_result, expected);  #endif    codegen = CodeGenerator::Create(&arena, graph, kX86_64);    codegen->CompileBaseline(&allocator);  #if defined(__x86_64__) -  Run(allocator, has_result, expected); +  Run(allocator, *codegen, has_result, expected);  #endif  }  |