diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-06-09 18:40:10 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-06-13 09:49:30 +0100 |
commit | 9cf35523764d829ae0470dae2d5dd99be469c841 (patch) | |
tree | 889459a8ecf8fdf801ea46dd58d15268dfb25af8 /compiler/optimizing/codegen_test.cc | |
parent | b08f63c21de64f8b74003e3638e100471bd099f3 (diff) | |
download | android_art-9cf35523764d829ae0470dae2d5dd99be469c841.tar.gz android_art-9cf35523764d829ae0470dae2d5dd99be469c841.tar.bz2 android_art-9cf35523764d829ae0470dae2d5dd99be469c841.zip |
Add x86_64 support to the optimizing compiler.
Change-Id: I4462d9ae15be56c4a3dc1bd4d1c0c6548c1b94be
Diffstat (limited to 'compiler/optimizing/codegen_test.cc')
-rw-r--r-- | compiler/optimizing/codegen_test.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 8ee775cbe1..3b91ca15f4 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -47,6 +47,15 @@ class InternalCodeAllocator : public CodeAllocator { DISALLOW_COPY_AND_ASSIGN(InternalCodeAllocator); }; +static void Run(const InternalCodeAllocator& allocator, bool has_result, int32_t expected) { + typedef int32_t (*fptr)(); + CommonCompilerTest::MakeExecutable(allocator.GetMemory(), allocator.GetSize()); + int32_t result = reinterpret_cast<fptr>(allocator.GetMemory())(); + if (has_result) { + CHECK_EQ(result, expected); + } +} + static void TestCode(const uint16_t* data, bool has_result = false, int32_t expected = 0) { ArenaPool pool; ArenaAllocator arena(&pool); @@ -55,24 +64,23 @@ static void TestCode(const uint16_t* data, bool has_result = false, int32_t expe HGraph* graph = builder.BuildGraph(*item); ASSERT_NE(graph, nullptr); InternalCodeAllocator allocator; + CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, kX86); codegen->CompileBaseline(&allocator); - typedef int32_t (*fptr)(); #if defined(__i386__) - CommonCompilerTest::MakeExecutable(allocator.GetMemory(), allocator.GetSize()); - int32_t result = reinterpret_cast<fptr>(allocator.GetMemory())(); - if (has_result) { - CHECK_EQ(result, expected); - } + Run(allocator, has_result, expected); #endif + codegen = CodeGenerator::Create(&arena, graph, kArm); codegen->CompileBaseline(&allocator); #if defined(__arm__) - CommonCompilerTest::MakeExecutable(allocator.GetMemory(), allocator.GetSize()); - int32_t result = reinterpret_cast<fptr>(allocator.GetMemory())(); - if (has_result) { - CHECK_EQ(result, expected); - } + Run(allocator, has_result, expected); +#endif + + codegen = CodeGenerator::Create(&arena, graph, kX86_64); + codegen->CompileBaseline(&allocator); +#if defined(__x86_64__) + Run(allocator, has_result, expected); #endif } |