From 9cf35523764d829ae0470dae2d5dd99be469c841 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Mon, 9 Jun 2014 18:40:10 +0100 Subject: Add x86_64 support to the optimizing compiler. Change-Id: I4462d9ae15be56c4a3dc1bd4d1c0c6548c1b94be --- compiler/optimizing/codegen_test.cc | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'compiler/optimizing/codegen_test.cc') 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(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(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(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 } -- cgit v1.2.3-59-g8ed1b