1 /*
2 * Copyright (C) 2016 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
17 #include "scheduler.h"
18
19 #include "base/arena_allocator.h"
20 #include "base/macros.h"
21 #include "builder.h"
22 #include "codegen_test_utils.h"
23 #include "common_compiler_test.h"
24 #include "load_store_analysis.h"
25 #include "nodes.h"
26 #include "optimizing_unit_test.h"
27 #include "pc_relative_fixups_x86.h"
28 #include "register_allocator.h"
29
30 #ifdef ART_ENABLE_CODEGEN_arm64
31 #include "scheduler_arm64.h"
32 #endif
33
34 #ifdef ART_ENABLE_CODEGEN_arm
35 #include "scheduler_arm.h"
36 #endif
37
38 namespace art HIDDEN {
39
40 // Return all combinations of ISA and code generator that are executable on
41 // hardware, or on simulator, and that we'd like to test.
GetTargetConfigs()42 static ::std::vector<CodegenTargetConfig> GetTargetConfigs() {
43 ::std::vector<CodegenTargetConfig> v;
44 ::std::vector<CodegenTargetConfig> test_config_candidates = {
45 #ifdef ART_ENABLE_CODEGEN_arm
46 // TODO: Should't this be `kThumb2` instead of `kArm` here?
47 CodegenTargetConfig(InstructionSet::kArm, create_codegen_arm_vixl32),
48 #endif
49 #ifdef ART_ENABLE_CODEGEN_arm64
50 CodegenTargetConfig(InstructionSet::kArm64, create_codegen_arm64),
51 #endif
52 #ifdef ART_ENABLE_CODEGEN_x86
53 CodegenTargetConfig(InstructionSet::kX86, create_codegen_x86),
54 #endif
55 #ifdef ART_ENABLE_CODEGEN_x86_64
56 CodegenTargetConfig(InstructionSet::kX86_64, create_codegen_x86_64),
57 #endif
58 };
59
60 for (const CodegenTargetConfig& test_config : test_config_candidates) {
61 if (CanExecute(test_config.GetInstructionSet())) {
62 v.push_back(test_config);
63 }
64 }
65
66 return v;
67 }
68
69 class SchedulerTest : public CommonCompilerTest, public OptimizingUnitTestHelper {
70 public:
SchedulerTest()71 SchedulerTest() : graph_(CreateGraph()) { }
72
73 // Build scheduling graph, and run target specific scheduling on it.
TestBuildDependencyGraphAndSchedule(HScheduler * scheduler)74 void TestBuildDependencyGraphAndSchedule(HScheduler* scheduler) {
75 HBasicBlock* entry = new (GetAllocator()) HBasicBlock(graph_);
76 HBasicBlock* block1 = new (GetAllocator()) HBasicBlock(graph_);
77 graph_->AddBlock(entry);
78 graph_->AddBlock(block1);
79 graph_->SetEntryBlock(entry);
80
81 // entry:
82 // array ParameterValue
83 // c1 IntConstant
84 // c2 IntConstant
85 // block1:
86 // add1 Add [c1, c2]
87 // add2 Add [add1, c2]
88 // mul Mul [add1, add2]
89 // div_check DivZeroCheck [add2] (env: add2, mul)
90 // div Div [add1, div_check]
91 // array_get1 ArrayGet [array, add1]
92 // array_set1 ArraySet [array, add1, add2]
93 // array_get2 ArrayGet [array, add1]
94 // array_set2 ArraySet [array, add1, add2]
95
96 HInstruction* array = new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
97 dex::TypeIndex(0),
98 0,
99 DataType::Type::kReference);
100 HInstruction* c1 = graph_->GetIntConstant(1);
101 HInstruction* c2 = graph_->GetIntConstant(10);
102 HInstruction* add1 = new (GetAllocator()) HAdd(DataType::Type::kInt32, c1, c2);
103 HInstruction* add2 = new (GetAllocator()) HAdd(DataType::Type::kInt32, add1, c2);
104 HInstruction* mul = new (GetAllocator()) HMul(DataType::Type::kInt32, add1, add2);
105 HInstruction* div_check = new (GetAllocator()) HDivZeroCheck(add2, 0);
106 HInstruction* div = new (GetAllocator()) HDiv(DataType::Type::kInt32, add1, div_check, 0);
107 HInstruction* array_get1 =
108 new (GetAllocator()) HArrayGet(array, add1, DataType::Type::kInt32, 0);
109 HInstruction* array_set1 =
110 new (GetAllocator()) HArraySet(array, add1, add2, DataType::Type::kInt32, 0);
111 HInstruction* array_get2 =
112 new (GetAllocator()) HArrayGet(array, add1, DataType::Type::kInt32, 0);
113 HInstruction* array_set2 =
114 new (GetAllocator()) HArraySet(array, add1, add2, DataType::Type::kInt32, 0);
115
116 DCHECK(div_check->CanThrow());
117
118 entry->AddInstruction(array);
119
120 HInstruction* block_instructions[] = {add1,
121 add2,
122 mul,
123 div_check,
124 div,
125 array_get1,
126 array_set1,
127 array_get2,
128 array_set2};
129 for (HInstruction* instr : block_instructions) {
130 block1->AddInstruction(instr);
131 }
132
133 HEnvironment* environment = new (GetAllocator()) HEnvironment(GetAllocator(),
134 2,
135 graph_->GetArtMethod(),
136 0,
137 div_check);
138 div_check->SetRawEnvironment(environment);
139 environment->SetRawEnvAt(0, add2);
140 add2->AddEnvUseAt(div_check->GetEnvironment(), 0);
141 environment->SetRawEnvAt(1, mul);
142 mul->AddEnvUseAt(div_check->GetEnvironment(), 1);
143
144 TestSchedulingGraph scheduling_graph(GetScopedAllocator());
145 // Instructions must be inserted in reverse order into the scheduling graph.
146 for (HInstruction* instr : ReverseRange(block_instructions)) {
147 scheduling_graph.AddNode(instr);
148 }
149
150 // Should not have dependencies cross basic blocks.
151 ASSERT_FALSE(scheduling_graph.HasImmediateDataDependency(add1, c1));
152 ASSERT_FALSE(scheduling_graph.HasImmediateDataDependency(add2, c2));
153
154 // Define-use dependency.
155 ASSERT_TRUE(scheduling_graph.HasImmediateDataDependency(add2, add1));
156 ASSERT_FALSE(scheduling_graph.HasImmediateDataDependency(add1, add2));
157 ASSERT_TRUE(scheduling_graph.HasImmediateDataDependency(div_check, add2));
158 ASSERT_FALSE(scheduling_graph.HasImmediateDataDependency(div_check, add1));
159 ASSERT_TRUE(scheduling_graph.HasImmediateDataDependency(div, div_check));
160 ASSERT_TRUE(scheduling_graph.HasImmediateDataDependency(array_set1, add1));
161 ASSERT_TRUE(scheduling_graph.HasImmediateDataDependency(array_set1, add2));
162
163 // Read and write dependencies
164 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(array_set1, array_get1));
165 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(array_set2, array_get2));
166 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(array_get2, array_set1));
167 // Unnecessary dependency is not stored, we rely on transitive dependencies.
168 // The array_set2 -> array_get2 -> array_set1 dependencies are tested above.
169 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(array_set2, array_set1));
170
171 // Env dependency.
172 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(div_check, mul));
173 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(mul, div_check));
174
175 // CanThrow.
176 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(array_set1, div_check));
177
178 // Exercise the code path of target specific scheduler and SchedulingLatencyVisitor.
179 scheduler->Schedule(graph_);
180 }
181
CompileWithRandomSchedulerAndRun(const std::vector<uint16_t> & data,bool has_result,int expected)182 void CompileWithRandomSchedulerAndRun(const std::vector<uint16_t>& data,
183 bool has_result,
184 int expected) {
185 for (CodegenTargetConfig target_config : GetTargetConfigs()) {
186 HGraph* graph = CreateCFG(data);
187
188 // Schedule the graph randomly.
189 HInstructionScheduling scheduling(graph, target_config.GetInstructionSet());
190 scheduling.Run(/*only_optimize_loop_blocks*/ false, /*schedule_randomly*/ true);
191
192 std::unique_ptr<CompilerOptions> compiler_options =
193 CommonCompilerTest::CreateCompilerOptions(target_config.GetInstructionSet(), "default");
194 RunCode(target_config,
195 *compiler_options,
196 graph,
197 [](HGraph* graph_arg) { RemoveSuspendChecks(graph_arg); },
198 has_result, expected);
199 }
200 }
201
TestDependencyGraphOnAliasingArrayAccesses(HScheduler * scheduler)202 void TestDependencyGraphOnAliasingArrayAccesses(HScheduler* scheduler) {
203 HBasicBlock* entry = new (GetAllocator()) HBasicBlock(graph_);
204 graph_->AddBlock(entry);
205 graph_->SetEntryBlock(entry);
206 graph_->BuildDominatorTree();
207
208 HInstruction* arr = new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
209 dex::TypeIndex(0),
210 0,
211 DataType::Type::kReference);
212 HInstruction* i = new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
213 dex::TypeIndex(1),
214 1,
215 DataType::Type::kInt32);
216 HInstruction* j = new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
217 dex::TypeIndex(1),
218 1,
219 DataType::Type::kInt32);
220 HInstruction* object = new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
221 dex::TypeIndex(0),
222 0,
223 DataType::Type::kReference);
224 HInstruction* c0 = graph_->GetIntConstant(0);
225 HInstruction* c1 = graph_->GetIntConstant(1);
226 HInstruction* add0 = new (GetAllocator()) HAdd(DataType::Type::kInt32, i, c0);
227 HInstruction* add1 = new (GetAllocator()) HAdd(DataType::Type::kInt32, i, c1);
228 HInstruction* sub0 = new (GetAllocator()) HSub(DataType::Type::kInt32, i, c0);
229 HInstruction* sub1 = new (GetAllocator()) HSub(DataType::Type::kInt32, i, c1);
230 HInstruction* arr_set_0 =
231 new (GetAllocator()) HArraySet(arr, c0, c0, DataType::Type::kInt32, 0);
232 HInstruction* arr_set_1 =
233 new (GetAllocator()) HArraySet(arr, c1, c0, DataType::Type::kInt32, 0);
234 HInstruction* arr_set_i = new (GetAllocator()) HArraySet(arr, i, c0, DataType::Type::kInt32, 0);
235 HInstruction* arr_set_add0 =
236 new (GetAllocator()) HArraySet(arr, add0, c0, DataType::Type::kInt32, 0);
237 HInstruction* arr_set_add1 =
238 new (GetAllocator()) HArraySet(arr, add1, c0, DataType::Type::kInt32, 0);
239 HInstruction* arr_set_sub0 =
240 new (GetAllocator()) HArraySet(arr, sub0, c0, DataType::Type::kInt32, 0);
241 HInstruction* arr_set_sub1 =
242 new (GetAllocator()) HArraySet(arr, sub1, c0, DataType::Type::kInt32, 0);
243 HInstruction* arr_set_j = new (GetAllocator()) HArraySet(arr, j, c0, DataType::Type::kInt32, 0);
244 HInstanceFieldSet* set_field10 = new (GetAllocator()) HInstanceFieldSet(object,
245 c1,
246 nullptr,
247 DataType::Type::kInt32,
248 MemberOffset(10),
249 false,
250 kUnknownFieldIndex,
251 kUnknownClassDefIndex,
252 graph_->GetDexFile(),
253 0);
254
255 HInstruction* block_instructions[] = {arr,
256 i,
257 j,
258 object,
259 add0,
260 add1,
261 sub0,
262 sub1,
263 arr_set_0,
264 arr_set_1,
265 arr_set_i,
266 arr_set_add0,
267 arr_set_add1,
268 arr_set_sub0,
269 arr_set_sub1,
270 arr_set_j,
271 set_field10};
272
273 for (HInstruction* instr : block_instructions) {
274 entry->AddInstruction(instr);
275 }
276
277 HeapLocationCollector heap_location_collector(
278 graph_, GetScopedAllocator(), LoadStoreAnalysisType::kBasic);
279 heap_location_collector.VisitBasicBlock(entry);
280 heap_location_collector.BuildAliasingMatrix();
281 TestSchedulingGraph scheduling_graph(GetScopedAllocator(), &heap_location_collector);
282
283 for (HInstruction* instr : ReverseRange(block_instructions)) {
284 // Build scheduling graph with memory access aliasing information
285 // from LSA/heap_location_collector.
286 scheduling_graph.AddNode(instr);
287 }
288
289 // LSA/HeapLocationCollector should see those ArraySet instructions.
290 ASSERT_EQ(heap_location_collector.GetNumberOfHeapLocations(), 9U);
291 ASSERT_TRUE(heap_location_collector.HasHeapStores());
292
293 // Test queries on HeapLocationCollector's aliasing matrix after load store analysis.
294 // HeapLocationCollector and SchedulingGraph should report consistent relationships.
295 size_t loc1 = HeapLocationCollector::kHeapLocationNotFound;
296 size_t loc2 = HeapLocationCollector::kHeapLocationNotFound;
297
298 // Test side effect dependency: array[0] and array[1]
299 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_0);
300 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_1);
301 ASSERT_FALSE(heap_location_collector.MayAlias(loc1, loc2));
302 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_1, arr_set_0));
303
304 // Test side effect dependency based on LSA analysis: array[i] and array[j]
305 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_i);
306 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_j);
307 ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc2));
308 // Unnecessary dependency is not stored, we rely on transitive dependencies.
309 // The arr_set_j -> arr_set_sub0 -> arr_set_add0 -> arr_set_i dependencies are tested below.
310 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_i));
311
312 // Test side effect dependency based on LSA analysis: array[i] and array[i+0]
313 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_i);
314 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_add0);
315 ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc2));
316 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(arr_set_add0, arr_set_i));
317
318 // Test side effect dependency based on LSA analysis: array[i] and array[i-0]
319 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_i);
320 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_sub0);
321 ASSERT_TRUE(heap_location_collector.MayAlias(loc1, loc2));
322 // Unnecessary dependency is not stored, we rely on transitive dependencies.
323 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_sub0, arr_set_i));
324 // Instead, we rely on arr_set_sub0 -> arr_set_add0 -> arr_set_i, the latter is tested above.
325 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(arr_set_sub0, arr_set_add0));
326
327 // Test side effect dependency based on LSA analysis: array[i] and array[i+1]
328 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_i);
329 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_add1);
330 ASSERT_FALSE(heap_location_collector.MayAlias(loc1, loc2));
331 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_add1, arr_set_i));
332
333 // Test side effect dependency based on LSA analysis: array[i+1] and array[i-1]
334 loc1 = heap_location_collector.GetArrayHeapLocation(arr_set_add1);
335 loc2 = heap_location_collector.GetArrayHeapLocation(arr_set_sub1);
336 ASSERT_FALSE(heap_location_collector.MayAlias(loc1, loc2));
337 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_sub1, arr_set_add1));
338
339 // Test side effect dependency based on LSA analysis: array[j] and all others array accesses
340 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_sub0));
341 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_add1));
342 ASSERT_TRUE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_sub1));
343 // Unnecessary dependencies are not stored, we rely on transitive dependencies.
344 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_i));
345 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, arr_set_add0));
346
347 // Test that ArraySet and FieldSet should not have side effect dependency
348 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_i, set_field10));
349 ASSERT_FALSE(scheduling_graph.HasImmediateOtherDependency(arr_set_j, set_field10));
350
351 // Exercise target specific scheduler and SchedulingLatencyVisitor.
352 scheduler->Schedule(graph_);
353 }
354
355 class TestSchedulingGraph : public SchedulingGraph {
356 public:
TestSchedulingGraph(ScopedArenaAllocator * allocator,const HeapLocationCollector * heap_location_collector=nullptr)357 explicit TestSchedulingGraph(ScopedArenaAllocator* allocator,
358 const HeapLocationCollector *heap_location_collector = nullptr)
359 : SchedulingGraph(allocator, heap_location_collector) {}
360
HasImmediateDataDependency(const HInstruction * instruction,const HInstruction * other_instruction) const361 bool HasImmediateDataDependency(const HInstruction* instruction,
362 const HInstruction* other_instruction) const {
363 const SchedulingNode* node = GetNode(instruction);
364 const SchedulingNode* other = GetNode(other_instruction);
365 if (node == nullptr || other == nullptr) {
366 // Both instructions must be in current basic block, i.e. the SchedulingGraph can see their
367 // corresponding SchedulingNode in the graph, and tell whether there is a dependency.
368 // Otherwise there is no dependency from SchedulingGraph's perspective, for example,
369 // instruction and other_instruction are in different basic blocks.
370 return false;
371 }
372 return node->HasDataDependency(other);
373 }
374
HasImmediateOtherDependency(const HInstruction * instruction,const HInstruction * other_instruction) const375 bool HasImmediateOtherDependency(const HInstruction* instruction,
376 const HInstruction* other_instruction) const {
377 const SchedulingNode* node = GetNode(instruction);
378 const SchedulingNode* other = GetNode(other_instruction);
379 if (node == nullptr || other == nullptr) {
380 // Both instructions must be in current basic block, i.e. the SchedulingGraph can see their
381 // corresponding SchedulingNode in the graph, and tell whether there is a dependency.
382 // Otherwise there is no dependency from SchedulingGraph's perspective, for example,
383 // instruction and other_instruction are in different basic blocks.
384 return false;
385 }
386 return node->HasOtherDependency(other);
387 }
388 };
389
390 HGraph* graph_;
391 };
392
393 #if defined(ART_ENABLE_CODEGEN_arm64)
TEST_F(SchedulerTest,DependencyGraphAndSchedulerARM64)394 TEST_F(SchedulerTest, DependencyGraphAndSchedulerARM64) {
395 CriticalPathSchedulingNodeSelector critical_path_selector;
396 arm64::HSchedulerARM64 scheduler(&critical_path_selector);
397 TestBuildDependencyGraphAndSchedule(&scheduler);
398 }
399
TEST_F(SchedulerTest,ArrayAccessAliasingARM64)400 TEST_F(SchedulerTest, ArrayAccessAliasingARM64) {
401 CriticalPathSchedulingNodeSelector critical_path_selector;
402 arm64::HSchedulerARM64 scheduler(&critical_path_selector);
403 TestDependencyGraphOnAliasingArrayAccesses(&scheduler);
404 }
405 #endif
406
407 #if defined(ART_ENABLE_CODEGEN_arm)
TEST_F(SchedulerTest,DependencyGraphAndSchedulerARM)408 TEST_F(SchedulerTest, DependencyGraphAndSchedulerARM) {
409 CriticalPathSchedulingNodeSelector critical_path_selector;
410 arm::SchedulingLatencyVisitorARM arm_latency_visitor(/*CodeGenerator*/ nullptr);
411 arm::HSchedulerARM scheduler(&critical_path_selector, &arm_latency_visitor);
412 TestBuildDependencyGraphAndSchedule(&scheduler);
413 }
414
TEST_F(SchedulerTest,ArrayAccessAliasingARM)415 TEST_F(SchedulerTest, ArrayAccessAliasingARM) {
416 CriticalPathSchedulingNodeSelector critical_path_selector;
417 arm::SchedulingLatencyVisitorARM arm_latency_visitor(/*CodeGenerator*/ nullptr);
418 arm::HSchedulerARM scheduler(&critical_path_selector, &arm_latency_visitor);
419 TestDependencyGraphOnAliasingArrayAccesses(&scheduler);
420 }
421 #endif
422
TEST_F(SchedulerTest,RandomScheduling)423 TEST_F(SchedulerTest, RandomScheduling) {
424 //
425 // Java source: crafted code to make sure (random) scheduling should get correct result.
426 //
427 // int result = 0;
428 // float fr = 10.0f;
429 // for (int i = 1; i < 10; i++) {
430 // fr ++;
431 // int t1 = result >> i;
432 // int t2 = result * i;
433 // result = result + t1 - t2;
434 // fr = fr / i;
435 // result += (int)fr;
436 // }
437 // return result;
438 //
439 const std::vector<uint16_t> data = SIX_REGISTERS_CODE_ITEM(
440 Instruction::CONST_4 | 0 << 12 | 2 << 8, // const/4 v2, #int 0
441 Instruction::CONST_HIGH16 | 0 << 8, 0x4120, // const/high16 v0, #float 10.0 // #41200000
442 Instruction::CONST_4 | 1 << 12 | 1 << 8, // const/4 v1, #int 1
443 Instruction::CONST_16 | 5 << 8, 0x000a, // const/16 v5, #int 10
444 Instruction::IF_GE | 5 << 12 | 1 << 8, 0x0014, // if-ge v1, v5, 001a // +0014
445 Instruction::CONST_HIGH16 | 5 << 8, 0x3f80, // const/high16 v5, #float 1.0 // #3f800000
446 Instruction::ADD_FLOAT_2ADDR | 5 << 12 | 0 << 8, // add-float/2addr v0, v5
447 Instruction::SHR_INT | 3 << 8, 1 << 8 | 2 , // shr-int v3, v2, v1
448 Instruction::MUL_INT | 4 << 8, 1 << 8 | 2, // mul-int v4, v2, v1
449 Instruction::ADD_INT | 5 << 8, 3 << 8 | 2, // add-int v5, v2, v3
450 Instruction::SUB_INT | 2 << 8, 4 << 8 | 5, // sub-int v2, v5, v4
451 Instruction::INT_TO_FLOAT | 1 << 12 | 5 << 8, // int-to-float v5, v1
452 Instruction::DIV_FLOAT_2ADDR | 5 << 12 | 0 << 8, // div-float/2addr v0, v5
453 Instruction::FLOAT_TO_INT | 0 << 12 | 5 << 8, // float-to-int v5, v0
454 Instruction::ADD_INT_2ADDR | 5 << 12 | 2 << 8, // add-int/2addr v2, v5
455 Instruction::ADD_INT_LIT8 | 1 << 8, 1 << 8 | 1, // add-int/lit8 v1, v1, #int 1 // #01
456 Instruction::GOTO | 0xeb << 8, // goto 0004 // -0015
457 Instruction::RETURN | 2 << 8); // return v2
458
459 constexpr int kNumberOfRuns = 10;
460 for (int i = 0; i < kNumberOfRuns; ++i) {
461 CompileWithRandomSchedulerAndRun(data, true, 138774);
462 }
463 }
464
465 } // namespace art
466