blob: 34d8bfeeae06da7c13e2f7bf0ae86bfbca24bbc3 [file] [log] [blame]
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +00001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Nicolas Geoffray360231a2014-10-08 21:07:48 +010017#include <functional>
18
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000019#include "builder.h"
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010020#include "code_generator_arm.h"
Alexandre Rames5319def2014-10-23 10:03:10 +010021#include "code_generator_arm64.h"
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010022#include "code_generator_x86.h"
23#include "code_generator_x86_64.h"
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000024#include "common_compiler_test.h"
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +000025#include "dex_file.h"
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000026#include "dex_instruction.h"
27#include "instruction_set.h"
28#include "nodes.h"
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +000029#include "optimizing_unit_test.h"
Nicolas Geoffray360231a2014-10-08 21:07:48 +010030#include "prepare_for_register_allocation.h"
31#include "register_allocator.h"
32#include "ssa_liveness_analysis.h"
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000033
34#include "gtest/gtest.h"
35
36namespace art {
37
Nicolas Geoffray787c3072014-03-17 10:20:19 +000038class InternalCodeAllocator : public CodeAllocator {
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000039 public:
Nicolas Geoffray787c3072014-03-17 10:20:19 +000040 InternalCodeAllocator() { }
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000041
42 virtual uint8_t* Allocate(size_t size) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +000043 size_ = size;
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000044 memory_.reset(new uint8_t[size]);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000045 return memory_.get();
46 }
47
Nicolas Geoffray787c3072014-03-17 10:20:19 +000048 size_t GetSize() const { return size_; }
49 uint8_t* GetMemory() const { return memory_.get(); }
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000050
51 private:
Nicolas Geoffray787c3072014-03-17 10:20:19 +000052 size_t size_;
Ian Rogers700a4022014-05-19 16:49:03 -070053 std::unique_ptr<uint8_t[]> memory_;
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000054
Nicolas Geoffray787c3072014-03-17 10:20:19 +000055 DISALLOW_COPY_AND_ASSIGN(InternalCodeAllocator);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +000056};
57
Nicolas Geoffray8d486732014-07-16 16:23:40 +010058static void Run(const InternalCodeAllocator& allocator,
59 const CodeGenerator& codegen,
60 bool has_result,
61 int32_t expected) {
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010062 typedef int32_t (*fptr)();
63 CommonCompilerTest::MakeExecutable(allocator.GetMemory(), allocator.GetSize());
Dave Allison20dfc792014-06-16 20:44:29 -070064 fptr f = reinterpret_cast<fptr>(allocator.GetMemory());
Nicolas Geoffray8d486732014-07-16 16:23:40 +010065 if (codegen.GetInstructionSet() == kThumb2) {
66 // For thumb we need the bottom bit set.
67 f = reinterpret_cast<fptr>(reinterpret_cast<uintptr_t>(f) + 1);
68 }
Dave Allison20dfc792014-06-16 20:44:29 -070069 int32_t result = f();
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010070 if (has_result) {
Nicolas Geoffray360231a2014-10-08 21:07:48 +010071 ASSERT_EQ(result, expected);
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010072 }
73}
74
Nicolas Geoffray360231a2014-10-08 21:07:48 +010075static void RunCodeBaseline(HGraph* graph, bool has_result, int32_t expected) {
Nicolas Geoffray787c3072014-03-17 10:20:19 +000076 InternalCodeAllocator allocator;
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010077
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010078 x86::CodeGeneratorX86 codegenX86(graph);
Nicolas Geoffray73e80c32014-07-22 17:47:56 +010079 // We avoid doing a stack overflow check that requires the runtime being setup,
80 // by making sure the compiler knows the methods we are running are leaf methods.
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010081 codegenX86.CompileBaseline(&allocator, true);
82 if (kRuntimeISA == kX86) {
83 Run(allocator, codegenX86, has_result, expected);
84 }
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010085
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010086 arm::CodeGeneratorARM codegenARM(graph);
87 codegenARM.CompileBaseline(&allocator, true);
88 if (kRuntimeISA == kArm || kRuntimeISA == kThumb2) {
89 Run(allocator, codegenARM, has_result, expected);
90 }
Nicolas Geoffray9cf35522014-06-09 18:40:10 +010091
Nicolas Geoffray8a16d972014-09-11 10:30:02 +010092 x86_64::CodeGeneratorX86_64 codegenX86_64(graph);
93 codegenX86_64.CompileBaseline(&allocator, true);
94 if (kRuntimeISA == kX86_64) {
95 Run(allocator, codegenX86_64, has_result, expected);
96 }
Alexandre Rames5319def2014-10-23 10:03:10 +010097
98 arm64::CodeGeneratorARM64 codegenARM64(graph);
99 codegenARM64.CompileBaseline(&allocator, true);
100 if (kRuntimeISA == kArm64) {
101 Run(allocator, codegenARM64, has_result, expected);
102 }
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000103}
104
Nicolas Geoffray360231a2014-10-08 21:07:48 +0100105static void RunCodeOptimized(CodeGenerator* codegen,
106 HGraph* graph,
107 std::function<void(HGraph*)> hook_before_codegen,
108 bool has_result,
109 int32_t expected) {
110 SsaLivenessAnalysis liveness(*graph, codegen);
111 liveness.Analyze();
112
113 RegisterAllocator register_allocator(graph->GetArena(), codegen, liveness);
114 register_allocator.AllocateRegisters();
115 hook_before_codegen(graph);
116
117 InternalCodeAllocator allocator;
118 codegen->CompileOptimized(&allocator);
119 Run(allocator, *codegen, has_result, expected);
120}
121
122static void RunCodeOptimized(HGraph* graph,
123 std::function<void(HGraph*)> hook_before_codegen,
124 bool has_result,
125 int32_t expected) {
126 if (kRuntimeISA == kX86) {
127 x86::CodeGeneratorX86 codegenX86(graph);
128 RunCodeOptimized(&codegenX86, graph, hook_before_codegen, has_result, expected);
129 } else if (kRuntimeISA == kArm || kRuntimeISA == kThumb2) {
130 arm::CodeGeneratorARM codegenARM(graph);
131 RunCodeOptimized(&codegenARM, graph, hook_before_codegen, has_result, expected);
132 } else if (kRuntimeISA == kX86_64) {
133 x86_64::CodeGeneratorX86_64 codegenX86_64(graph);
134 RunCodeOptimized(&codegenX86_64, graph, hook_before_codegen, has_result, expected);
135 }
136}
137
138static void TestCode(const uint16_t* data, bool has_result = false, int32_t expected = 0) {
139 ArenaPool pool;
140 ArenaAllocator arena(&pool);
141 HGraphBuilder builder(&arena);
142 const DexFile::CodeItem* item = reinterpret_cast<const DexFile::CodeItem*>(data);
143 HGraph* graph = builder.BuildGraph(*item);
Nicolas Geoffray360231a2014-10-08 21:07:48 +0100144 ASSERT_NE(graph, nullptr);
Calin Juravle039b6e22014-10-23 12:32:11 +0100145 // Remove suspend checks, they cannot be executed in this context.
Calin Juravle48dee042014-10-22 15:54:12 +0100146 RemoveSuspendChecks(graph);
Nicolas Geoffray360231a2014-10-08 21:07:48 +0100147 RunCodeBaseline(graph, has_result, expected);
148}
149
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000150TEST(CodegenTest, ReturnVoid) {
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000151 const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(Instruction::RETURN_VOID);
152 TestCode(data);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000153}
154
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000155TEST(CodegenTest, CFG1) {
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000156 const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000157 Instruction::GOTO | 0x100,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000158 Instruction::RETURN_VOID);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000159
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000160 TestCode(data);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000161}
162
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000163TEST(CodegenTest, CFG2) {
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000164 const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000165 Instruction::GOTO | 0x100,
166 Instruction::GOTO | 0x100,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000167 Instruction::RETURN_VOID);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000168
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000169 TestCode(data);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000170}
171
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000172TEST(CodegenTest, CFG3) {
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000173 const uint16_t data1[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000174 Instruction::GOTO | 0x200,
175 Instruction::RETURN_VOID,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000176 Instruction::GOTO | 0xFF00);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000177
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000178 TestCode(data1);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000179
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000180 const uint16_t data2[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000181 Instruction::GOTO_16, 3,
182 Instruction::RETURN_VOID,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000183 Instruction::GOTO_16, 0xFFFF);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000184
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000185 TestCode(data2);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000186
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000187 const uint16_t data3[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000188 Instruction::GOTO_32, 4, 0,
189 Instruction::RETURN_VOID,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000190 Instruction::GOTO_32, 0xFFFF, 0xFFFF);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000191
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000192 TestCode(data3);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000193}
194
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000195TEST(CodegenTest, CFG4) {
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000196 const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000197 Instruction::RETURN_VOID,
198 Instruction::GOTO | 0x100,
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000199 Instruction::GOTO | 0xFE00);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000200
Nicolas Geoffray3ff386a2014-03-04 14:46:47 +0000201 TestCode(data);
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000202}
203
Nicolas Geoffraybab4ed72014-03-11 17:53:17 +0000204TEST(CodegenTest, CFG5) {
205 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
206 Instruction::CONST_4 | 0 | 0,
207 Instruction::IF_EQ, 3,
208 Instruction::GOTO | 0x100,
209 Instruction::RETURN_VOID);
210
211 TestCode(data);
212}
213
214TEST(CodegenTest, IntConstant) {
215 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
216 Instruction::CONST_4 | 0 | 0,
217 Instruction::RETURN_VOID);
218
219 TestCode(data);
220}
221
222TEST(CodegenTest, Return1) {
223 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
224 Instruction::CONST_4 | 0 | 0,
225 Instruction::RETURN | 0);
226
227 TestCode(data, true, 0);
228}
229
230TEST(CodegenTest, Return2) {
231 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
232 Instruction::CONST_4 | 0 | 0,
233 Instruction::CONST_4 | 0 | 1 << 8,
234 Instruction::RETURN | 1 << 8);
235
236 TestCode(data, true, 0);
237}
238
239TEST(CodegenTest, Return3) {
240 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
241 Instruction::CONST_4 | 0 | 0,
242 Instruction::CONST_4 | 1 << 8 | 1 << 12,
243 Instruction::RETURN | 1 << 8);
244
245 TestCode(data, true, 1);
246}
247
248TEST(CodegenTest, ReturnIf1) {
249 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
250 Instruction::CONST_4 | 0 | 0,
251 Instruction::CONST_4 | 1 << 8 | 1 << 12,
252 Instruction::IF_EQ, 3,
253 Instruction::RETURN | 0 << 8,
254 Instruction::RETURN | 1 << 8);
255
256 TestCode(data, true, 1);
257}
258
259TEST(CodegenTest, ReturnIf2) {
260 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
261 Instruction::CONST_4 | 0 | 0,
262 Instruction::CONST_4 | 1 << 8 | 1 << 12,
263 Instruction::IF_EQ | 0 << 4 | 1 << 8, 3,
264 Instruction::RETURN | 0 << 8,
265 Instruction::RETURN | 1 << 8);
266
267 TestCode(data, true, 0);
268}
269
Roland Levillain1cc5f2512014-10-22 18:06:21 +0100270// Exercise bit-wise (one's complement) not-int instruction.
271#define NOT_INT_TEST(TEST_NAME, INPUT, EXPECTED_OUTPUT) \
272TEST(CodegenTest, TEST_NAME) { \
273 const int32_t input = INPUT; \
274 const uint16_t input_lo = input & 0x0000FFFF; \
275 const uint16_t input_hi = input >> 16; \
276 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( \
277 Instruction::CONST | 0 << 8, input_lo, input_hi, \
278 Instruction::NOT_INT | 1 << 8 | 0 << 12 , \
279 Instruction::RETURN | 1 << 8); \
280 \
281 TestCode(data, true, EXPECTED_OUTPUT); \
282}
283
284NOT_INT_TEST(ReturnNotIntMinus2, -2, 1)
285NOT_INT_TEST(ReturnNotIntMinus1, -1, 0)
286NOT_INT_TEST(ReturnNotInt0, 0, -1)
287NOT_INT_TEST(ReturnNotInt1, 1, -2)
288NOT_INT_TEST(ReturnNotIntINT_MIN, -2147483648, 2147483647) // (2^31) - 1
289NOT_INT_TEST(ReturnNotIntINT_MINPlus1, -2147483647, 2147483646) // (2^31) - 2
290NOT_INT_TEST(ReturnNotIntINT_MAXMinus1, 2147483646, -2147483647) // -(2^31) - 1
291NOT_INT_TEST(ReturnNotIntINT_MAX, 2147483647, -2147483648) // -(2^31)
292
293#undef NOT_INT_TEST
294
Nicolas Geoffrayd8ee7372014-03-28 15:43:40 +0000295TEST(CodegenTest, ReturnAdd1) {
296 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
297 Instruction::CONST_4 | 3 << 12 | 0,
298 Instruction::CONST_4 | 4 << 12 | 1 << 8,
299 Instruction::ADD_INT, 1 << 8 | 0,
300 Instruction::RETURN);
301
302 TestCode(data, true, 7);
303}
304
305TEST(CodegenTest, ReturnAdd2) {
306 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM(
307 Instruction::CONST_4 | 3 << 12 | 0,
308 Instruction::CONST_4 | 4 << 12 | 1 << 8,
309 Instruction::ADD_INT_2ADDR | 1 << 12,
310 Instruction::RETURN);
311
312 TestCode(data, true, 7);
313}
314
315TEST(CodegenTest, ReturnAdd3) {
316 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
317 Instruction::CONST_4 | 4 << 12 | 0 << 8,
318 Instruction::ADD_INT_LIT8, 3 << 8 | 0,
319 Instruction::RETURN);
320
321 TestCode(data, true, 7);
322}
323
324TEST(CodegenTest, ReturnAdd4) {
325 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
326 Instruction::CONST_4 | 4 << 12 | 0 << 8,
327 Instruction::ADD_INT_LIT16, 3,
328 Instruction::RETURN);
329
330 TestCode(data, true, 7);
331}
332
Nicolas Geoffray360231a2014-10-08 21:07:48 +0100333TEST(CodegenTest, NonMaterializedCondition) {
334 ArenaPool pool;
335 ArenaAllocator allocator(&pool);
336
337 HGraph* graph = new (&allocator) HGraph(&allocator);
338 HBasicBlock* entry = new (&allocator) HBasicBlock(graph);
339 graph->AddBlock(entry);
340 graph->SetEntryBlock(entry);
341 entry->AddInstruction(new (&allocator) HGoto());
342
343 HBasicBlock* first_block = new (&allocator) HBasicBlock(graph);
344 graph->AddBlock(first_block);
345 entry->AddSuccessor(first_block);
346 HIntConstant* constant0 = new (&allocator) HIntConstant(0);
347 entry->AddInstruction(constant0);
348 HIntConstant* constant1 = new (&allocator) HIntConstant(1);
349 entry->AddInstruction(constant1);
350 HEqual* equal = new (&allocator) HEqual(constant0, constant0);
351 first_block->AddInstruction(equal);
352 first_block->AddInstruction(new (&allocator) HIf(equal));
353
354 HBasicBlock* then = new (&allocator) HBasicBlock(graph);
355 HBasicBlock* else_ = new (&allocator) HBasicBlock(graph);
356 HBasicBlock* exit = new (&allocator) HBasicBlock(graph);
357
358 graph->AddBlock(then);
359 graph->AddBlock(else_);
360 graph->AddBlock(exit);
361 first_block->AddSuccessor(then);
362 first_block->AddSuccessor(else_);
363 then->AddSuccessor(exit);
364 else_->AddSuccessor(exit);
365
366 exit->AddInstruction(new (&allocator) HExit());
367 then->AddInstruction(new (&allocator) HReturn(constant0));
368 else_->AddInstruction(new (&allocator) HReturn(constant1));
369
370 ASSERT_TRUE(equal->NeedsMaterialization());
371 graph->BuildDominatorTree();
372 PrepareForRegisterAllocation(graph).Run();
373 ASSERT_FALSE(equal->NeedsMaterialization());
374
375 auto hook_before_codegen = [](HGraph* graph) {
376 HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0);
377 HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena());
378 block->InsertInstructionBefore(move, block->GetLastInstruction());
379 };
380
381 RunCodeOptimized(graph, hook_before_codegen, true, 0);
382}
383
Calin Juravle34bacdf2014-10-07 20:23:36 +0100384#define MUL_TEST(TYPE, TEST_NAME) \
385 TEST(CodegenTest, Return ## TEST_NAME) { \
386 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( \
387 Instruction::CONST_4 | 3 << 12 | 0, \
388 Instruction::CONST_4 | 4 << 12 | 1 << 8, \
389 Instruction::MUL_ ## TYPE, 1 << 8 | 0, \
390 Instruction::RETURN); \
391 \
392 TestCode(data, true, 12); \
393 } \
394 \
395 TEST(CodegenTest, Return ## TEST_NAME ## 2addr) { \
396 const uint16_t data[] = TWO_REGISTERS_CODE_ITEM( \
397 Instruction::CONST_4 | 3 << 12 | 0, \
398 Instruction::CONST_4 | 4 << 12 | 1 << 8, \
399 Instruction::MUL_ ## TYPE ## _2ADDR | 1 << 12, \
400 Instruction::RETURN); \
401 \
402 TestCode(data, true, 12); \
403 }
404
Alexandre Rames5319def2014-10-23 10:03:10 +0100405#if !defined(__aarch64__)
Calin Juravle34bacdf2014-10-07 20:23:36 +0100406MUL_TEST(INT, MulInt);
407MUL_TEST(LONG, MulLong);
Alexandre Rames5319def2014-10-23 10:03:10 +0100408#endif
Calin Juravle34bacdf2014-10-07 20:23:36 +0100409
Alexandre Rames5319def2014-10-23 10:03:10 +0100410#if defined(__aarch64__)
411TEST(CodegenTest, DISABLED_ReturnMulIntLit8) {
412#else
Calin Juravle34bacdf2014-10-07 20:23:36 +0100413TEST(CodegenTest, ReturnMulIntLit8) {
Alexandre Rames5319def2014-10-23 10:03:10 +0100414#endif
Calin Juravle34bacdf2014-10-07 20:23:36 +0100415 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
416 Instruction::CONST_4 | 4 << 12 | 0 << 8,
417 Instruction::MUL_INT_LIT8, 3 << 8 | 0,
418 Instruction::RETURN);
419
420 TestCode(data, true, 12);
421}
422
Alexandre Rames5319def2014-10-23 10:03:10 +0100423#if defined(__aarch64__)
424TEST(CodegenTest, DISABLED_ReturnMulIntLit16) {
425#else
Calin Juravle34bacdf2014-10-07 20:23:36 +0100426TEST(CodegenTest, ReturnMulIntLit16) {
Alexandre Rames5319def2014-10-23 10:03:10 +0100427#endif
Calin Juravle34bacdf2014-10-07 20:23:36 +0100428 const uint16_t data[] = ONE_REGISTER_CODE_ITEM(
429 Instruction::CONST_4 | 4 << 12 | 0 << 8,
430 Instruction::MUL_INT_LIT16, 3,
431 Instruction::RETURN);
432
433 TestCode(data, true, 12);
434}
435
436
Nicolas Geoffrayd4dd2552014-02-28 10:23:58 +0000437} // namespace art