David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 <memory> |
| 18 | #include <vector> |
| 19 | |
| 20 | #include "arch/instruction_set.h" |
Andreas Gampe | 2a5d728 | 2018-01-02 11:53:35 -0800 | [diff] [blame] | 21 | #include "base/runtime_debug.h" |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 22 | #include "cfi_test.h" |
Vladimir Marko | 3a21e38 | 2016-09-02 12:38:38 +0100 | [diff] [blame] | 23 | #include "driver/compiler_options.h" |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 24 | #include "gtest/gtest.h" |
| 25 | #include "optimizing/code_generator.h" |
Nicolas Geoffray | 0a23d74 | 2015-05-07 11:57:35 +0100 | [diff] [blame] | 26 | #include "optimizing/optimizing_unit_test.h" |
Andreas Gampe | 217488a | 2017-09-18 08:34:42 -0700 | [diff] [blame] | 27 | #include "read_barrier_config.h" |
Nicolas Geoffray | 467d94a | 2017-03-16 10:24:17 +0000 | [diff] [blame] | 28 | #include "utils/arm/assembler_arm_vixl.h" |
Andreas Gampe | 8cf9cb3 | 2017-07-19 09:28:38 -0700 | [diff] [blame] | 29 | #include "utils/assembler.h" |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 30 | #include "utils/mips/assembler_mips.h" |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 31 | #include "utils/mips64/assembler_mips64.h" |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 32 | |
| 33 | #include "optimizing/optimizing_cfi_test_expected.inc" |
| 34 | |
Scott Wakeling | 90ab673 | 2016-12-08 10:25:03 +0000 | [diff] [blame] | 35 | namespace vixl32 = vixl::aarch32; |
| 36 | |
| 37 | using vixl32::r0; |
Scott Wakeling | 90ab673 | 2016-12-08 10:25:03 +0000 | [diff] [blame] | 38 | |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 39 | namespace art { |
| 40 | |
| 41 | // Run the tests only on host. |
Bilyan Borisov | bb661c0 | 2016-04-04 16:27:32 +0100 | [diff] [blame] | 42 | #ifndef ART_TARGET_ANDROID |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 43 | |
Mathieu Chartier | fa3db3d | 2018-01-12 14:42:18 -0800 | [diff] [blame] | 44 | class OptimizingCFITest : public CFITest, public OptimizingUnitTestHelper { |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 45 | public: |
| 46 | // Enable this flag to generate the expected outputs. |
| 47 | static constexpr bool kGenerateExpected = false; |
| 48 | |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 49 | OptimizingCFITest() |
Vladimir Marko | ca6fff8 | 2017-10-03 14:49:14 +0100 | [diff] [blame] | 50 | : pool_and_allocator_(), |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 51 | opts_(), |
| 52 | isa_features_(), |
| 53 | graph_(nullptr), |
| 54 | code_gen_(), |
Vladimir Marko | ca6fff8 | 2017-10-03 14:49:14 +0100 | [diff] [blame] | 55 | blocks_(GetAllocator()->Adapter()) {} |
| 56 | |
| 57 | ArenaAllocator* GetAllocator() { return pool_and_allocator_.GetAllocator(); } |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 58 | |
| 59 | void SetUpFrame(InstructionSet isa) { |
Andreas Gampe | 2a5d728 | 2018-01-02 11:53:35 -0800 | [diff] [blame] | 60 | // Ensure that slow-debug is off, so that there is no unexpected read-barrier check emitted. |
| 61 | SetRuntimeDebugFlagsEnabled(false); |
| 62 | |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 63 | // Setup simple context. |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 64 | std::string error; |
Andreas Gampe | 0415b4e | 2015-01-06 15:17:07 -0800 | [diff] [blame] | 65 | isa_features_ = InstructionSetFeatures::FromVariant(isa, "default", &error); |
Mathieu Chartier | fa3db3d | 2018-01-12 14:42:18 -0800 | [diff] [blame] | 66 | graph_ = CreateGraph(); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 67 | // Generate simple frame with some spills. |
Vladimir Marko | d58b837 | 2016-04-12 18:51:43 +0100 | [diff] [blame] | 68 | code_gen_ = CodeGenerator::Create(graph_, isa, *isa_features_, opts_); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 69 | code_gen_->GetAssembler()->cfi().SetEnabled(true); |
Vladimir Marko | 174b2e2 | 2017-10-12 13:34:49 +0100 | [diff] [blame] | 70 | code_gen_->InitializeCodeGenerationData(); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 71 | const int frame_size = 64; |
| 72 | int core_reg = 0; |
| 73 | int fp_reg = 0; |
| 74 | for (int i = 0; i < 2; i++) { // Two registers of each kind. |
| 75 | for (; core_reg < 32; core_reg++) { |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 76 | if (code_gen_->IsCoreCalleeSaveRegister(core_reg)) { |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 77 | auto location = Location::RegisterLocation(core_reg); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 78 | code_gen_->AddAllocatedRegister(location); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 79 | core_reg++; |
| 80 | break; |
| 81 | } |
| 82 | } |
| 83 | for (; fp_reg < 32; fp_reg++) { |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 84 | if (code_gen_->IsFloatingPointCalleeSaveRegister(fp_reg)) { |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 85 | auto location = Location::FpuRegisterLocation(fp_reg); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 86 | code_gen_->AddAllocatedRegister(location); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 87 | fp_reg++; |
| 88 | break; |
| 89 | } |
| 90 | } |
| 91 | } |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 92 | code_gen_->block_order_ = &blocks_; |
| 93 | code_gen_->ComputeSpillMask(); |
| 94 | code_gen_->SetFrameSize(frame_size); |
| 95 | code_gen_->GenerateFrameEntry(); |
| 96 | } |
| 97 | |
| 98 | void Finish() { |
| 99 | code_gen_->GenerateFrameExit(); |
| 100 | code_gen_->Finalize(&code_allocator_); |
| 101 | } |
| 102 | |
| 103 | void Check(InstructionSet isa, |
| 104 | const char* isa_str, |
| 105 | const std::vector<uint8_t>& expected_asm, |
| 106 | const std::vector<uint8_t>& expected_cfi) { |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 107 | // Get the outputs. |
Vladimir Marko | 5806a9e | 2018-04-04 17:23:28 +0000 | [diff] [blame] | 108 | const std::vector<uint8_t>& actual_asm = code_allocator_.GetMemory(); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 109 | Assembler* opt_asm = code_gen_->GetAssembler(); |
Vladimir Marko | 5806a9e | 2018-04-04 17:23:28 +0000 | [diff] [blame] | 110 | const std::vector<uint8_t>& actual_cfi = *(opt_asm->cfi().data()); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 111 | |
| 112 | if (kGenerateExpected) { |
| 113 | GenerateExpected(stdout, isa, isa_str, actual_asm, actual_cfi); |
| 114 | } else { |
Vladimir Marko | 5806a9e | 2018-04-04 17:23:28 +0000 | [diff] [blame] | 115 | EXPECT_EQ(expected_asm, actual_asm); |
| 116 | EXPECT_EQ(expected_cfi, actual_cfi); |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 117 | } |
| 118 | } |
David Srbecky | 46325a0 | 2015-04-09 22:51:56 +0100 | [diff] [blame] | 119 | |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 120 | void TestImpl(InstructionSet isa, const char* |
| 121 | isa_str, |
| 122 | const std::vector<uint8_t>& expected_asm, |
| 123 | const std::vector<uint8_t>& expected_cfi) { |
| 124 | SetUpFrame(isa); |
| 125 | Finish(); |
| 126 | Check(isa, isa_str, expected_asm, expected_cfi); |
| 127 | } |
| 128 | |
| 129 | CodeGenerator* GetCodeGenerator() { |
| 130 | return code_gen_.get(); |
| 131 | } |
| 132 | |
David Srbecky | 46325a0 | 2015-04-09 22:51:56 +0100 | [diff] [blame] | 133 | private: |
| 134 | class InternalCodeAllocator : public CodeAllocator { |
| 135 | public: |
| 136 | InternalCodeAllocator() {} |
| 137 | |
| 138 | virtual uint8_t* Allocate(size_t size) { |
| 139 | memory_.resize(size); |
| 140 | return memory_.data(); |
| 141 | } |
| 142 | |
Vladimir Marko | 5806a9e | 2018-04-04 17:23:28 +0000 | [diff] [blame] | 143 | const std::vector<uint8_t>& GetMemory() { return memory_; } |
David Srbecky | 46325a0 | 2015-04-09 22:51:56 +0100 | [diff] [blame] | 144 | |
| 145 | private: |
| 146 | std::vector<uint8_t> memory_; |
| 147 | |
| 148 | DISALLOW_COPY_AND_ASSIGN(InternalCodeAllocator); |
| 149 | }; |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 150 | |
Vladimir Marko | ca6fff8 | 2017-10-03 14:49:14 +0100 | [diff] [blame] | 151 | ArenaPoolAndAllocator pool_and_allocator_; |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 152 | CompilerOptions opts_; |
| 153 | std::unique_ptr<const InstructionSetFeatures> isa_features_; |
| 154 | HGraph* graph_; |
| 155 | std::unique_ptr<CodeGenerator> code_gen_; |
| 156 | ArenaVector<HBasicBlock*> blocks_; |
| 157 | InternalCodeAllocator code_allocator_; |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 158 | }; |
| 159 | |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 160 | #define TEST_ISA(isa) \ |
| 161 | TEST_F(OptimizingCFITest, isa) { \ |
| 162 | std::vector<uint8_t> expected_asm( \ |
| 163 | expected_asm_##isa, \ |
| 164 | expected_asm_##isa + arraysize(expected_asm_##isa)); \ |
| 165 | std::vector<uint8_t> expected_cfi( \ |
| 166 | expected_cfi_##isa, \ |
| 167 | expected_cfi_##isa + arraysize(expected_cfi_##isa)); \ |
| 168 | TestImpl(InstructionSet::isa, #isa, expected_asm, expected_cfi); \ |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 169 | } |
| 170 | |
Scott Wakeling | 90ab673 | 2016-12-08 10:25:03 +0000 | [diff] [blame] | 171 | #ifdef ART_ENABLE_CODEGEN_arm |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 172 | TEST_ISA(kThumb2) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 173 | #endif |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 174 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 175 | #ifdef ART_ENABLE_CODEGEN_arm64 |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 176 | // Run the tests for ARM64 only with Baker read barriers, as the |
| 177 | // expected generated code saves and restore X21 and X22 (instead of |
| 178 | // X20 and X21), as X20 is used as Marking Register in the Baker read |
| 179 | // barrier configuration, and as such is removed from the set of |
| 180 | // callee-save registers in the ARM64 code generator of the Optimizing |
| 181 | // compiler. |
| 182 | #if defined(USE_READ_BARRIER) && defined(USE_BAKER_READ_BARRIER) |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 183 | TEST_ISA(kArm64) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 184 | #endif |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 185 | #endif |
| 186 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 187 | #ifdef ART_ENABLE_CODEGEN_x86 |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 188 | TEST_ISA(kX86) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 189 | #endif |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 190 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 191 | #ifdef ART_ENABLE_CODEGEN_x86_64 |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 192 | TEST_ISA(kX86_64) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 193 | #endif |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 194 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 195 | #ifdef ART_ENABLE_CODEGEN_mips |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 196 | TEST_ISA(kMips) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 197 | #endif |
Roland Levillain | af24def | 2017-07-12 13:18:01 +0100 | [diff] [blame] | 198 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 199 | #ifdef ART_ENABLE_CODEGEN_mips64 |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 200 | TEST_ISA(kMips64) |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 201 | #endif |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 202 | |
Scott Wakeling | 90ab673 | 2016-12-08 10:25:03 +0000 | [diff] [blame] | 203 | #ifdef ART_ENABLE_CODEGEN_arm |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 204 | TEST_F(OptimizingCFITest, kThumb2Adjust) { |
| 205 | std::vector<uint8_t> expected_asm( |
| 206 | expected_asm_kThumb2_adjust, |
| 207 | expected_asm_kThumb2_adjust + arraysize(expected_asm_kThumb2_adjust)); |
| 208 | std::vector<uint8_t> expected_cfi( |
| 209 | expected_cfi_kThumb2_adjust, |
| 210 | expected_cfi_kThumb2_adjust + arraysize(expected_cfi_kThumb2_adjust)); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 211 | SetUpFrame(InstructionSet::kThumb2); |
Scott Wakeling | 90ab673 | 2016-12-08 10:25:03 +0000 | [diff] [blame] | 212 | #define __ down_cast<arm::ArmVIXLAssembler*>(GetCodeGenerator() \ |
| 213 | ->GetAssembler())->GetVIXLAssembler()-> |
| 214 | vixl32::Label target; |
| 215 | __ CompareAndBranchIfZero(r0, &target); |
| 216 | // Push the target out of range of CBZ. |
| 217 | for (size_t i = 0; i != 65; ++i) { |
| 218 | __ Ldr(r0, vixl32::MemOperand(r0)); |
| 219 | } |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 220 | __ Bind(&target); |
| 221 | #undef __ |
| 222 | Finish(); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 223 | Check(InstructionSet::kThumb2, "kThumb2_adjust", expected_asm, expected_cfi); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 224 | } |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 225 | #endif |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 226 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 227 | #ifdef ART_ENABLE_CODEGEN_mips |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 228 | TEST_F(OptimizingCFITest, kMipsAdjust) { |
| 229 | // One NOP in delay slot, 1 << 15 NOPS have size 1 << 17 which exceeds 18-bit signed maximum. |
| 230 | static constexpr size_t kNumNops = 1u + (1u << 15); |
| 231 | std::vector<uint8_t> expected_asm( |
| 232 | expected_asm_kMips_adjust_head, |
| 233 | expected_asm_kMips_adjust_head + arraysize(expected_asm_kMips_adjust_head)); |
| 234 | expected_asm.resize(expected_asm.size() + kNumNops * 4u, 0u); |
| 235 | expected_asm.insert( |
| 236 | expected_asm.end(), |
| 237 | expected_asm_kMips_adjust_tail, |
| 238 | expected_asm_kMips_adjust_tail + arraysize(expected_asm_kMips_adjust_tail)); |
| 239 | std::vector<uint8_t> expected_cfi( |
| 240 | expected_cfi_kMips_adjust, |
| 241 | expected_cfi_kMips_adjust + arraysize(expected_cfi_kMips_adjust)); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 242 | SetUpFrame(InstructionSet::kMips); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 243 | #define __ down_cast<mips::MipsAssembler*>(GetCodeGenerator()->GetAssembler())-> |
| 244 | mips::MipsLabel target; |
| 245 | __ Beqz(mips::A0, &target); |
| 246 | // Push the target out of range of BEQZ. |
| 247 | for (size_t i = 0; i != kNumNops; ++i) { |
| 248 | __ Nop(); |
| 249 | } |
| 250 | __ Bind(&target); |
| 251 | #undef __ |
| 252 | Finish(); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 253 | Check(InstructionSet::kMips, "kMips_adjust", expected_asm, expected_cfi); |
Vladimir Marko | 10ef694 | 2015-10-22 15:25:54 +0100 | [diff] [blame] | 254 | } |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 255 | #endif |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 256 | |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 257 | #ifdef ART_ENABLE_CODEGEN_mips64 |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 258 | TEST_F(OptimizingCFITest, kMips64Adjust) { |
| 259 | // One NOP in forbidden slot, 1 << 15 NOPS have size 1 << 17 which exceeds 18-bit signed maximum. |
| 260 | static constexpr size_t kNumNops = 1u + (1u << 15); |
| 261 | std::vector<uint8_t> expected_asm( |
| 262 | expected_asm_kMips64_adjust_head, |
| 263 | expected_asm_kMips64_adjust_head + arraysize(expected_asm_kMips64_adjust_head)); |
| 264 | expected_asm.resize(expected_asm.size() + kNumNops * 4u, 0u); |
| 265 | expected_asm.insert( |
| 266 | expected_asm.end(), |
| 267 | expected_asm_kMips64_adjust_tail, |
| 268 | expected_asm_kMips64_adjust_tail + arraysize(expected_asm_kMips64_adjust_tail)); |
| 269 | std::vector<uint8_t> expected_cfi( |
| 270 | expected_cfi_kMips64_adjust, |
| 271 | expected_cfi_kMips64_adjust + arraysize(expected_cfi_kMips64_adjust)); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 272 | SetUpFrame(InstructionSet::kMips64); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 273 | #define __ down_cast<mips64::Mips64Assembler*>(GetCodeGenerator()->GetAssembler())-> |
| 274 | mips64::Mips64Label target; |
| 275 | __ Beqc(mips64::A1, mips64::A2, &target); |
| 276 | // Push the target out of range of BEQC. |
| 277 | for (size_t i = 0; i != kNumNops; ++i) { |
| 278 | __ Nop(); |
| 279 | } |
| 280 | __ Bind(&target); |
| 281 | #undef __ |
| 282 | Finish(); |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 283 | Check(InstructionSet::kMips64, "kMips64_adjust", expected_asm, expected_cfi); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 284 | } |
Colin Cross | a75b01a | 2016-08-18 13:45:24 -0700 | [diff] [blame] | 285 | #endif |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 286 | |
Bilyan Borisov | bb661c0 | 2016-04-04 16:27:32 +0100 | [diff] [blame] | 287 | #endif // ART_TARGET_ANDROID |
David Srbecky | c6b4dd8 | 2015-04-07 20:32:43 +0100 | [diff] [blame] | 288 | |
| 289 | } // namespace art |