Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [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 "assembler_mips64.h" |
| 18 | |
| 19 | #include <inttypes.h> |
| 20 | #include <map> |
| 21 | #include <random> |
| 22 | |
| 23 | #include "base/bit_utils.h" |
| 24 | #include "base/stl_util.h" |
| 25 | #include "utils/assembler_test.h" |
| 26 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 27 | #define __ GetAssembler()-> |
| 28 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 29 | namespace art { |
| 30 | |
| 31 | struct MIPS64CpuRegisterCompare { |
| 32 | bool operator()(const mips64::GpuRegister& a, const mips64::GpuRegister& b) const { |
| 33 | return a < b; |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | class AssemblerMIPS64Test : public AssemblerTest<mips64::Mips64Assembler, |
| 38 | mips64::GpuRegister, |
| 39 | mips64::FpuRegister, |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 40 | uint32_t, |
| 41 | mips64::VectorRegister> { |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 42 | public: |
| 43 | typedef AssemblerTest<mips64::Mips64Assembler, |
| 44 | mips64::GpuRegister, |
| 45 | mips64::FpuRegister, |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 46 | uint32_t, |
| 47 | mips64::VectorRegister> Base; |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 48 | |
| 49 | protected: |
| 50 | // Get the typically used name for this architecture, e.g., aarch64, x86-64, ... |
| 51 | std::string GetArchitectureString() OVERRIDE { |
| 52 | return "mips64"; |
| 53 | } |
| 54 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 55 | std::string GetAssemblerCmdName() OVERRIDE { |
| 56 | // We assemble and link for MIPS64R6. See GetAssemblerParameters() for details. |
| 57 | return "gcc"; |
| 58 | } |
| 59 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 60 | std::string GetAssemblerParameters() OVERRIDE { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 61 | // We assemble and link for MIPS64R6. The reason is that object files produced for MIPS64R6 |
| 62 | // (and MIPS32R6) with the GNU assembler don't have correct final offsets in PC-relative |
| 63 | // branches in the .text section and so they require a relocation pass (there's a relocation |
| 64 | // section, .rela.text, that has the needed info to fix up the branches). |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 65 | return " -march=mips64r6 -mmsa -Wa,--no-warn -Wl,-Ttext=0 -Wl,-e0 -nostdlib"; |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | void Pad(std::vector<uint8_t>& data) OVERRIDE { |
| 69 | // The GNU linker unconditionally pads the code segment with NOPs to a size that is a multiple |
| 70 | // of 16 and there doesn't appear to be a way to suppress this padding. Our assembler doesn't |
| 71 | // pad, so, in order for two assembler outputs to match, we need to match the padding as well. |
| 72 | // NOP is encoded as four zero bytes on MIPS. |
| 73 | size_t pad_size = RoundUp(data.size(), 16u) - data.size(); |
| 74 | data.insert(data.end(), pad_size, 0); |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | std::string GetDisassembleParameters() OVERRIDE { |
| 78 | return " -D -bbinary -mmips:isa64r6"; |
| 79 | } |
| 80 | |
| 81 | void SetUpHelpers() OVERRIDE { |
| 82 | if (registers_.size() == 0) { |
| 83 | registers_.push_back(new mips64::GpuRegister(mips64::ZERO)); |
| 84 | registers_.push_back(new mips64::GpuRegister(mips64::AT)); |
| 85 | registers_.push_back(new mips64::GpuRegister(mips64::V0)); |
| 86 | registers_.push_back(new mips64::GpuRegister(mips64::V1)); |
| 87 | registers_.push_back(new mips64::GpuRegister(mips64::A0)); |
| 88 | registers_.push_back(new mips64::GpuRegister(mips64::A1)); |
| 89 | registers_.push_back(new mips64::GpuRegister(mips64::A2)); |
| 90 | registers_.push_back(new mips64::GpuRegister(mips64::A3)); |
| 91 | registers_.push_back(new mips64::GpuRegister(mips64::A4)); |
| 92 | registers_.push_back(new mips64::GpuRegister(mips64::A5)); |
| 93 | registers_.push_back(new mips64::GpuRegister(mips64::A6)); |
| 94 | registers_.push_back(new mips64::GpuRegister(mips64::A7)); |
| 95 | registers_.push_back(new mips64::GpuRegister(mips64::T0)); |
| 96 | registers_.push_back(new mips64::GpuRegister(mips64::T1)); |
| 97 | registers_.push_back(new mips64::GpuRegister(mips64::T2)); |
| 98 | registers_.push_back(new mips64::GpuRegister(mips64::T3)); |
| 99 | registers_.push_back(new mips64::GpuRegister(mips64::S0)); |
| 100 | registers_.push_back(new mips64::GpuRegister(mips64::S1)); |
| 101 | registers_.push_back(new mips64::GpuRegister(mips64::S2)); |
| 102 | registers_.push_back(new mips64::GpuRegister(mips64::S3)); |
| 103 | registers_.push_back(new mips64::GpuRegister(mips64::S4)); |
| 104 | registers_.push_back(new mips64::GpuRegister(mips64::S5)); |
| 105 | registers_.push_back(new mips64::GpuRegister(mips64::S6)); |
| 106 | registers_.push_back(new mips64::GpuRegister(mips64::S7)); |
| 107 | registers_.push_back(new mips64::GpuRegister(mips64::T8)); |
| 108 | registers_.push_back(new mips64::GpuRegister(mips64::T9)); |
| 109 | registers_.push_back(new mips64::GpuRegister(mips64::K0)); |
| 110 | registers_.push_back(new mips64::GpuRegister(mips64::K1)); |
| 111 | registers_.push_back(new mips64::GpuRegister(mips64::GP)); |
| 112 | registers_.push_back(new mips64::GpuRegister(mips64::SP)); |
| 113 | registers_.push_back(new mips64::GpuRegister(mips64::S8)); |
| 114 | registers_.push_back(new mips64::GpuRegister(mips64::RA)); |
| 115 | |
| 116 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::ZERO), "zero"); |
| 117 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::AT), "at"); |
| 118 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::V0), "v0"); |
| 119 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::V1), "v1"); |
| 120 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A0), "a0"); |
| 121 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A1), "a1"); |
| 122 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A2), "a2"); |
| 123 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A3), "a3"); |
| 124 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A4), "a4"); |
| 125 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A5), "a5"); |
| 126 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A6), "a6"); |
| 127 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::A7), "a7"); |
| 128 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T0), "t0"); |
| 129 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T1), "t1"); |
| 130 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T2), "t2"); |
| 131 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T3), "t3"); |
| 132 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S0), "s0"); |
| 133 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S1), "s1"); |
| 134 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S2), "s2"); |
| 135 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S3), "s3"); |
| 136 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S4), "s4"); |
| 137 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S5), "s5"); |
| 138 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S6), "s6"); |
| 139 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S7), "s7"); |
| 140 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T8), "t8"); |
| 141 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::T9), "t9"); |
| 142 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::K0), "k0"); |
| 143 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::K1), "k1"); |
| 144 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::GP), "gp"); |
| 145 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::SP), "sp"); |
| 146 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::S8), "s8"); |
| 147 | secondary_register_names_.emplace(mips64::GpuRegister(mips64::RA), "ra"); |
| 148 | |
| 149 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F0)); |
| 150 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F1)); |
| 151 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F2)); |
| 152 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F3)); |
| 153 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F4)); |
| 154 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F5)); |
| 155 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F6)); |
| 156 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F7)); |
| 157 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F8)); |
| 158 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F9)); |
| 159 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F10)); |
| 160 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F11)); |
| 161 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F12)); |
| 162 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F13)); |
| 163 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F14)); |
| 164 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F15)); |
| 165 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F16)); |
| 166 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F17)); |
| 167 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F18)); |
| 168 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F19)); |
| 169 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F20)); |
| 170 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F21)); |
| 171 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F22)); |
| 172 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F23)); |
| 173 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F24)); |
| 174 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F25)); |
| 175 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F26)); |
| 176 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F27)); |
| 177 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F28)); |
| 178 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F29)); |
| 179 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F30)); |
| 180 | fp_registers_.push_back(new mips64::FpuRegister(mips64::F31)); |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 181 | |
| 182 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W0)); |
| 183 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W1)); |
| 184 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W2)); |
| 185 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W3)); |
| 186 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W4)); |
| 187 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W5)); |
| 188 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W6)); |
| 189 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W7)); |
| 190 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W8)); |
| 191 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W9)); |
| 192 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W10)); |
| 193 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W11)); |
| 194 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W12)); |
| 195 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W13)); |
| 196 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W14)); |
| 197 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W15)); |
| 198 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W16)); |
| 199 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W17)); |
| 200 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W18)); |
| 201 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W19)); |
| 202 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W20)); |
| 203 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W21)); |
| 204 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W22)); |
| 205 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W23)); |
| 206 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W24)); |
| 207 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W25)); |
| 208 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W26)); |
| 209 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W27)); |
| 210 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W28)); |
| 211 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W29)); |
| 212 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W30)); |
| 213 | vec_registers_.push_back(new mips64::VectorRegister(mips64::W31)); |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 214 | } |
| 215 | } |
| 216 | |
| 217 | void TearDown() OVERRIDE { |
| 218 | AssemblerTest::TearDown(); |
| 219 | STLDeleteElements(®isters_); |
| 220 | STLDeleteElements(&fp_registers_); |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 221 | STLDeleteElements(&vec_registers_); |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | std::vector<mips64::GpuRegister*> GetRegisters() OVERRIDE { |
| 225 | return registers_; |
| 226 | } |
| 227 | |
| 228 | std::vector<mips64::FpuRegister*> GetFPRegisters() OVERRIDE { |
| 229 | return fp_registers_; |
| 230 | } |
| 231 | |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 232 | std::vector<mips64::VectorRegister*> GetVectorRegisters() OVERRIDE { |
| 233 | return vec_registers_; |
| 234 | } |
| 235 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 236 | uint32_t CreateImmediate(int64_t imm_value) OVERRIDE { |
| 237 | return imm_value; |
| 238 | } |
| 239 | |
| 240 | std::string GetSecondaryRegisterName(const mips64::GpuRegister& reg) OVERRIDE { |
| 241 | CHECK(secondary_register_names_.find(reg) != secondary_register_names_.end()); |
| 242 | return secondary_register_names_[reg]; |
| 243 | } |
| 244 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 245 | std::string RepeatInsn(size_t count, const std::string& insn) { |
| 246 | std::string result; |
| 247 | for (; count != 0u; --count) { |
| 248 | result += insn; |
| 249 | } |
| 250 | return result; |
| 251 | } |
| 252 | |
| 253 | void BranchCondOneRegHelper(void (mips64::Mips64Assembler::*f)(mips64::GpuRegister, |
| 254 | mips64::Mips64Label*), |
Andreas Gampe | 2e965ac | 2016-11-03 17:24:15 -0700 | [diff] [blame] | 255 | const std::string& instr_name) { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 256 | mips64::Mips64Label label; |
| 257 | (Base::GetAssembler()->*f)(mips64::A0, &label); |
| 258 | constexpr size_t kAdduCount1 = 63; |
| 259 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 260 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 261 | } |
| 262 | __ Bind(&label); |
| 263 | constexpr size_t kAdduCount2 = 64; |
| 264 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 265 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 266 | } |
| 267 | (Base::GetAssembler()->*f)(mips64::A1, &label); |
| 268 | |
| 269 | std::string expected = |
| 270 | ".set noreorder\n" + |
| 271 | instr_name + " $a0, 1f\n" |
| 272 | "nop\n" + |
| 273 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 274 | "1:\n" + |
| 275 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 276 | instr_name + " $a1, 1b\n" |
| 277 | "nop\n"; |
| 278 | DriverStr(expected, instr_name); |
| 279 | } |
| 280 | |
| 281 | void BranchCondTwoRegsHelper(void (mips64::Mips64Assembler::*f)(mips64::GpuRegister, |
| 282 | mips64::GpuRegister, |
| 283 | mips64::Mips64Label*), |
Andreas Gampe | 2e965ac | 2016-11-03 17:24:15 -0700 | [diff] [blame] | 284 | const std::string& instr_name) { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 285 | mips64::Mips64Label label; |
| 286 | (Base::GetAssembler()->*f)(mips64::A0, mips64::A1, &label); |
| 287 | constexpr size_t kAdduCount1 = 63; |
| 288 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 289 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 290 | } |
| 291 | __ Bind(&label); |
| 292 | constexpr size_t kAdduCount2 = 64; |
| 293 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 294 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 295 | } |
| 296 | (Base::GetAssembler()->*f)(mips64::A2, mips64::A3, &label); |
| 297 | |
| 298 | std::string expected = |
| 299 | ".set noreorder\n" + |
| 300 | instr_name + " $a0, $a1, 1f\n" |
| 301 | "nop\n" + |
| 302 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 303 | "1:\n" + |
| 304 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 305 | instr_name + " $a2, $a3, 1b\n" |
| 306 | "nop\n"; |
| 307 | DriverStr(expected, instr_name); |
| 308 | } |
| 309 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 310 | private: |
| 311 | std::vector<mips64::GpuRegister*> registers_; |
| 312 | std::map<mips64::GpuRegister, std::string, MIPS64CpuRegisterCompare> secondary_register_names_; |
| 313 | |
| 314 | std::vector<mips64::FpuRegister*> fp_registers_; |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 315 | std::vector<mips64::VectorRegister*> vec_registers_; |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 316 | }; |
| 317 | |
| 318 | |
| 319 | TEST_F(AssemblerMIPS64Test, Toolchain) { |
| 320 | EXPECT_TRUE(CheckTools()); |
| 321 | } |
| 322 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 323 | /////////////////// |
| 324 | // FP Operations // |
| 325 | /////////////////// |
| 326 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 327 | TEST_F(AssemblerMIPS64Test, AddS) { |
| 328 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::AddS, "add.s ${reg1}, ${reg2}, ${reg3}"), "add.s"); |
| 329 | } |
| 330 | |
| 331 | TEST_F(AssemblerMIPS64Test, AddD) { |
| 332 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::AddD, "add.d ${reg1}, ${reg2}, ${reg3}"), "add.d"); |
| 333 | } |
| 334 | |
| 335 | TEST_F(AssemblerMIPS64Test, SubS) { |
| 336 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::SubS, "sub.s ${reg1}, ${reg2}, ${reg3}"), "sub.s"); |
| 337 | } |
| 338 | |
| 339 | TEST_F(AssemblerMIPS64Test, SubD) { |
| 340 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::SubD, "sub.d ${reg1}, ${reg2}, ${reg3}"), "sub.d"); |
| 341 | } |
| 342 | |
| 343 | TEST_F(AssemblerMIPS64Test, MulS) { |
| 344 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MulS, "mul.s ${reg1}, ${reg2}, ${reg3}"), "mul.s"); |
| 345 | } |
| 346 | |
| 347 | TEST_F(AssemblerMIPS64Test, MulD) { |
| 348 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MulD, "mul.d ${reg1}, ${reg2}, ${reg3}"), "mul.d"); |
| 349 | } |
| 350 | |
| 351 | TEST_F(AssemblerMIPS64Test, DivS) { |
| 352 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::DivS, "div.s ${reg1}, ${reg2}, ${reg3}"), "div.s"); |
| 353 | } |
| 354 | |
| 355 | TEST_F(AssemblerMIPS64Test, DivD) { |
| 356 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::DivD, "div.d ${reg1}, ${reg2}, ${reg3}"), "div.d"); |
| 357 | } |
| 358 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 359 | TEST_F(AssemblerMIPS64Test, SqrtS) { |
| 360 | DriverStr(RepeatFF(&mips64::Mips64Assembler::SqrtS, "sqrt.s ${reg1}, ${reg2}"), "sqrt.s"); |
| 361 | } |
| 362 | |
| 363 | TEST_F(AssemblerMIPS64Test, SqrtD) { |
| 364 | DriverStr(RepeatFF(&mips64::Mips64Assembler::SqrtD, "sqrt.d ${reg1}, ${reg2}"), "sqrt.d"); |
| 365 | } |
| 366 | |
| 367 | TEST_F(AssemblerMIPS64Test, AbsS) { |
| 368 | DriverStr(RepeatFF(&mips64::Mips64Assembler::AbsS, "abs.s ${reg1}, ${reg2}"), "abs.s"); |
| 369 | } |
| 370 | |
| 371 | TEST_F(AssemblerMIPS64Test, AbsD) { |
| 372 | DriverStr(RepeatFF(&mips64::Mips64Assembler::AbsD, "abs.d ${reg1}, ${reg2}"), "abs.d"); |
| 373 | } |
| 374 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 375 | TEST_F(AssemblerMIPS64Test, MovS) { |
| 376 | DriverStr(RepeatFF(&mips64::Mips64Assembler::MovS, "mov.s ${reg1}, ${reg2}"), "mov.s"); |
| 377 | } |
| 378 | |
| 379 | TEST_F(AssemblerMIPS64Test, MovD) { |
| 380 | DriverStr(RepeatFF(&mips64::Mips64Assembler::MovD, "mov.d ${reg1}, ${reg2}"), "mov.d"); |
| 381 | } |
| 382 | |
| 383 | TEST_F(AssemblerMIPS64Test, NegS) { |
| 384 | DriverStr(RepeatFF(&mips64::Mips64Assembler::NegS, "neg.s ${reg1}, ${reg2}"), "neg.s"); |
| 385 | } |
| 386 | |
| 387 | TEST_F(AssemblerMIPS64Test, NegD) { |
| 388 | DriverStr(RepeatFF(&mips64::Mips64Assembler::NegD, "neg.d ${reg1}, ${reg2}"), "neg.d"); |
| 389 | } |
| 390 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 391 | TEST_F(AssemblerMIPS64Test, RoundLS) { |
| 392 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RoundLS, "round.l.s ${reg1}, ${reg2}"), "round.l.s"); |
| 393 | } |
| 394 | |
| 395 | TEST_F(AssemblerMIPS64Test, RoundLD) { |
| 396 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RoundLD, "round.l.d ${reg1}, ${reg2}"), "round.l.d"); |
| 397 | } |
| 398 | |
| 399 | TEST_F(AssemblerMIPS64Test, RoundWS) { |
| 400 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RoundWS, "round.w.s ${reg1}, ${reg2}"), "round.w.s"); |
| 401 | } |
| 402 | |
| 403 | TEST_F(AssemblerMIPS64Test, RoundWD) { |
| 404 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RoundWD, "round.w.d ${reg1}, ${reg2}"), "round.w.d"); |
| 405 | } |
| 406 | |
| 407 | TEST_F(AssemblerMIPS64Test, CeilLS) { |
| 408 | DriverStr(RepeatFF(&mips64::Mips64Assembler::CeilLS, "ceil.l.s ${reg1}, ${reg2}"), "ceil.l.s"); |
| 409 | } |
| 410 | |
| 411 | TEST_F(AssemblerMIPS64Test, CeilLD) { |
| 412 | DriverStr(RepeatFF(&mips64::Mips64Assembler::CeilLD, "ceil.l.d ${reg1}, ${reg2}"), "ceil.l.d"); |
| 413 | } |
| 414 | |
| 415 | TEST_F(AssemblerMIPS64Test, CeilWS) { |
| 416 | DriverStr(RepeatFF(&mips64::Mips64Assembler::CeilWS, "ceil.w.s ${reg1}, ${reg2}"), "ceil.w.s"); |
| 417 | } |
| 418 | |
| 419 | TEST_F(AssemblerMIPS64Test, CeilWD) { |
| 420 | DriverStr(RepeatFF(&mips64::Mips64Assembler::CeilWD, "ceil.w.d ${reg1}, ${reg2}"), "ceil.w.d"); |
| 421 | } |
| 422 | |
| 423 | TEST_F(AssemblerMIPS64Test, FloorLS) { |
| 424 | DriverStr(RepeatFF(&mips64::Mips64Assembler::FloorLS, "floor.l.s ${reg1}, ${reg2}"), "floor.l.s"); |
| 425 | } |
| 426 | |
| 427 | TEST_F(AssemblerMIPS64Test, FloorLD) { |
| 428 | DriverStr(RepeatFF(&mips64::Mips64Assembler::FloorLD, "floor.l.d ${reg1}, ${reg2}"), "floor.l.d"); |
| 429 | } |
| 430 | |
| 431 | TEST_F(AssemblerMIPS64Test, FloorWS) { |
| 432 | DriverStr(RepeatFF(&mips64::Mips64Assembler::FloorWS, "floor.w.s ${reg1}, ${reg2}"), "floor.w.s"); |
| 433 | } |
| 434 | |
| 435 | TEST_F(AssemblerMIPS64Test, FloorWD) { |
| 436 | DriverStr(RepeatFF(&mips64::Mips64Assembler::FloorWD, "floor.w.d ${reg1}, ${reg2}"), "floor.w.d"); |
| 437 | } |
| 438 | |
| 439 | TEST_F(AssemblerMIPS64Test, SelS) { |
| 440 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::SelS, "sel.s ${reg1}, ${reg2}, ${reg3}"), "sel.s"); |
| 441 | } |
| 442 | |
| 443 | TEST_F(AssemblerMIPS64Test, SelD) { |
| 444 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::SelD, "sel.d ${reg1}, ${reg2}, ${reg3}"), "sel.d"); |
| 445 | } |
| 446 | |
| 447 | TEST_F(AssemblerMIPS64Test, RintS) { |
| 448 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RintS, "rint.s ${reg1}, ${reg2}"), "rint.s"); |
| 449 | } |
| 450 | |
| 451 | TEST_F(AssemblerMIPS64Test, RintD) { |
| 452 | DriverStr(RepeatFF(&mips64::Mips64Assembler::RintD, "rint.d ${reg1}, ${reg2}"), "rint.d"); |
| 453 | } |
| 454 | |
| 455 | TEST_F(AssemblerMIPS64Test, ClassS) { |
| 456 | DriverStr(RepeatFF(&mips64::Mips64Assembler::ClassS, "class.s ${reg1}, ${reg2}"), "class.s"); |
| 457 | } |
| 458 | |
| 459 | TEST_F(AssemblerMIPS64Test, ClassD) { |
| 460 | DriverStr(RepeatFF(&mips64::Mips64Assembler::ClassD, "class.d ${reg1}, ${reg2}"), "class.d"); |
| 461 | } |
| 462 | |
| 463 | TEST_F(AssemblerMIPS64Test, MinS) { |
| 464 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MinS, "min.s ${reg1}, ${reg2}, ${reg3}"), "min.s"); |
| 465 | } |
| 466 | |
| 467 | TEST_F(AssemblerMIPS64Test, MinD) { |
| 468 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MinD, "min.d ${reg1}, ${reg2}, ${reg3}"), "min.d"); |
| 469 | } |
| 470 | |
| 471 | TEST_F(AssemblerMIPS64Test, MaxS) { |
| 472 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MaxS, "max.s ${reg1}, ${reg2}, ${reg3}"), "max.s"); |
| 473 | } |
| 474 | |
| 475 | TEST_F(AssemblerMIPS64Test, MaxD) { |
| 476 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::MaxD, "max.d ${reg1}, ${reg2}, ${reg3}"), "max.d"); |
| 477 | } |
| 478 | |
Alexey Frunze | 299a939 | 2015-12-08 16:08:02 -0800 | [diff] [blame] | 479 | TEST_F(AssemblerMIPS64Test, CmpUnS) { |
| 480 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUnS, "cmp.un.s ${reg1}, ${reg2}, ${reg3}"), |
| 481 | "cmp.un.s"); |
| 482 | } |
| 483 | |
| 484 | TEST_F(AssemblerMIPS64Test, CmpEqS) { |
| 485 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpEqS, "cmp.eq.s ${reg1}, ${reg2}, ${reg3}"), |
| 486 | "cmp.eq.s"); |
| 487 | } |
| 488 | |
| 489 | TEST_F(AssemblerMIPS64Test, CmpUeqS) { |
| 490 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUeqS, "cmp.ueq.s ${reg1}, ${reg2}, ${reg3}"), |
| 491 | "cmp.ueq.s"); |
| 492 | } |
| 493 | |
| 494 | TEST_F(AssemblerMIPS64Test, CmpLtS) { |
| 495 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpLtS, "cmp.lt.s ${reg1}, ${reg2}, ${reg3}"), |
| 496 | "cmp.lt.s"); |
| 497 | } |
| 498 | |
| 499 | TEST_F(AssemblerMIPS64Test, CmpUltS) { |
| 500 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUltS, "cmp.ult.s ${reg1}, ${reg2}, ${reg3}"), |
| 501 | "cmp.ult.s"); |
| 502 | } |
| 503 | |
| 504 | TEST_F(AssemblerMIPS64Test, CmpLeS) { |
| 505 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpLeS, "cmp.le.s ${reg1}, ${reg2}, ${reg3}"), |
| 506 | "cmp.le.s"); |
| 507 | } |
| 508 | |
| 509 | TEST_F(AssemblerMIPS64Test, CmpUleS) { |
| 510 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUleS, "cmp.ule.s ${reg1}, ${reg2}, ${reg3}"), |
| 511 | "cmp.ule.s"); |
| 512 | } |
| 513 | |
| 514 | TEST_F(AssemblerMIPS64Test, CmpOrS) { |
| 515 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpOrS, "cmp.or.s ${reg1}, ${reg2}, ${reg3}"), |
| 516 | "cmp.or.s"); |
| 517 | } |
| 518 | |
| 519 | TEST_F(AssemblerMIPS64Test, CmpUneS) { |
| 520 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUneS, "cmp.une.s ${reg1}, ${reg2}, ${reg3}"), |
| 521 | "cmp.une.s"); |
| 522 | } |
| 523 | |
| 524 | TEST_F(AssemblerMIPS64Test, CmpNeS) { |
| 525 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpNeS, "cmp.ne.s ${reg1}, ${reg2}, ${reg3}"), |
| 526 | "cmp.ne.s"); |
| 527 | } |
| 528 | |
| 529 | TEST_F(AssemblerMIPS64Test, CmpUnD) { |
| 530 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUnD, "cmp.un.d ${reg1}, ${reg2}, ${reg3}"), |
| 531 | "cmp.un.d"); |
| 532 | } |
| 533 | |
| 534 | TEST_F(AssemblerMIPS64Test, CmpEqD) { |
| 535 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpEqD, "cmp.eq.d ${reg1}, ${reg2}, ${reg3}"), |
| 536 | "cmp.eq.d"); |
| 537 | } |
| 538 | |
| 539 | TEST_F(AssemblerMIPS64Test, CmpUeqD) { |
| 540 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUeqD, "cmp.ueq.d ${reg1}, ${reg2}, ${reg3}"), |
| 541 | "cmp.ueq.d"); |
| 542 | } |
| 543 | |
| 544 | TEST_F(AssemblerMIPS64Test, CmpLtD) { |
| 545 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpLtD, "cmp.lt.d ${reg1}, ${reg2}, ${reg3}"), |
| 546 | "cmp.lt.d"); |
| 547 | } |
| 548 | |
| 549 | TEST_F(AssemblerMIPS64Test, CmpUltD) { |
| 550 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUltD, "cmp.ult.d ${reg1}, ${reg2}, ${reg3}"), |
| 551 | "cmp.ult.d"); |
| 552 | } |
| 553 | |
| 554 | TEST_F(AssemblerMIPS64Test, CmpLeD) { |
| 555 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpLeD, "cmp.le.d ${reg1}, ${reg2}, ${reg3}"), |
| 556 | "cmp.le.d"); |
| 557 | } |
| 558 | |
| 559 | TEST_F(AssemblerMIPS64Test, CmpUleD) { |
| 560 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUleD, "cmp.ule.d ${reg1}, ${reg2}, ${reg3}"), |
| 561 | "cmp.ule.d"); |
| 562 | } |
| 563 | |
| 564 | TEST_F(AssemblerMIPS64Test, CmpOrD) { |
| 565 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpOrD, "cmp.or.d ${reg1}, ${reg2}, ${reg3}"), |
| 566 | "cmp.or.d"); |
| 567 | } |
| 568 | |
| 569 | TEST_F(AssemblerMIPS64Test, CmpUneD) { |
| 570 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpUneD, "cmp.une.d ${reg1}, ${reg2}, ${reg3}"), |
| 571 | "cmp.une.d"); |
| 572 | } |
| 573 | |
| 574 | TEST_F(AssemblerMIPS64Test, CmpNeD) { |
| 575 | DriverStr(RepeatFFF(&mips64::Mips64Assembler::CmpNeD, "cmp.ne.d ${reg1}, ${reg2}, ${reg3}"), |
| 576 | "cmp.ne.d"); |
| 577 | } |
| 578 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 579 | TEST_F(AssemblerMIPS64Test, CvtDL) { |
| 580 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtdl, "cvt.d.l ${reg1}, ${reg2}"), "cvt.d.l"); |
| 581 | } |
| 582 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 583 | TEST_F(AssemblerMIPS64Test, CvtDS) { |
| 584 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtds, "cvt.d.s ${reg1}, ${reg2}"), "cvt.d.s"); |
| 585 | } |
| 586 | |
| 587 | TEST_F(AssemblerMIPS64Test, CvtDW) { |
| 588 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtdw, "cvt.d.w ${reg1}, ${reg2}"), "cvt.d.w"); |
| 589 | } |
| 590 | |
| 591 | TEST_F(AssemblerMIPS64Test, CvtSL) { |
| 592 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtsl, "cvt.s.l ${reg1}, ${reg2}"), "cvt.s.l"); |
| 593 | } |
| 594 | |
| 595 | TEST_F(AssemblerMIPS64Test, CvtSD) { |
| 596 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtsd, "cvt.s.d ${reg1}, ${reg2}"), "cvt.s.d"); |
| 597 | } |
| 598 | |
| 599 | TEST_F(AssemblerMIPS64Test, CvtSW) { |
| 600 | DriverStr(RepeatFF(&mips64::Mips64Assembler::Cvtsw, "cvt.s.w ${reg1}, ${reg2}"), "cvt.s.w"); |
| 601 | } |
| 602 | |
Alexey Frunze | baf60b7 | 2015-12-22 15:15:03 -0800 | [diff] [blame] | 603 | TEST_F(AssemblerMIPS64Test, TruncWS) { |
| 604 | DriverStr(RepeatFF(&mips64::Mips64Assembler::TruncWS, "trunc.w.s ${reg1}, ${reg2}"), "trunc.w.s"); |
| 605 | } |
| 606 | |
| 607 | TEST_F(AssemblerMIPS64Test, TruncWD) { |
| 608 | DriverStr(RepeatFF(&mips64::Mips64Assembler::TruncWD, "trunc.w.d ${reg1}, ${reg2}"), "trunc.w.d"); |
| 609 | } |
| 610 | |
| 611 | TEST_F(AssemblerMIPS64Test, TruncLS) { |
| 612 | DriverStr(RepeatFF(&mips64::Mips64Assembler::TruncLS, "trunc.l.s ${reg1}, ${reg2}"), "trunc.l.s"); |
| 613 | } |
| 614 | |
| 615 | TEST_F(AssemblerMIPS64Test, TruncLD) { |
| 616 | DriverStr(RepeatFF(&mips64::Mips64Assembler::TruncLD, "trunc.l.d ${reg1}, ${reg2}"), "trunc.l.d"); |
| 617 | } |
| 618 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 619 | TEST_F(AssemblerMIPS64Test, Mfc1) { |
| 620 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Mfc1, "mfc1 ${reg1}, ${reg2}"), "Mfc1"); |
| 621 | } |
| 622 | |
| 623 | TEST_F(AssemblerMIPS64Test, Mfhc1) { |
| 624 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Mfhc1, "mfhc1 ${reg1}, ${reg2}"), "Mfhc1"); |
| 625 | } |
| 626 | |
| 627 | TEST_F(AssemblerMIPS64Test, Mtc1) { |
| 628 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Mtc1, "mtc1 ${reg1}, ${reg2}"), "Mtc1"); |
| 629 | } |
| 630 | |
| 631 | TEST_F(AssemblerMIPS64Test, Mthc1) { |
| 632 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Mthc1, "mthc1 ${reg1}, ${reg2}"), "Mthc1"); |
| 633 | } |
| 634 | |
| 635 | TEST_F(AssemblerMIPS64Test, Dmfc1) { |
| 636 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Dmfc1, "dmfc1 ${reg1}, ${reg2}"), "Dmfc1"); |
| 637 | } |
| 638 | |
| 639 | TEST_F(AssemblerMIPS64Test, Dmtc1) { |
| 640 | DriverStr(RepeatRF(&mips64::Mips64Assembler::Dmtc1, "dmtc1 ${reg1}, ${reg2}"), "Dmtc1"); |
| 641 | } |
| 642 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 643 | TEST_F(AssemblerMIPS64Test, Lwc1) { |
| 644 | DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Lwc1, -16, "lwc1 ${reg1}, {imm}(${reg2})"), |
| 645 | "lwc1"); |
| 646 | } |
| 647 | |
| 648 | TEST_F(AssemblerMIPS64Test, Ldc1) { |
| 649 | DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Ldc1, -16, "ldc1 ${reg1}, {imm}(${reg2})"), |
| 650 | "ldc1"); |
| 651 | } |
| 652 | |
| 653 | TEST_F(AssemblerMIPS64Test, Swc1) { |
| 654 | DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Swc1, -16, "swc1 ${reg1}, {imm}(${reg2})"), |
| 655 | "swc1"); |
| 656 | } |
| 657 | |
| 658 | TEST_F(AssemblerMIPS64Test, Sdc1) { |
| 659 | DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Sdc1, -16, "sdc1 ${reg1}, {imm}(${reg2})"), |
| 660 | "sdc1"); |
| 661 | } |
| 662 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 663 | //////////////// |
| 664 | // CALL / JMP // |
| 665 | //////////////// |
| 666 | |
| 667 | TEST_F(AssemblerMIPS64Test, Jalr) { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 668 | DriverStr(".set noreorder\n" + |
| 669 | RepeatRRNoDupes(&mips64::Mips64Assembler::Jalr, "jalr ${reg1}, ${reg2}"), "jalr"); |
| 670 | } |
| 671 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 672 | TEST_F(AssemblerMIPS64Test, Balc) { |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 673 | mips64::Mips64Label label1, label2; |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 674 | __ Balc(&label1); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 675 | constexpr size_t kAdduCount1 = 63; |
| 676 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 677 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 678 | } |
| 679 | __ Bind(&label1); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 680 | __ Balc(&label2); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 681 | constexpr size_t kAdduCount2 = 64; |
| 682 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 683 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 684 | } |
| 685 | __ Bind(&label2); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 686 | __ Balc(&label1); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 687 | |
| 688 | std::string expected = |
| 689 | ".set noreorder\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 690 | "balc 1f\n" + |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 691 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 692 | "1:\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 693 | "balc 2f\n" + |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 694 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 695 | "2:\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 696 | "balc 1b\n"; |
| 697 | DriverStr(expected, "Balc"); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 698 | } |
| 699 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 700 | TEST_F(AssemblerMIPS64Test, LongBalc) { |
Vladimir Marko | 3607394 | 2016-12-14 14:18:22 +0000 | [diff] [blame] | 701 | constexpr uint32_t kNopCount1 = (1u << 25) + 1; |
| 702 | constexpr uint32_t kNopCount2 = (1u << 25) + 1; |
| 703 | constexpr uint32_t kRequiredCapacity = (kNopCount1 + kNopCount2 + 6u) * 4u; |
| 704 | ASSERT_LT(__ GetBuffer()->Capacity(), kRequiredCapacity); |
| 705 | __ GetBuffer()->ExtendCapacity(kRequiredCapacity); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 706 | mips64::Mips64Label label1, label2; |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 707 | __ Balc(&label1); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 708 | for (uint32_t i = 0; i != kNopCount1; ++i) { |
| 709 | __ Nop(); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 710 | } |
| 711 | __ Bind(&label1); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 712 | __ Balc(&label2); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 713 | for (uint32_t i = 0; i != kNopCount2; ++i) { |
| 714 | __ Nop(); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 715 | } |
| 716 | __ Bind(&label2); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 717 | __ Balc(&label1); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 718 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 719 | uint32_t offset_forward1 = 2 + kNopCount1; // 2: account for auipc and jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 720 | offset_forward1 <<= 2; |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 721 | offset_forward1 += (offset_forward1 & 0x8000) << 1; // Account for sign extension in jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 722 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 723 | uint32_t offset_forward2 = 2 + kNopCount2; // 2: account for auipc and jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 724 | offset_forward2 <<= 2; |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 725 | offset_forward2 += (offset_forward2 & 0x8000) << 1; // Account for sign extension in jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 726 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 727 | uint32_t offset_back = -(2 + kNopCount2); // 2: account for auipc and jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 728 | offset_back <<= 2; |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 729 | offset_back += (offset_back & 0x8000) << 1; // Account for sign extension in jialc. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 730 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 731 | // Note, we're using the ".fill" directive to tell the assembler to generate many NOPs |
| 732 | // instead of generating them ourselves in the source code. This saves a few minutes |
| 733 | // of test time. |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 734 | std::ostringstream oss; |
| 735 | oss << |
| 736 | ".set noreorder\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 737 | "auipc $at, 0x" << std::hex << High16Bits(offset_forward1) << "\n" |
| 738 | "jialc $at, 0x" << std::hex << Low16Bits(offset_forward1) << "\n" |
| 739 | ".fill 0x" << std::hex << kNopCount1 << " , 4, 0\n" |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 740 | "1:\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 741 | "auipc $at, 0x" << std::hex << High16Bits(offset_forward2) << "\n" |
| 742 | "jialc $at, 0x" << std::hex << Low16Bits(offset_forward2) << "\n" |
| 743 | ".fill 0x" << std::hex << kNopCount2 << " , 4, 0\n" |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 744 | "2:\n" |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 745 | "auipc $at, 0x" << std::hex << High16Bits(offset_back) << "\n" |
| 746 | "jialc $at, 0x" << std::hex << Low16Bits(offset_back) << "\n"; |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 747 | std::string expected = oss.str(); |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 748 | DriverStr(expected, "LongBalc"); |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | TEST_F(AssemblerMIPS64Test, Bc) { |
| 752 | mips64::Mips64Label label1, label2; |
| 753 | __ Bc(&label1); |
| 754 | constexpr size_t kAdduCount1 = 63; |
| 755 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 756 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 757 | } |
| 758 | __ Bind(&label1); |
| 759 | __ Bc(&label2); |
| 760 | constexpr size_t kAdduCount2 = 64; |
| 761 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 762 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 763 | } |
| 764 | __ Bind(&label2); |
| 765 | __ Bc(&label1); |
| 766 | |
| 767 | std::string expected = |
| 768 | ".set noreorder\n" |
| 769 | "bc 1f\n" + |
| 770 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 771 | "1:\n" |
| 772 | "bc 2f\n" + |
| 773 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 774 | "2:\n" |
| 775 | "bc 1b\n"; |
| 776 | DriverStr(expected, "Bc"); |
| 777 | } |
| 778 | |
| 779 | TEST_F(AssemblerMIPS64Test, Beqzc) { |
| 780 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Beqzc, "Beqzc"); |
| 781 | } |
| 782 | |
| 783 | TEST_F(AssemblerMIPS64Test, Bnezc) { |
| 784 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Bnezc, "Bnezc"); |
| 785 | } |
| 786 | |
| 787 | TEST_F(AssemblerMIPS64Test, Bltzc) { |
| 788 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Bltzc, "Bltzc"); |
| 789 | } |
| 790 | |
| 791 | TEST_F(AssemblerMIPS64Test, Bgezc) { |
| 792 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Bgezc, "Bgezc"); |
| 793 | } |
| 794 | |
| 795 | TEST_F(AssemblerMIPS64Test, Blezc) { |
| 796 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Blezc, "Blezc"); |
| 797 | } |
| 798 | |
| 799 | TEST_F(AssemblerMIPS64Test, Bgtzc) { |
| 800 | BranchCondOneRegHelper(&mips64::Mips64Assembler::Bgtzc, "Bgtzc"); |
| 801 | } |
| 802 | |
| 803 | TEST_F(AssemblerMIPS64Test, Beqc) { |
| 804 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Beqc, "Beqc"); |
| 805 | } |
| 806 | |
| 807 | TEST_F(AssemblerMIPS64Test, Bnec) { |
| 808 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Bnec, "Bnec"); |
| 809 | } |
| 810 | |
| 811 | TEST_F(AssemblerMIPS64Test, Bltc) { |
| 812 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Bltc, "Bltc"); |
| 813 | } |
| 814 | |
| 815 | TEST_F(AssemblerMIPS64Test, Bgec) { |
| 816 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Bgec, "Bgec"); |
| 817 | } |
| 818 | |
| 819 | TEST_F(AssemblerMIPS64Test, Bltuc) { |
| 820 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Bltuc, "Bltuc"); |
| 821 | } |
| 822 | |
| 823 | TEST_F(AssemblerMIPS64Test, Bgeuc) { |
| 824 | BranchCondTwoRegsHelper(&mips64::Mips64Assembler::Bgeuc, "Bgeuc"); |
| 825 | } |
| 826 | |
Alexey Frunze | 299a939 | 2015-12-08 16:08:02 -0800 | [diff] [blame] | 827 | TEST_F(AssemblerMIPS64Test, Bc1eqz) { |
| 828 | mips64::Mips64Label label; |
| 829 | __ Bc1eqz(mips64::F0, &label); |
| 830 | constexpr size_t kAdduCount1 = 63; |
| 831 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 832 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 833 | } |
| 834 | __ Bind(&label); |
| 835 | constexpr size_t kAdduCount2 = 64; |
| 836 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 837 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 838 | } |
| 839 | __ Bc1eqz(mips64::F31, &label); |
| 840 | |
| 841 | std::string expected = |
| 842 | ".set noreorder\n" |
| 843 | "bc1eqz $f0, 1f\n" |
| 844 | "nop\n" + |
| 845 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 846 | "1:\n" + |
| 847 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 848 | "bc1eqz $f31, 1b\n" |
| 849 | "nop\n"; |
| 850 | DriverStr(expected, "Bc1eqz"); |
| 851 | } |
| 852 | |
| 853 | TEST_F(AssemblerMIPS64Test, Bc1nez) { |
| 854 | mips64::Mips64Label label; |
| 855 | __ Bc1nez(mips64::F0, &label); |
| 856 | constexpr size_t kAdduCount1 = 63; |
| 857 | for (size_t i = 0; i != kAdduCount1; ++i) { |
| 858 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 859 | } |
| 860 | __ Bind(&label); |
| 861 | constexpr size_t kAdduCount2 = 64; |
| 862 | for (size_t i = 0; i != kAdduCount2; ++i) { |
| 863 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 864 | } |
| 865 | __ Bc1nez(mips64::F31, &label); |
| 866 | |
| 867 | std::string expected = |
| 868 | ".set noreorder\n" |
| 869 | "bc1nez $f0, 1f\n" |
| 870 | "nop\n" + |
| 871 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") + |
| 872 | "1:\n" + |
| 873 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") + |
| 874 | "bc1nez $f31, 1b\n" |
| 875 | "nop\n"; |
| 876 | DriverStr(expected, "Bc1nez"); |
| 877 | } |
| 878 | |
Alexey Frunze | a0e87b0 | 2015-09-24 22:57:20 -0700 | [diff] [blame] | 879 | TEST_F(AssemblerMIPS64Test, LongBeqc) { |
| 880 | mips64::Mips64Label label; |
| 881 | __ Beqc(mips64::A0, mips64::A1, &label); |
| 882 | constexpr uint32_t kAdduCount1 = (1u << 15) + 1; |
| 883 | for (uint32_t i = 0; i != kAdduCount1; ++i) { |
| 884 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 885 | } |
| 886 | __ Bind(&label); |
| 887 | constexpr uint32_t kAdduCount2 = (1u << 15) + 1; |
| 888 | for (uint32_t i = 0; i != kAdduCount2; ++i) { |
| 889 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 890 | } |
| 891 | __ Beqc(mips64::A2, mips64::A3, &label); |
| 892 | |
| 893 | uint32_t offset_forward = 2 + kAdduCount1; // 2: account for auipc and jic. |
| 894 | offset_forward <<= 2; |
| 895 | offset_forward += (offset_forward & 0x8000) << 1; // Account for sign extension in jic. |
| 896 | |
| 897 | uint32_t offset_back = -(kAdduCount2 + 1); // 1: account for bnec. |
| 898 | offset_back <<= 2; |
| 899 | offset_back += (offset_back & 0x8000) << 1; // Account for sign extension in jic. |
| 900 | |
| 901 | std::ostringstream oss; |
| 902 | oss << |
| 903 | ".set noreorder\n" |
| 904 | "bnec $a0, $a1, 1f\n" |
| 905 | "auipc $at, 0x" << std::hex << High16Bits(offset_forward) << "\n" |
| 906 | "jic $at, 0x" << std::hex << Low16Bits(offset_forward) << "\n" |
| 907 | "1:\n" << |
| 908 | RepeatInsn(kAdduCount1, "addu $zero, $zero, $zero\n") << |
| 909 | "2:\n" << |
| 910 | RepeatInsn(kAdduCount2, "addu $zero, $zero, $zero\n") << |
| 911 | "bnec $a2, $a3, 3f\n" |
| 912 | "auipc $at, 0x" << std::hex << High16Bits(offset_back) << "\n" |
| 913 | "jic $at, 0x" << std::hex << Low16Bits(offset_back) << "\n" |
| 914 | "3:\n"; |
| 915 | std::string expected = oss.str(); |
| 916 | DriverStr(expected, "LongBeqc"); |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 917 | } |
| 918 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 919 | ////////// |
| 920 | // MISC // |
| 921 | ////////// |
| 922 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 923 | TEST_F(AssemblerMIPS64Test, Lwpc) { |
| 924 | // Lwpc() takes an unsigned 19-bit immediate, while the GNU assembler needs a signed offset, |
| 925 | // hence the sign extension from bit 18 with `imm - ((imm & 0x40000) << 1)`. |
| 926 | // The GNU assembler also wants the offset to be a multiple of 4, which it will shift right |
| 927 | // by 2 positions when encoding, hence `<< 2` to compensate for that shift. |
| 928 | // We capture the value of the immediate with `.set imm, {imm}` because the value is needed |
| 929 | // twice for the sign extension, but `{imm}` is substituted only once. |
| 930 | const char* code = ".set imm, {imm}\nlw ${reg}, ((imm - ((imm & 0x40000) << 1)) << 2)($pc)"; |
| 931 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Lwpc, 19, code), "Lwpc"); |
| 932 | } |
| 933 | |
| 934 | TEST_F(AssemblerMIPS64Test, Lwupc) { |
| 935 | // The comment for the Lwpc test applies here as well. |
| 936 | const char* code = ".set imm, {imm}\nlwu ${reg}, ((imm - ((imm & 0x40000) << 1)) << 2)($pc)"; |
| 937 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Lwupc, 19, code), "Lwupc"); |
| 938 | } |
| 939 | |
| 940 | TEST_F(AssemblerMIPS64Test, Ldpc) { |
| 941 | // The comment for the Lwpc test applies here as well. |
| 942 | const char* code = ".set imm, {imm}\nld ${reg}, ((imm - ((imm & 0x20000) << 1)) << 3)($pc)"; |
| 943 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Ldpc, 18, code), "Ldpc"); |
| 944 | } |
| 945 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 946 | TEST_F(AssemblerMIPS64Test, Auipc) { |
| 947 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Auipc, 16, "auipc ${reg}, {imm}"), "Auipc"); |
| 948 | } |
| 949 | |
| 950 | TEST_F(AssemblerMIPS64Test, Addiupc) { |
| 951 | // The comment from the Lwpc() test applies to this Addiupc() test as well. |
| 952 | const char* code = ".set imm, {imm}\naddiupc ${reg}, (imm - ((imm & 0x40000) << 1)) << 2"; |
| 953 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Addiupc, 19, code), "Addiupc"); |
| 954 | } |
| 955 | |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 956 | TEST_F(AssemblerMIPS64Test, LoadFarthestNearLabelAddress) { |
| 957 | mips64::Mips64Label label; |
| 958 | __ LoadLabelAddress(mips64::V0, &label); |
| 959 | constexpr uint32_t kAdduCount = 0x3FFDE; |
| 960 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 961 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 962 | } |
| 963 | __ Bind(&label); |
| 964 | |
| 965 | std::string expected = |
| 966 | "lapc $v0, 1f\n" + |
| 967 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 968 | "1:\n"; |
| 969 | DriverStr(expected, "LoadFarthestNearLabelAddress"); |
| 970 | EXPECT_EQ(__ GetLabelLocation(&label), (1 + kAdduCount) * 4); |
| 971 | } |
| 972 | |
| 973 | TEST_F(AssemblerMIPS64Test, LoadNearestFarLabelAddress) { |
| 974 | mips64::Mips64Label label; |
| 975 | __ LoadLabelAddress(mips64::V0, &label); |
| 976 | constexpr uint32_t kAdduCount = 0x3FFDF; |
| 977 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 978 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 979 | } |
| 980 | __ Bind(&label); |
| 981 | |
| 982 | std::string expected = |
| 983 | "1:\n" |
| 984 | "auipc $at, %hi(2f - 1b)\n" |
Alexey Frunze | f63f569 | 2016-12-13 17:43:11 -0800 | [diff] [blame] | 985 | "daddiu $v0, $at, %lo(2f - 1b)\n" + |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 986 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 987 | "2:\n"; |
| 988 | DriverStr(expected, "LoadNearestFarLabelAddress"); |
| 989 | EXPECT_EQ(__ GetLabelLocation(&label), (2 + kAdduCount) * 4); |
| 990 | } |
| 991 | |
| 992 | TEST_F(AssemblerMIPS64Test, LoadFarthestNearLiteral) { |
| 993 | mips64::Literal* literal = __ NewLiteral<uint32_t>(0x12345678); |
| 994 | __ LoadLiteral(mips64::V0, mips64::kLoadWord, literal); |
| 995 | constexpr uint32_t kAdduCount = 0x3FFDE; |
| 996 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 997 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 998 | } |
| 999 | |
| 1000 | std::string expected = |
| 1001 | "lwpc $v0, 1f\n" + |
| 1002 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1003 | "1:\n" |
| 1004 | ".word 0x12345678\n"; |
| 1005 | DriverStr(expected, "LoadFarthestNearLiteral"); |
| 1006 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (1 + kAdduCount) * 4); |
| 1007 | } |
| 1008 | |
| 1009 | TEST_F(AssemblerMIPS64Test, LoadNearestFarLiteral) { |
| 1010 | mips64::Literal* literal = __ NewLiteral<uint32_t>(0x12345678); |
| 1011 | __ LoadLiteral(mips64::V0, mips64::kLoadWord, literal); |
| 1012 | constexpr uint32_t kAdduCount = 0x3FFDF; |
| 1013 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1014 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1015 | } |
| 1016 | |
| 1017 | std::string expected = |
| 1018 | "1:\n" |
| 1019 | "auipc $at, %hi(2f - 1b)\n" |
| 1020 | "lw $v0, %lo(2f - 1b)($at)\n" + |
| 1021 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1022 | "2:\n" |
| 1023 | ".word 0x12345678\n"; |
| 1024 | DriverStr(expected, "LoadNearestFarLiteral"); |
| 1025 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (2 + kAdduCount) * 4); |
| 1026 | } |
| 1027 | |
| 1028 | TEST_F(AssemblerMIPS64Test, LoadFarthestNearLiteralUnsigned) { |
| 1029 | mips64::Literal* literal = __ NewLiteral<uint32_t>(0x12345678); |
| 1030 | __ LoadLiteral(mips64::V0, mips64::kLoadUnsignedWord, literal); |
| 1031 | constexpr uint32_t kAdduCount = 0x3FFDE; |
| 1032 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1033 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1034 | } |
| 1035 | |
| 1036 | std::string expected = |
| 1037 | "lwupc $v0, 1f\n" + |
| 1038 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1039 | "1:\n" |
| 1040 | ".word 0x12345678\n"; |
| 1041 | DriverStr(expected, "LoadFarthestNearLiteralUnsigned"); |
| 1042 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (1 + kAdduCount) * 4); |
| 1043 | } |
| 1044 | |
| 1045 | TEST_F(AssemblerMIPS64Test, LoadNearestFarLiteralUnsigned) { |
| 1046 | mips64::Literal* literal = __ NewLiteral<uint32_t>(0x12345678); |
| 1047 | __ LoadLiteral(mips64::V0, mips64::kLoadUnsignedWord, literal); |
| 1048 | constexpr uint32_t kAdduCount = 0x3FFDF; |
| 1049 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1050 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1051 | } |
| 1052 | |
| 1053 | std::string expected = |
| 1054 | "1:\n" |
| 1055 | "auipc $at, %hi(2f - 1b)\n" |
| 1056 | "lwu $v0, %lo(2f - 1b)($at)\n" + |
| 1057 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1058 | "2:\n" |
| 1059 | ".word 0x12345678\n"; |
| 1060 | DriverStr(expected, "LoadNearestFarLiteralUnsigned"); |
| 1061 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (2 + kAdduCount) * 4); |
| 1062 | } |
| 1063 | |
| 1064 | TEST_F(AssemblerMIPS64Test, LoadFarthestNearLiteralLong) { |
| 1065 | mips64::Literal* literal = __ NewLiteral<uint64_t>(UINT64_C(0x0123456789ABCDEF)); |
| 1066 | __ LoadLiteral(mips64::V0, mips64::kLoadDoubleword, literal); |
| 1067 | constexpr uint32_t kAdduCount = 0x3FFDD; |
| 1068 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1069 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1070 | } |
| 1071 | |
| 1072 | std::string expected = |
| 1073 | "ldpc $v0, 1f\n" + |
| 1074 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1075 | "1:\n" |
| 1076 | ".dword 0x0123456789ABCDEF\n"; |
| 1077 | DriverStr(expected, "LoadFarthestNearLiteralLong"); |
| 1078 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (1 + kAdduCount) * 4); |
| 1079 | } |
| 1080 | |
| 1081 | TEST_F(AssemblerMIPS64Test, LoadNearestFarLiteralLong) { |
| 1082 | mips64::Literal* literal = __ NewLiteral<uint64_t>(UINT64_C(0x0123456789ABCDEF)); |
| 1083 | __ LoadLiteral(mips64::V0, mips64::kLoadDoubleword, literal); |
| 1084 | constexpr uint32_t kAdduCount = 0x3FFDE; |
| 1085 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1086 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1087 | } |
| 1088 | |
| 1089 | std::string expected = |
| 1090 | "1:\n" |
| 1091 | "auipc $at, %hi(2f - 1b)\n" |
| 1092 | "ld $v0, %lo(2f - 1b)($at)\n" + |
| 1093 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1094 | "2:\n" |
| 1095 | ".dword 0x0123456789ABCDEF\n"; |
| 1096 | DriverStr(expected, "LoadNearestFarLiteralLong"); |
| 1097 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (2 + kAdduCount) * 4); |
| 1098 | } |
| 1099 | |
| 1100 | TEST_F(AssemblerMIPS64Test, LongLiteralAlignmentNop) { |
| 1101 | mips64::Literal* literal1 = __ NewLiteral<uint64_t>(UINT64_C(0x0123456789ABCDEF)); |
| 1102 | mips64::Literal* literal2 = __ NewLiteral<uint64_t>(UINT64_C(0x5555555555555555)); |
| 1103 | mips64::Literal* literal3 = __ NewLiteral<uint64_t>(UINT64_C(0xAAAAAAAAAAAAAAAA)); |
| 1104 | __ LoadLiteral(mips64::A1, mips64::kLoadDoubleword, literal1); |
| 1105 | __ LoadLiteral(mips64::A2, mips64::kLoadDoubleword, literal2); |
| 1106 | __ LoadLiteral(mips64::A3, mips64::kLoadDoubleword, literal3); |
| 1107 | __ LoadLabelAddress(mips64::V0, literal1->GetLabel()); |
| 1108 | __ LoadLabelAddress(mips64::V1, literal2->GetLabel()); |
| 1109 | // A nop will be inserted here before the 64-bit literals. |
| 1110 | |
| 1111 | std::string expected = |
| 1112 | "ldpc $a1, 1f\n" |
| 1113 | // The GNU assembler incorrectly requires the ldpc instruction to be located |
| 1114 | // at an address that's a multiple of 8. TODO: Remove this workaround if/when |
| 1115 | // the assembler is fixed. |
| 1116 | // "ldpc $a2, 2f\n" |
| 1117 | ".word 0xECD80004\n" |
| 1118 | "ldpc $a3, 3f\n" |
| 1119 | "lapc $v0, 1f\n" |
| 1120 | "lapc $v1, 2f\n" |
| 1121 | "nop\n" |
| 1122 | "1:\n" |
| 1123 | ".dword 0x0123456789ABCDEF\n" |
| 1124 | "2:\n" |
| 1125 | ".dword 0x5555555555555555\n" |
| 1126 | "3:\n" |
| 1127 | ".dword 0xAAAAAAAAAAAAAAAA\n"; |
| 1128 | DriverStr(expected, "LongLiteralAlignmentNop"); |
| 1129 | EXPECT_EQ(__ GetLabelLocation(literal1->GetLabel()), 6 * 4u); |
| 1130 | EXPECT_EQ(__ GetLabelLocation(literal2->GetLabel()), 8 * 4u); |
| 1131 | EXPECT_EQ(__ GetLabelLocation(literal3->GetLabel()), 10 * 4u); |
| 1132 | } |
| 1133 | |
| 1134 | TEST_F(AssemblerMIPS64Test, LongLiteralAlignmentNoNop) { |
| 1135 | mips64::Literal* literal1 = __ NewLiteral<uint64_t>(UINT64_C(0x0123456789ABCDEF)); |
| 1136 | mips64::Literal* literal2 = __ NewLiteral<uint64_t>(UINT64_C(0x5555555555555555)); |
| 1137 | __ LoadLiteral(mips64::A1, mips64::kLoadDoubleword, literal1); |
| 1138 | __ LoadLiteral(mips64::A2, mips64::kLoadDoubleword, literal2); |
| 1139 | __ LoadLabelAddress(mips64::V0, literal1->GetLabel()); |
| 1140 | __ LoadLabelAddress(mips64::V1, literal2->GetLabel()); |
| 1141 | |
| 1142 | std::string expected = |
| 1143 | "ldpc $a1, 1f\n" |
| 1144 | // The GNU assembler incorrectly requires the ldpc instruction to be located |
| 1145 | // at an address that's a multiple of 8. TODO: Remove this workaround if/when |
| 1146 | // the assembler is fixed. |
| 1147 | // "ldpc $a2, 2f\n" |
| 1148 | ".word 0xECD80003\n" |
| 1149 | "lapc $v0, 1f\n" |
| 1150 | "lapc $v1, 2f\n" |
| 1151 | "1:\n" |
| 1152 | ".dword 0x0123456789ABCDEF\n" |
| 1153 | "2:\n" |
| 1154 | ".dword 0x5555555555555555\n"; |
| 1155 | DriverStr(expected, "LongLiteralAlignmentNoNop"); |
| 1156 | EXPECT_EQ(__ GetLabelLocation(literal1->GetLabel()), 4 * 4u); |
| 1157 | EXPECT_EQ(__ GetLabelLocation(literal2->GetLabel()), 6 * 4u); |
| 1158 | } |
| 1159 | |
| 1160 | TEST_F(AssemblerMIPS64Test, FarLongLiteralAlignmentNop) { |
| 1161 | mips64::Literal* literal = __ NewLiteral<uint64_t>(UINT64_C(0x0123456789ABCDEF)); |
| 1162 | __ LoadLiteral(mips64::V0, mips64::kLoadDoubleword, literal); |
| 1163 | __ LoadLabelAddress(mips64::V1, literal->GetLabel()); |
| 1164 | constexpr uint32_t kAdduCount = 0x3FFDF; |
| 1165 | for (uint32_t i = 0; i != kAdduCount; ++i) { |
| 1166 | __ Addu(mips64::ZERO, mips64::ZERO, mips64::ZERO); |
| 1167 | } |
| 1168 | // A nop will be inserted here before the 64-bit literal. |
| 1169 | |
| 1170 | std::string expected = |
| 1171 | "1:\n" |
| 1172 | "auipc $at, %hi(3f - 1b)\n" |
| 1173 | "ld $v0, %lo(3f - 1b)($at)\n" |
| 1174 | "2:\n" |
| 1175 | "auipc $at, %hi(3f - 2b)\n" |
Alexey Frunze | f63f569 | 2016-12-13 17:43:11 -0800 | [diff] [blame] | 1176 | "daddiu $v1, $at, %lo(3f - 2b)\n" + |
Alexey Frunze | 19f6c69 | 2016-11-30 19:19:55 -0800 | [diff] [blame] | 1177 | RepeatInsn(kAdduCount, "addu $zero, $zero, $zero\n") + |
| 1178 | "nop\n" |
| 1179 | "3:\n" |
| 1180 | ".dword 0x0123456789ABCDEF\n"; |
| 1181 | DriverStr(expected, "FarLongLiteralAlignmentNop"); |
| 1182 | EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (5 + kAdduCount) * 4); |
| 1183 | } |
| 1184 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 1185 | TEST_F(AssemblerMIPS64Test, Addu) { |
| 1186 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Addu, "addu ${reg1}, ${reg2}, ${reg3}"), "addu"); |
| 1187 | } |
| 1188 | |
| 1189 | TEST_F(AssemblerMIPS64Test, Addiu) { |
| 1190 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Addiu, -16, "addiu ${reg1}, ${reg2}, {imm}"), |
| 1191 | "addiu"); |
| 1192 | } |
| 1193 | |
| 1194 | TEST_F(AssemblerMIPS64Test, Daddu) { |
| 1195 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Daddu, "daddu ${reg1}, ${reg2}, ${reg3}"), "daddu"); |
| 1196 | } |
| 1197 | |
| 1198 | TEST_F(AssemblerMIPS64Test, Daddiu) { |
| 1199 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Daddiu, -16, "daddiu ${reg1}, ${reg2}, {imm}"), |
| 1200 | "daddiu"); |
| 1201 | } |
| 1202 | |
| 1203 | TEST_F(AssemblerMIPS64Test, Subu) { |
| 1204 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Subu, "subu ${reg1}, ${reg2}, ${reg3}"), "subu"); |
| 1205 | } |
| 1206 | |
| 1207 | TEST_F(AssemblerMIPS64Test, Dsubu) { |
| 1208 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsubu, "dsubu ${reg1}, ${reg2}, ${reg3}"), "dsubu"); |
| 1209 | } |
| 1210 | |
| 1211 | TEST_F(AssemblerMIPS64Test, MulR6) { |
| 1212 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::MulR6, "mul ${reg1}, ${reg2}, ${reg3}"), "mulR6"); |
| 1213 | } |
| 1214 | |
| 1215 | TEST_F(AssemblerMIPS64Test, DivR6) { |
| 1216 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::DivR6, "div ${reg1}, ${reg2}, ${reg3}"), "divR6"); |
| 1217 | } |
| 1218 | |
| 1219 | TEST_F(AssemblerMIPS64Test, ModR6) { |
| 1220 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::ModR6, "mod ${reg1}, ${reg2}, ${reg3}"), "modR6"); |
| 1221 | } |
| 1222 | |
| 1223 | TEST_F(AssemblerMIPS64Test, DivuR6) { |
| 1224 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::DivuR6, "divu ${reg1}, ${reg2}, ${reg3}"), |
| 1225 | "divuR6"); |
| 1226 | } |
| 1227 | |
| 1228 | TEST_F(AssemblerMIPS64Test, ModuR6) { |
| 1229 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::ModuR6, "modu ${reg1}, ${reg2}, ${reg3}"), |
| 1230 | "moduR6"); |
| 1231 | } |
| 1232 | |
| 1233 | TEST_F(AssemblerMIPS64Test, Dmul) { |
| 1234 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmul, "dmul ${reg1}, ${reg2}, ${reg3}"), "dmul"); |
| 1235 | } |
| 1236 | |
| 1237 | TEST_F(AssemblerMIPS64Test, Ddiv) { |
| 1238 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Ddiv, "ddiv ${reg1}, ${reg2}, ${reg3}"), "ddiv"); |
| 1239 | } |
| 1240 | |
| 1241 | TEST_F(AssemblerMIPS64Test, Dmod) { |
| 1242 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmod, "dmod ${reg1}, ${reg2}, ${reg3}"), "dmod"); |
| 1243 | } |
| 1244 | |
| 1245 | TEST_F(AssemblerMIPS64Test, Ddivu) { |
| 1246 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Ddivu, "ddivu ${reg1}, ${reg2}, ${reg3}"), "ddivu"); |
| 1247 | } |
| 1248 | |
| 1249 | TEST_F(AssemblerMIPS64Test, Dmodu) { |
| 1250 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmodu, "dmodu ${reg1}, ${reg2}, ${reg3}"), "dmodu"); |
| 1251 | } |
| 1252 | |
| 1253 | TEST_F(AssemblerMIPS64Test, And) { |
| 1254 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::And, "and ${reg1}, ${reg2}, ${reg3}"), "and"); |
| 1255 | } |
| 1256 | |
| 1257 | TEST_F(AssemblerMIPS64Test, Andi) { |
| 1258 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Andi, 16, "andi ${reg1}, ${reg2}, {imm}"), "andi"); |
| 1259 | } |
| 1260 | |
| 1261 | TEST_F(AssemblerMIPS64Test, Or) { |
| 1262 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Or, "or ${reg1}, ${reg2}, ${reg3}"), "or"); |
| 1263 | } |
| 1264 | |
| 1265 | TEST_F(AssemblerMIPS64Test, Ori) { |
| 1266 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Ori, 16, "ori ${reg1}, ${reg2}, {imm}"), "ori"); |
| 1267 | } |
| 1268 | |
| 1269 | TEST_F(AssemblerMIPS64Test, Xor) { |
| 1270 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Xor, "xor ${reg1}, ${reg2}, ${reg3}"), "xor"); |
| 1271 | } |
| 1272 | |
| 1273 | TEST_F(AssemblerMIPS64Test, Xori) { |
| 1274 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Xori, 16, "xori ${reg1}, ${reg2}, {imm}"), "xori"); |
| 1275 | } |
| 1276 | |
| 1277 | TEST_F(AssemblerMIPS64Test, Nor) { |
| 1278 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Nor, "nor ${reg1}, ${reg2}, ${reg3}"), "nor"); |
| 1279 | } |
| 1280 | |
| 1281 | TEST_F(AssemblerMIPS64Test, Lb) { |
| 1282 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lb, -16, "lb ${reg1}, {imm}(${reg2})"), "lb"); |
| 1283 | } |
| 1284 | |
| 1285 | TEST_F(AssemblerMIPS64Test, Lh) { |
| 1286 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lh, -16, "lh ${reg1}, {imm}(${reg2})"), "lh"); |
| 1287 | } |
| 1288 | |
| 1289 | TEST_F(AssemblerMIPS64Test, Lw) { |
| 1290 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lw, -16, "lw ${reg1}, {imm}(${reg2})"), "lw"); |
| 1291 | } |
| 1292 | |
| 1293 | TEST_F(AssemblerMIPS64Test, Ld) { |
| 1294 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Ld, -16, "ld ${reg1}, {imm}(${reg2})"), "ld"); |
| 1295 | } |
| 1296 | |
| 1297 | TEST_F(AssemblerMIPS64Test, Lbu) { |
| 1298 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lbu, -16, "lbu ${reg1}, {imm}(${reg2})"), "lbu"); |
| 1299 | } |
| 1300 | |
| 1301 | TEST_F(AssemblerMIPS64Test, Lhu) { |
| 1302 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lhu, -16, "lhu ${reg1}, {imm}(${reg2})"), "lhu"); |
| 1303 | } |
| 1304 | |
| 1305 | TEST_F(AssemblerMIPS64Test, Lwu) { |
| 1306 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lwu, -16, "lwu ${reg1}, {imm}(${reg2})"), "lwu"); |
| 1307 | } |
| 1308 | |
| 1309 | TEST_F(AssemblerMIPS64Test, Lui) { |
| 1310 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Lui, 16, "lui ${reg}, {imm}"), "lui"); |
| 1311 | } |
| 1312 | |
Alexey Frunze | c061de1 | 2017-02-14 13:27:23 -0800 | [diff] [blame] | 1313 | TEST_F(AssemblerMIPS64Test, Daui) { |
| 1314 | std::vector<mips64::GpuRegister*> reg1_registers = GetRegisters(); |
| 1315 | std::vector<mips64::GpuRegister*> reg2_registers = GetRegisters(); |
| 1316 | reg2_registers.erase(reg2_registers.begin()); // reg2 can't be ZERO, remove it. |
| 1317 | std::vector<int64_t> imms = CreateImmediateValuesBits(/* imm_bits */ 16, /* as_uint */ true); |
| 1318 | WarnOnCombinations(reg1_registers.size() * reg2_registers.size() * imms.size()); |
| 1319 | std::ostringstream expected; |
| 1320 | for (mips64::GpuRegister* reg1 : reg1_registers) { |
| 1321 | for (mips64::GpuRegister* reg2 : reg2_registers) { |
| 1322 | for (int64_t imm : imms) { |
| 1323 | __ Daui(*reg1, *reg2, imm); |
| 1324 | expected << "daui $" << *reg1 << ", $" << *reg2 << ", " << imm << "\n"; |
| 1325 | } |
| 1326 | } |
| 1327 | } |
| 1328 | DriverStr(expected.str(), "daui"); |
| 1329 | } |
| 1330 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 1331 | TEST_F(AssemblerMIPS64Test, Dahi) { |
| 1332 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Dahi, 16, "dahi ${reg}, ${reg}, {imm}"), "dahi"); |
| 1333 | } |
| 1334 | |
| 1335 | TEST_F(AssemblerMIPS64Test, Dati) { |
| 1336 | DriverStr(RepeatRIb(&mips64::Mips64Assembler::Dati, 16, "dati ${reg}, ${reg}, {imm}"), "dati"); |
| 1337 | } |
| 1338 | |
| 1339 | TEST_F(AssemblerMIPS64Test, Sb) { |
| 1340 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sb, -16, "sb ${reg1}, {imm}(${reg2})"), "sb"); |
| 1341 | } |
| 1342 | |
| 1343 | TEST_F(AssemblerMIPS64Test, Sh) { |
| 1344 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sh, -16, "sh ${reg1}, {imm}(${reg2})"), "sh"); |
| 1345 | } |
| 1346 | |
| 1347 | TEST_F(AssemblerMIPS64Test, Sw) { |
| 1348 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sw, -16, "sw ${reg1}, {imm}(${reg2})"), "sw"); |
| 1349 | } |
| 1350 | |
| 1351 | TEST_F(AssemblerMIPS64Test, Sd) { |
| 1352 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sd, -16, "sd ${reg1}, {imm}(${reg2})"), "sd"); |
| 1353 | } |
| 1354 | |
| 1355 | TEST_F(AssemblerMIPS64Test, Slt) { |
| 1356 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Slt, "slt ${reg1}, ${reg2}, ${reg3}"), "slt"); |
| 1357 | } |
| 1358 | |
| 1359 | TEST_F(AssemblerMIPS64Test, Sltu) { |
| 1360 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Sltu, "sltu ${reg1}, ${reg2}, ${reg3}"), "sltu"); |
| 1361 | } |
| 1362 | |
| 1363 | TEST_F(AssemblerMIPS64Test, Slti) { |
| 1364 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Slti, -16, "slti ${reg1}, ${reg2}, {imm}"), |
| 1365 | "slti"); |
| 1366 | } |
| 1367 | |
| 1368 | TEST_F(AssemblerMIPS64Test, Sltiu) { |
| 1369 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sltiu, -16, "sltiu ${reg1}, ${reg2}, {imm}"), |
| 1370 | "sltiu"); |
| 1371 | } |
| 1372 | |
| 1373 | TEST_F(AssemblerMIPS64Test, Move) { |
| 1374 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Move, "or ${reg1}, ${reg2}, $zero"), "move"); |
| 1375 | } |
| 1376 | |
| 1377 | TEST_F(AssemblerMIPS64Test, Clear) { |
| 1378 | DriverStr(RepeatR(&mips64::Mips64Assembler::Clear, "or ${reg}, $zero, $zero"), "clear"); |
| 1379 | } |
| 1380 | |
| 1381 | TEST_F(AssemblerMIPS64Test, Not) { |
| 1382 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Not, "nor ${reg1}, ${reg2}, $zero"), "not"); |
| 1383 | } |
| 1384 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 1385 | TEST_F(AssemblerMIPS64Test, Bitswap) { |
| 1386 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Bitswap, "bitswap ${reg1}, ${reg2}"), "bitswap"); |
| 1387 | } |
| 1388 | |
| 1389 | TEST_F(AssemblerMIPS64Test, Dbitswap) { |
| 1390 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Dbitswap, "dbitswap ${reg1}, ${reg2}"), "dbitswap"); |
| 1391 | } |
| 1392 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1393 | TEST_F(AssemblerMIPS64Test, Seb) { |
| 1394 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Seb, "seb ${reg1}, ${reg2}"), "seb"); |
| 1395 | } |
| 1396 | |
| 1397 | TEST_F(AssemblerMIPS64Test, Seh) { |
| 1398 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Seh, "seh ${reg1}, ${reg2}"), "seh"); |
| 1399 | } |
| 1400 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 1401 | TEST_F(AssemblerMIPS64Test, Dsbh) { |
| 1402 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Dsbh, "dsbh ${reg1}, ${reg2}"), "dsbh"); |
| 1403 | } |
| 1404 | |
| 1405 | TEST_F(AssemblerMIPS64Test, Dshd) { |
| 1406 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Dshd, "dshd ${reg1}, ${reg2}"), "dshd"); |
| 1407 | } |
| 1408 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 1409 | TEST_F(AssemblerMIPS64Test, Dext) { |
| 1410 | std::vector<mips64::GpuRegister*> reg1_registers = GetRegisters(); |
| 1411 | std::vector<mips64::GpuRegister*> reg2_registers = GetRegisters(); |
| 1412 | WarnOnCombinations(reg1_registers.size() * reg2_registers.size() * 33 * 16); |
| 1413 | std::ostringstream expected; |
| 1414 | for (mips64::GpuRegister* reg1 : reg1_registers) { |
| 1415 | for (mips64::GpuRegister* reg2 : reg2_registers) { |
| 1416 | for (int32_t pos = 0; pos < 32; pos++) { |
| 1417 | for (int32_t size = 1; size <= 32; size++) { |
| 1418 | __ Dext(*reg1, *reg2, pos, size); |
| 1419 | expected << "dext $" << *reg1 << ", $" << *reg2 << ", " << pos << ", " << size << "\n"; |
| 1420 | } |
| 1421 | } |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | DriverStr(expected.str(), "Dext"); |
| 1426 | } |
| 1427 | |
| 1428 | TEST_F(AssemblerMIPS64Test, Dinsu) { |
| 1429 | std::vector<mips64::GpuRegister*> reg1_registers = GetRegisters(); |
| 1430 | std::vector<mips64::GpuRegister*> reg2_registers = GetRegisters(); |
| 1431 | WarnOnCombinations(reg1_registers.size() * reg2_registers.size() * 33 * 16); |
| 1432 | std::ostringstream expected; |
| 1433 | for (mips64::GpuRegister* reg1 : reg1_registers) { |
| 1434 | for (mips64::GpuRegister* reg2 : reg2_registers) { |
| 1435 | for (int32_t pos = 32; pos < 64; pos++) { |
| 1436 | for (int32_t size = 1; pos + size <= 64; size++) { |
| 1437 | __ Dinsu(*reg1, *reg2, pos, size); |
| 1438 | expected << "dinsu $" << *reg1 << ", $" << *reg2 << ", " << pos << ", " << size << "\n"; |
| 1439 | } |
| 1440 | } |
| 1441 | } |
| 1442 | } |
| 1443 | |
| 1444 | DriverStr(expected.str(), "Dinsu"); |
| 1445 | } |
| 1446 | |
Chris Larsen | e366059 | 2016-11-09 11:13:42 -0800 | [diff] [blame] | 1447 | TEST_F(AssemblerMIPS64Test, Lsa) { |
| 1448 | DriverStr(RepeatRRRIb(&mips64::Mips64Assembler::Lsa, |
| 1449 | 2, |
| 1450 | "lsa ${reg1}, ${reg2}, ${reg3}, {imm}", |
| 1451 | 1), |
| 1452 | "lsa"); |
| 1453 | } |
| 1454 | |
| 1455 | TEST_F(AssemblerMIPS64Test, Dlsa) { |
| 1456 | DriverStr(RepeatRRRIb(&mips64::Mips64Assembler::Dlsa, |
| 1457 | 2, |
| 1458 | "dlsa ${reg1}, ${reg2}, ${reg3}, {imm}", |
| 1459 | 1), |
| 1460 | "dlsa"); |
| 1461 | } |
| 1462 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 1463 | TEST_F(AssemblerMIPS64Test, Wsbh) { |
| 1464 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Wsbh, "wsbh ${reg1}, ${reg2}"), "wsbh"); |
| 1465 | } |
| 1466 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1467 | TEST_F(AssemblerMIPS64Test, Sll) { |
| 1468 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sll, 5, "sll ${reg1}, ${reg2}, {imm}"), "sll"); |
| 1469 | } |
| 1470 | |
| 1471 | TEST_F(AssemblerMIPS64Test, Srl) { |
| 1472 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Srl, 5, "srl ${reg1}, ${reg2}, {imm}"), "srl"); |
| 1473 | } |
| 1474 | |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1475 | TEST_F(AssemblerMIPS64Test, Rotr) { |
| 1476 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Rotr, 5, "rotr ${reg1}, ${reg2}, {imm}"), "rotr"); |
| 1477 | } |
| 1478 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1479 | TEST_F(AssemblerMIPS64Test, Sra) { |
| 1480 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sra, 5, "sra ${reg1}, ${reg2}, {imm}"), "sra"); |
| 1481 | } |
| 1482 | |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1483 | TEST_F(AssemblerMIPS64Test, Sllv) { |
| 1484 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Sllv, "sllv ${reg1}, ${reg2}, ${reg3}"), "sllv"); |
| 1485 | } |
| 1486 | |
| 1487 | TEST_F(AssemblerMIPS64Test, Srlv) { |
| 1488 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Srlv, "srlv ${reg1}, ${reg2}, ${reg3}"), "srlv"); |
| 1489 | } |
| 1490 | |
| 1491 | TEST_F(AssemblerMIPS64Test, Rotrv) { |
| 1492 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Rotrv, "rotrv ${reg1}, ${reg2}, ${reg3}"), "rotrv"); |
| 1493 | } |
| 1494 | |
| 1495 | TEST_F(AssemblerMIPS64Test, Srav) { |
| 1496 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Srav, "srav ${reg1}, ${reg2}, ${reg3}"), "srav"); |
| 1497 | } |
| 1498 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1499 | TEST_F(AssemblerMIPS64Test, Dsll) { |
| 1500 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsll, 5, "dsll ${reg1}, ${reg2}, {imm}"), "dsll"); |
| 1501 | } |
| 1502 | |
| 1503 | TEST_F(AssemblerMIPS64Test, Dsrl) { |
| 1504 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsrl, 5, "dsrl ${reg1}, ${reg2}, {imm}"), "dsrl"); |
| 1505 | } |
| 1506 | |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1507 | TEST_F(AssemblerMIPS64Test, Drotr) { |
| 1508 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Drotr, 5, "drotr ${reg1}, ${reg2}, {imm}"), |
| 1509 | "drotr"); |
| 1510 | } |
| 1511 | |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1512 | TEST_F(AssemblerMIPS64Test, Dsra) { |
| 1513 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsra, 5, "dsra ${reg1}, ${reg2}, {imm}"), "dsra"); |
| 1514 | } |
| 1515 | |
| 1516 | TEST_F(AssemblerMIPS64Test, Dsll32) { |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1517 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsll32, 5, "dsll32 ${reg1}, ${reg2}, {imm}"), |
| 1518 | "dsll32"); |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1519 | } |
| 1520 | |
| 1521 | TEST_F(AssemblerMIPS64Test, Dsrl32) { |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1522 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsrl32, 5, "dsrl32 ${reg1}, ${reg2}, {imm}"), |
| 1523 | "dsrl32"); |
| 1524 | } |
| 1525 | |
| 1526 | TEST_F(AssemblerMIPS64Test, Drotr32) { |
| 1527 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Drotr32, 5, "drotr32 ${reg1}, ${reg2}, {imm}"), |
| 1528 | "drotr32"); |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1529 | } |
| 1530 | |
| 1531 | TEST_F(AssemblerMIPS64Test, Dsra32) { |
Chris Larsen | 98a73e1 | 2015-10-19 14:17:16 -0700 | [diff] [blame] | 1532 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Dsra32, 5, "dsra32 ${reg1}, ${reg2}, {imm}"), |
| 1533 | "dsra32"); |
Chris Larsen | 5141763 | 2015-10-02 13:24:25 -0700 | [diff] [blame] | 1534 | } |
| 1535 | |
Goran Jakovljevic | 95f2714 | 2017-01-20 11:11:11 +0100 | [diff] [blame] | 1536 | TEST_F(AssemblerMIPS64Test, Dsllv) { |
| 1537 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsllv, "dsllv ${reg1}, ${reg2}, ${reg3}"), "dsllv"); |
| 1538 | } |
| 1539 | |
| 1540 | TEST_F(AssemblerMIPS64Test, Dsrlv) { |
| 1541 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsrlv, "dsrlv ${reg1}, ${reg2}, ${reg3}"), "dsrlv"); |
| 1542 | } |
| 1543 | |
| 1544 | TEST_F(AssemblerMIPS64Test, Dsrav) { |
| 1545 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsrav, "dsrav ${reg1}, ${reg2}, ${reg3}"), "dsrav"); |
| 1546 | } |
| 1547 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 1548 | TEST_F(AssemblerMIPS64Test, Sc) { |
| 1549 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sc, -9, "sc ${reg1}, {imm}(${reg2})"), "sc"); |
| 1550 | } |
| 1551 | |
| 1552 | TEST_F(AssemblerMIPS64Test, Scd) { |
| 1553 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Scd, -9, "scd ${reg1}, {imm}(${reg2})"), "scd"); |
| 1554 | } |
| 1555 | |
| 1556 | TEST_F(AssemblerMIPS64Test, Ll) { |
| 1557 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Ll, -9, "ll ${reg1}, {imm}(${reg2})"), "ll"); |
| 1558 | } |
| 1559 | |
| 1560 | TEST_F(AssemblerMIPS64Test, Lld) { |
| 1561 | DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lld, -9, "lld ${reg1}, {imm}(${reg2})"), "lld"); |
| 1562 | } |
| 1563 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 1564 | TEST_F(AssemblerMIPS64Test, Seleqz) { |
| 1565 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Seleqz, "seleqz ${reg1}, ${reg2}, ${reg3}"), |
| 1566 | "seleqz"); |
| 1567 | } |
| 1568 | |
| 1569 | TEST_F(AssemblerMIPS64Test, Selnez) { |
| 1570 | DriverStr(RepeatRRR(&mips64::Mips64Assembler::Selnez, "selnez ${reg1}, ${reg2}, ${reg3}"), |
| 1571 | "selnez"); |
| 1572 | } |
| 1573 | |
| 1574 | TEST_F(AssemblerMIPS64Test, Clz) { |
| 1575 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Clz, "clz ${reg1}, ${reg2}"), "clz"); |
| 1576 | } |
| 1577 | |
| 1578 | TEST_F(AssemblerMIPS64Test, Clo) { |
| 1579 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Clo, "clo ${reg1}, ${reg2}"), "clo"); |
| 1580 | } |
| 1581 | |
| 1582 | TEST_F(AssemblerMIPS64Test, Dclz) { |
| 1583 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Dclz, "dclz ${reg1}, ${reg2}"), "dclz"); |
| 1584 | } |
| 1585 | |
| 1586 | TEST_F(AssemblerMIPS64Test, Dclo) { |
| 1587 | DriverStr(RepeatRR(&mips64::Mips64Assembler::Dclo, "dclo ${reg1}, ${reg2}"), "dclo"); |
| 1588 | } |
| 1589 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 1590 | TEST_F(AssemblerMIPS64Test, LoadFromOffset) { |
| 1591 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A0, 0); |
| 1592 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0); |
| 1593 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 1); |
| 1594 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 256); |
| 1595 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 1000); |
| 1596 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0x7FFF); |
| 1597 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0x8000); |
| 1598 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0x8001); |
| 1599 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0x10000); |
| 1600 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0x12345678); |
| 1601 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, -256); |
| 1602 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, -32768); |
| 1603 | __ LoadFromOffset(mips64::kLoadSignedByte, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1604 | |
| 1605 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A0, 0); |
| 1606 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0); |
| 1607 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 1); |
| 1608 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 256); |
| 1609 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 1000); |
| 1610 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0x7FFF); |
| 1611 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0x8000); |
| 1612 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0x8001); |
| 1613 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0x10000); |
| 1614 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0x12345678); |
| 1615 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, -256); |
| 1616 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, -32768); |
| 1617 | __ LoadFromOffset(mips64::kLoadUnsignedByte, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1618 | |
| 1619 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A0, 0); |
| 1620 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0); |
| 1621 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 2); |
| 1622 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 256); |
| 1623 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 1000); |
| 1624 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0x7FFE); |
| 1625 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0x8000); |
| 1626 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0x8002); |
| 1627 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0x10000); |
| 1628 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0x12345678); |
| 1629 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, -256); |
| 1630 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, -32768); |
| 1631 | __ LoadFromOffset(mips64::kLoadSignedHalfword, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1632 | |
| 1633 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A0, 0); |
| 1634 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0); |
| 1635 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 2); |
| 1636 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 256); |
| 1637 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 1000); |
| 1638 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0x7FFE); |
| 1639 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0x8000); |
| 1640 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0x8002); |
| 1641 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0x10000); |
| 1642 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0x12345678); |
| 1643 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, -256); |
| 1644 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, -32768); |
| 1645 | __ LoadFromOffset(mips64::kLoadUnsignedHalfword, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1646 | |
| 1647 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A0, 0); |
| 1648 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0); |
| 1649 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 4); |
| 1650 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 256); |
| 1651 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 1000); |
| 1652 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0x7FFC); |
| 1653 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0x8000); |
| 1654 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0x8004); |
| 1655 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0x10000); |
| 1656 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0x12345678); |
| 1657 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, -256); |
| 1658 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, -32768); |
| 1659 | __ LoadFromOffset(mips64::kLoadWord, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1660 | |
| 1661 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A0, 0); |
| 1662 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0); |
| 1663 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 4); |
| 1664 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 256); |
| 1665 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 1000); |
| 1666 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0x7FFC); |
| 1667 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0x8000); |
| 1668 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0x8004); |
| 1669 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0x10000); |
| 1670 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0x12345678); |
| 1671 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, -256); |
| 1672 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, -32768); |
| 1673 | __ LoadFromOffset(mips64::kLoadUnsignedWord, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1674 | |
| 1675 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A0, 0); |
| 1676 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0); |
| 1677 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 4); |
| 1678 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 256); |
| 1679 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 1000); |
| 1680 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0x7FFC); |
| 1681 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0x8000); |
| 1682 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0x8004); |
| 1683 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0x10000); |
| 1684 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0x12345678); |
| 1685 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, -256); |
| 1686 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, -32768); |
| 1687 | __ LoadFromOffset(mips64::kLoadDoubleword, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1688 | |
| 1689 | const char* expected = |
| 1690 | "lb $a0, 0($a0)\n" |
| 1691 | "lb $a0, 0($a1)\n" |
| 1692 | "lb $a0, 1($a1)\n" |
| 1693 | "lb $a0, 256($a1)\n" |
| 1694 | "lb $a0, 1000($a1)\n" |
| 1695 | "lb $a0, 0x7FFF($a1)\n" |
| 1696 | "ori $at, $zero, 0x8000\n" |
| 1697 | "daddu $at, $at, $a1\n" |
| 1698 | "lb $a0, 0($at)\n" |
| 1699 | "ori $at, $zero, 0x8000\n" |
| 1700 | "daddu $at, $at, $a1\n" |
| 1701 | "lb $a0, 1($at)\n" |
| 1702 | "lui $at, 1\n" |
| 1703 | "daddu $at, $at, $a1\n" |
| 1704 | "lb $a0, 0($at)\n" |
| 1705 | "lui $at, 0x1234\n" |
| 1706 | "ori $at, 0x5678\n" |
| 1707 | "daddu $at, $at, $a1\n" |
| 1708 | "lb $a0, 0($at)\n" |
| 1709 | "lb $a0, -256($a1)\n" |
| 1710 | "lb $a0, -32768($a1)\n" |
| 1711 | "lui $at, 0xABCD\n" |
| 1712 | "ori $at, 0xEF00\n" |
| 1713 | "daddu $at, $at, $a1\n" |
| 1714 | "lb $a0, 0($at)\n" |
| 1715 | |
| 1716 | "lbu $a0, 0($a0)\n" |
| 1717 | "lbu $a0, 0($a1)\n" |
| 1718 | "lbu $a0, 1($a1)\n" |
| 1719 | "lbu $a0, 256($a1)\n" |
| 1720 | "lbu $a0, 1000($a1)\n" |
| 1721 | "lbu $a0, 0x7FFF($a1)\n" |
| 1722 | "ori $at, $zero, 0x8000\n" |
| 1723 | "daddu $at, $at, $a1\n" |
| 1724 | "lbu $a0, 0($at)\n" |
| 1725 | "ori $at, $zero, 0x8000\n" |
| 1726 | "daddu $at, $at, $a1\n" |
| 1727 | "lbu $a0, 1($at)\n" |
| 1728 | "lui $at, 1\n" |
| 1729 | "daddu $at, $at, $a1\n" |
| 1730 | "lbu $a0, 0($at)\n" |
| 1731 | "lui $at, 0x1234\n" |
| 1732 | "ori $at, 0x5678\n" |
| 1733 | "daddu $at, $at, $a1\n" |
| 1734 | "lbu $a0, 0($at)\n" |
| 1735 | "lbu $a0, -256($a1)\n" |
| 1736 | "lbu $a0, -32768($a1)\n" |
| 1737 | "lui $at, 0xABCD\n" |
| 1738 | "ori $at, 0xEF00\n" |
| 1739 | "daddu $at, $at, $a1\n" |
| 1740 | "lbu $a0, 0($at)\n" |
| 1741 | |
| 1742 | "lh $a0, 0($a0)\n" |
| 1743 | "lh $a0, 0($a1)\n" |
| 1744 | "lh $a0, 2($a1)\n" |
| 1745 | "lh $a0, 256($a1)\n" |
| 1746 | "lh $a0, 1000($a1)\n" |
| 1747 | "lh $a0, 0x7FFE($a1)\n" |
| 1748 | "ori $at, $zero, 0x8000\n" |
| 1749 | "daddu $at, $at, $a1\n" |
| 1750 | "lh $a0, 0($at)\n" |
| 1751 | "ori $at, $zero, 0x8000\n" |
| 1752 | "daddu $at, $at, $a1\n" |
| 1753 | "lh $a0, 2($at)\n" |
| 1754 | "lui $at, 1\n" |
| 1755 | "daddu $at, $at, $a1\n" |
| 1756 | "lh $a0, 0($at)\n" |
| 1757 | "lui $at, 0x1234\n" |
| 1758 | "ori $at, 0x5678\n" |
| 1759 | "daddu $at, $at, $a1\n" |
| 1760 | "lh $a0, 0($at)\n" |
| 1761 | "lh $a0, -256($a1)\n" |
| 1762 | "lh $a0, -32768($a1)\n" |
| 1763 | "lui $at, 0xABCD\n" |
| 1764 | "ori $at, 0xEF00\n" |
| 1765 | "daddu $at, $at, $a1\n" |
| 1766 | "lh $a0, 0($at)\n" |
| 1767 | |
| 1768 | "lhu $a0, 0($a0)\n" |
| 1769 | "lhu $a0, 0($a1)\n" |
| 1770 | "lhu $a0, 2($a1)\n" |
| 1771 | "lhu $a0, 256($a1)\n" |
| 1772 | "lhu $a0, 1000($a1)\n" |
| 1773 | "lhu $a0, 0x7FFE($a1)\n" |
| 1774 | "ori $at, $zero, 0x8000\n" |
| 1775 | "daddu $at, $at, $a1\n" |
| 1776 | "lhu $a0, 0($at)\n" |
| 1777 | "ori $at, $zero, 0x8000\n" |
| 1778 | "daddu $at, $at, $a1\n" |
| 1779 | "lhu $a0, 2($at)\n" |
| 1780 | "lui $at, 1\n" |
| 1781 | "daddu $at, $at, $a1\n" |
| 1782 | "lhu $a0, 0($at)\n" |
| 1783 | "lui $at, 0x1234\n" |
| 1784 | "ori $at, 0x5678\n" |
| 1785 | "daddu $at, $at, $a1\n" |
| 1786 | "lhu $a0, 0($at)\n" |
| 1787 | "lhu $a0, -256($a1)\n" |
| 1788 | "lhu $a0, -32768($a1)\n" |
| 1789 | "lui $at, 0xABCD\n" |
| 1790 | "ori $at, 0xEF00\n" |
| 1791 | "daddu $at, $at, $a1\n" |
| 1792 | "lhu $a0, 0($at)\n" |
| 1793 | |
| 1794 | "lw $a0, 0($a0)\n" |
| 1795 | "lw $a0, 0($a1)\n" |
| 1796 | "lw $a0, 4($a1)\n" |
| 1797 | "lw $a0, 256($a1)\n" |
| 1798 | "lw $a0, 1000($a1)\n" |
| 1799 | "lw $a0, 0x7FFC($a1)\n" |
| 1800 | "ori $at, $zero, 0x8000\n" |
| 1801 | "daddu $at, $at, $a1\n" |
| 1802 | "lw $a0, 0($at)\n" |
| 1803 | "ori $at, $zero, 0x8000\n" |
| 1804 | "daddu $at, $at, $a1\n" |
| 1805 | "lw $a0, 4($at)\n" |
| 1806 | "lui $at, 1\n" |
| 1807 | "daddu $at, $at, $a1\n" |
| 1808 | "lw $a0, 0($at)\n" |
| 1809 | "lui $at, 0x1234\n" |
| 1810 | "ori $at, 0x5678\n" |
| 1811 | "daddu $at, $at, $a1\n" |
| 1812 | "lw $a0, 0($at)\n" |
| 1813 | "lw $a0, -256($a1)\n" |
| 1814 | "lw $a0, -32768($a1)\n" |
| 1815 | "lui $at, 0xABCD\n" |
| 1816 | "ori $at, 0xEF00\n" |
| 1817 | "daddu $at, $at, $a1\n" |
| 1818 | "lw $a0, 0($at)\n" |
| 1819 | |
| 1820 | "lwu $a0, 0($a0)\n" |
| 1821 | "lwu $a0, 0($a1)\n" |
| 1822 | "lwu $a0, 4($a1)\n" |
| 1823 | "lwu $a0, 256($a1)\n" |
| 1824 | "lwu $a0, 1000($a1)\n" |
| 1825 | "lwu $a0, 0x7FFC($a1)\n" |
| 1826 | "ori $at, $zero, 0x8000\n" |
| 1827 | "daddu $at, $at, $a1\n" |
| 1828 | "lwu $a0, 0($at)\n" |
| 1829 | "ori $at, $zero, 0x8000\n" |
| 1830 | "daddu $at, $at, $a1\n" |
| 1831 | "lwu $a0, 4($at)\n" |
| 1832 | "lui $at, 1\n" |
| 1833 | "daddu $at, $at, $a1\n" |
| 1834 | "lwu $a0, 0($at)\n" |
| 1835 | "lui $at, 0x1234\n" |
| 1836 | "ori $at, 0x5678\n" |
| 1837 | "daddu $at, $at, $a1\n" |
| 1838 | "lwu $a0, 0($at)\n" |
| 1839 | "lwu $a0, -256($a1)\n" |
| 1840 | "lwu $a0, -32768($a1)\n" |
| 1841 | "lui $at, 0xABCD\n" |
| 1842 | "ori $at, 0xEF00\n" |
| 1843 | "daddu $at, $at, $a1\n" |
| 1844 | "lwu $a0, 0($at)\n" |
| 1845 | |
| 1846 | "ld $a0, 0($a0)\n" |
| 1847 | "ld $a0, 0($a1)\n" |
| 1848 | "lwu $a0, 4($a1)\n" |
| 1849 | "lwu $t3, 8($a1)\n" |
| 1850 | "dins $a0, $t3, 32, 32\n" |
| 1851 | "ld $a0, 256($a1)\n" |
| 1852 | "ld $a0, 1000($a1)\n" |
| 1853 | "ori $at, $zero, 0x7FF8\n" |
| 1854 | "daddu $at, $at, $a1\n" |
| 1855 | "lwu $a0, 4($at)\n" |
| 1856 | "lwu $t3, 8($at)\n" |
| 1857 | "dins $a0, $t3, 32, 32\n" |
| 1858 | "ori $at, $zero, 0x8000\n" |
| 1859 | "daddu $at, $at, $a1\n" |
| 1860 | "ld $a0, 0($at)\n" |
| 1861 | "ori $at, $zero, 0x8000\n" |
| 1862 | "daddu $at, $at, $a1\n" |
| 1863 | "lwu $a0, 4($at)\n" |
| 1864 | "lwu $t3, 8($at)\n" |
| 1865 | "dins $a0, $t3, 32, 32\n" |
| 1866 | "lui $at, 1\n" |
| 1867 | "daddu $at, $at, $a1\n" |
| 1868 | "ld $a0, 0($at)\n" |
| 1869 | "lui $at, 0x1234\n" |
| 1870 | "ori $at, 0x5678\n" |
| 1871 | "daddu $at, $at, $a1\n" |
| 1872 | "ld $a0, 0($at)\n" |
| 1873 | "ld $a0, -256($a1)\n" |
| 1874 | "ld $a0, -32768($a1)\n" |
| 1875 | "lui $at, 0xABCD\n" |
| 1876 | "ori $at, 0xEF00\n" |
| 1877 | "daddu $at, $at, $a1\n" |
| 1878 | "ld $a0, 0($at)\n"; |
| 1879 | DriverStr(expected, "LoadFromOffset"); |
| 1880 | } |
| 1881 | |
| 1882 | TEST_F(AssemblerMIPS64Test, LoadFpuFromOffset) { |
| 1883 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0); |
| 1884 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 4); |
| 1885 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 256); |
| 1886 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0x7FFC); |
| 1887 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0x8000); |
| 1888 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0x8004); |
| 1889 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0x10000); |
| 1890 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0x12345678); |
| 1891 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, -256); |
| 1892 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, -32768); |
| 1893 | __ LoadFpuFromOffset(mips64::kLoadWord, mips64::F0, mips64::A0, 0xABCDEF00); |
| 1894 | |
| 1895 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0); |
| 1896 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 4); |
| 1897 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 256); |
| 1898 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0x7FFC); |
| 1899 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0x8000); |
| 1900 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0x8004); |
| 1901 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0x10000); |
| 1902 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0x12345678); |
| 1903 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, -256); |
| 1904 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, -32768); |
| 1905 | __ LoadFpuFromOffset(mips64::kLoadDoubleword, mips64::F0, mips64::A0, 0xABCDEF00); |
| 1906 | |
| 1907 | const char* expected = |
| 1908 | "lwc1 $f0, 0($a0)\n" |
| 1909 | "lwc1 $f0, 4($a0)\n" |
| 1910 | "lwc1 $f0, 256($a0)\n" |
| 1911 | "lwc1 $f0, 0x7FFC($a0)\n" |
| 1912 | "ori $at, $zero, 0x8000\n" |
| 1913 | "daddu $at, $at, $a0\n" |
| 1914 | "lwc1 $f0, 0($at)\n" |
| 1915 | "ori $at, $zero, 0x8000\n" |
| 1916 | "daddu $at, $at, $a0\n" |
| 1917 | "lwc1 $f0, 4($at)\n" |
| 1918 | "lui $at, 1\n" |
| 1919 | "daddu $at, $at, $a0\n" |
| 1920 | "lwc1 $f0, 0($at)\n" |
| 1921 | "lui $at, 0x1234\n" |
| 1922 | "ori $at, 0x5678\n" |
| 1923 | "daddu $at, $at, $a0\n" |
| 1924 | "lwc1 $f0, 0($at)\n" |
| 1925 | "lwc1 $f0, -256($a0)\n" |
| 1926 | "lwc1 $f0, -32768($a0)\n" |
| 1927 | "lui $at, 0xABCD\n" |
| 1928 | "ori $at, 0xEF00\n" |
| 1929 | "daddu $at, $at, $a0\n" |
| 1930 | "lwc1 $f0, 0($at)\n" |
| 1931 | |
| 1932 | "ldc1 $f0, 0($a0)\n" |
| 1933 | "lwc1 $f0, 4($a0)\n" |
| 1934 | "lw $t3, 8($a0)\n" |
| 1935 | "mthc1 $t3, $f0\n" |
| 1936 | "ldc1 $f0, 256($a0)\n" |
| 1937 | "ori $at, $zero, 0x7FF8\n" |
| 1938 | "daddu $at, $at, $a0\n" |
| 1939 | "lwc1 $f0, 4($at)\n" |
| 1940 | "lw $t3, 8($at)\n" |
| 1941 | "mthc1 $t3, $f0\n" |
| 1942 | "ori $at, $zero, 0x8000\n" |
| 1943 | "daddu $at, $at, $a0\n" |
| 1944 | "ldc1 $f0, 0($at)\n" |
| 1945 | "ori $at, $zero, 0x8000\n" |
| 1946 | "daddu $at, $at, $a0\n" |
| 1947 | "lwc1 $f0, 4($at)\n" |
| 1948 | "lw $t3, 8($at)\n" |
| 1949 | "mthc1 $t3, $f0\n" |
| 1950 | "lui $at, 1\n" |
| 1951 | "daddu $at, $at, $a0\n" |
| 1952 | "ldc1 $f0, 0($at)\n" |
| 1953 | "lui $at, 0x1234\n" |
| 1954 | "ori $at, 0x5678\n" |
| 1955 | "daddu $at, $at, $a0\n" |
| 1956 | "ldc1 $f0, 0($at)\n" |
| 1957 | "ldc1 $f0, -256($a0)\n" |
| 1958 | "ldc1 $f0, -32768($a0)\n" |
| 1959 | "lui $at, 0xABCD\n" |
| 1960 | "ori $at, 0xEF00\n" |
| 1961 | "daddu $at, $at, $a0\n" |
| 1962 | "ldc1 $f0, 0($at)\n"; |
| 1963 | DriverStr(expected, "LoadFpuFromOffset"); |
| 1964 | } |
| 1965 | |
| 1966 | TEST_F(AssemblerMIPS64Test, StoreToOffset) { |
| 1967 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A0, 0); |
| 1968 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0); |
| 1969 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 1); |
| 1970 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 256); |
| 1971 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 1000); |
| 1972 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0x7FFF); |
| 1973 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0x8000); |
| 1974 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0x8001); |
| 1975 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0x10000); |
| 1976 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0x12345678); |
| 1977 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, -256); |
| 1978 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, -32768); |
| 1979 | __ StoreToOffset(mips64::kStoreByte, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1980 | |
| 1981 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A0, 0); |
| 1982 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0); |
| 1983 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 2); |
| 1984 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 256); |
| 1985 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 1000); |
| 1986 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0x7FFE); |
| 1987 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0x8000); |
| 1988 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0x8002); |
| 1989 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0x10000); |
| 1990 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0x12345678); |
| 1991 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, -256); |
| 1992 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, -32768); |
| 1993 | __ StoreToOffset(mips64::kStoreHalfword, mips64::A0, mips64::A1, 0xABCDEF00); |
| 1994 | |
| 1995 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A0, 0); |
| 1996 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0); |
| 1997 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 4); |
| 1998 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 256); |
| 1999 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 1000); |
| 2000 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0x7FFC); |
| 2001 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0x8000); |
| 2002 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0x8004); |
| 2003 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0x10000); |
| 2004 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0x12345678); |
| 2005 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, -256); |
| 2006 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, -32768); |
| 2007 | __ StoreToOffset(mips64::kStoreWord, mips64::A0, mips64::A1, 0xABCDEF00); |
| 2008 | |
| 2009 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A0, 0); |
| 2010 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0); |
| 2011 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 4); |
| 2012 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 256); |
| 2013 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 1000); |
| 2014 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0x7FFC); |
| 2015 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0x8000); |
| 2016 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0x8004); |
| 2017 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0x10000); |
| 2018 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0x12345678); |
| 2019 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, -256); |
| 2020 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, -32768); |
| 2021 | __ StoreToOffset(mips64::kStoreDoubleword, mips64::A0, mips64::A1, 0xABCDEF00); |
| 2022 | |
| 2023 | const char* expected = |
| 2024 | "sb $a0, 0($a0)\n" |
| 2025 | "sb $a0, 0($a1)\n" |
| 2026 | "sb $a0, 1($a1)\n" |
| 2027 | "sb $a0, 256($a1)\n" |
| 2028 | "sb $a0, 1000($a1)\n" |
| 2029 | "sb $a0, 0x7FFF($a1)\n" |
| 2030 | "ori $at, $zero, 0x8000\n" |
| 2031 | "daddu $at, $at, $a1\n" |
| 2032 | "sb $a0, 0($at)\n" |
| 2033 | "ori $at, $zero, 0x8000\n" |
| 2034 | "daddu $at, $at, $a1\n" |
| 2035 | "sb $a0, 1($at)\n" |
| 2036 | "lui $at, 1\n" |
| 2037 | "daddu $at, $at, $a1\n" |
| 2038 | "sb $a0, 0($at)\n" |
| 2039 | "lui $at, 0x1234\n" |
| 2040 | "ori $at, 0x5678\n" |
| 2041 | "daddu $at, $at, $a1\n" |
| 2042 | "sb $a0, 0($at)\n" |
| 2043 | "sb $a0, -256($a1)\n" |
| 2044 | "sb $a0, -32768($a1)\n" |
| 2045 | "lui $at, 0xABCD\n" |
| 2046 | "ori $at, 0xEF00\n" |
| 2047 | "daddu $at, $at, $a1\n" |
| 2048 | "sb $a0, 0($at)\n" |
| 2049 | |
| 2050 | "sh $a0, 0($a0)\n" |
| 2051 | "sh $a0, 0($a1)\n" |
| 2052 | "sh $a0, 2($a1)\n" |
| 2053 | "sh $a0, 256($a1)\n" |
| 2054 | "sh $a0, 1000($a1)\n" |
| 2055 | "sh $a0, 0x7FFE($a1)\n" |
| 2056 | "ori $at, $zero, 0x8000\n" |
| 2057 | "daddu $at, $at, $a1\n" |
| 2058 | "sh $a0, 0($at)\n" |
| 2059 | "ori $at, $zero, 0x8000\n" |
| 2060 | "daddu $at, $at, $a1\n" |
| 2061 | "sh $a0, 2($at)\n" |
| 2062 | "lui $at, 1\n" |
| 2063 | "daddu $at, $at, $a1\n" |
| 2064 | "sh $a0, 0($at)\n" |
| 2065 | "lui $at, 0x1234\n" |
| 2066 | "ori $at, 0x5678\n" |
| 2067 | "daddu $at, $at, $a1\n" |
| 2068 | "sh $a0, 0($at)\n" |
| 2069 | "sh $a0, -256($a1)\n" |
| 2070 | "sh $a0, -32768($a1)\n" |
| 2071 | "lui $at, 0xABCD\n" |
| 2072 | "ori $at, 0xEF00\n" |
| 2073 | "daddu $at, $at, $a1\n" |
| 2074 | "sh $a0, 0($at)\n" |
| 2075 | |
| 2076 | "sw $a0, 0($a0)\n" |
| 2077 | "sw $a0, 0($a1)\n" |
| 2078 | "sw $a0, 4($a1)\n" |
| 2079 | "sw $a0, 256($a1)\n" |
| 2080 | "sw $a0, 1000($a1)\n" |
| 2081 | "sw $a0, 0x7FFC($a1)\n" |
| 2082 | "ori $at, $zero, 0x8000\n" |
| 2083 | "daddu $at, $at, $a1\n" |
| 2084 | "sw $a0, 0($at)\n" |
| 2085 | "ori $at, $zero, 0x8000\n" |
| 2086 | "daddu $at, $at, $a1\n" |
| 2087 | "sw $a0, 4($at)\n" |
| 2088 | "lui $at, 1\n" |
| 2089 | "daddu $at, $at, $a1\n" |
| 2090 | "sw $a0, 0($at)\n" |
| 2091 | "lui $at, 0x1234\n" |
| 2092 | "ori $at, 0x5678\n" |
| 2093 | "daddu $at, $at, $a1\n" |
| 2094 | "sw $a0, 0($at)\n" |
| 2095 | "sw $a0, -256($a1)\n" |
| 2096 | "sw $a0, -32768($a1)\n" |
| 2097 | "lui $at, 0xABCD\n" |
| 2098 | "ori $at, 0xEF00\n" |
| 2099 | "daddu $at, $at, $a1\n" |
| 2100 | "sw $a0, 0($at)\n" |
| 2101 | |
| 2102 | "sd $a0, 0($a0)\n" |
| 2103 | "sd $a0, 0($a1)\n" |
| 2104 | "sw $a0, 4($a1)\n" |
| 2105 | "dsrl32 $t3, $a0, 0\n" |
| 2106 | "sw $t3, 8($a1)\n" |
| 2107 | "sd $a0, 256($a1)\n" |
| 2108 | "sd $a0, 1000($a1)\n" |
| 2109 | "ori $at, $zero, 0x7FF8\n" |
| 2110 | "daddu $at, $at, $a1\n" |
| 2111 | "sw $a0, 4($at)\n" |
| 2112 | "dsrl32 $t3, $a0, 0\n" |
| 2113 | "sw $t3, 8($at)\n" |
| 2114 | "ori $at, $zero, 0x8000\n" |
| 2115 | "daddu $at, $at, $a1\n" |
| 2116 | "sd $a0, 0($at)\n" |
| 2117 | "ori $at, $zero, 0x8000\n" |
| 2118 | "daddu $at, $at, $a1\n" |
| 2119 | "sw $a0, 4($at)\n" |
| 2120 | "dsrl32 $t3, $a0, 0\n" |
| 2121 | "sw $t3, 8($at)\n" |
| 2122 | "lui $at, 1\n" |
| 2123 | "daddu $at, $at, $a1\n" |
| 2124 | "sd $a0, 0($at)\n" |
| 2125 | "lui $at, 0x1234\n" |
| 2126 | "ori $at, 0x5678\n" |
| 2127 | "daddu $at, $at, $a1\n" |
| 2128 | "sd $a0, 0($at)\n" |
| 2129 | "sd $a0, -256($a1)\n" |
| 2130 | "sd $a0, -32768($a1)\n" |
| 2131 | "lui $at, 0xABCD\n" |
| 2132 | "ori $at, 0xEF00\n" |
| 2133 | "daddu $at, $at, $a1\n" |
| 2134 | "sd $a0, 0($at)\n"; |
| 2135 | DriverStr(expected, "StoreToOffset"); |
| 2136 | } |
| 2137 | |
| 2138 | TEST_F(AssemblerMIPS64Test, StoreFpuToOffset) { |
| 2139 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0); |
| 2140 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 4); |
| 2141 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 256); |
| 2142 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0x7FFC); |
| 2143 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0x8000); |
| 2144 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0x8004); |
| 2145 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0x10000); |
| 2146 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0x12345678); |
| 2147 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, -256); |
| 2148 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, -32768); |
| 2149 | __ StoreFpuToOffset(mips64::kStoreWord, mips64::F0, mips64::A0, 0xABCDEF00); |
| 2150 | |
| 2151 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0); |
| 2152 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 4); |
| 2153 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 256); |
| 2154 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0x7FFC); |
| 2155 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0x8000); |
| 2156 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0x8004); |
| 2157 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0x10000); |
| 2158 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0x12345678); |
| 2159 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, -256); |
| 2160 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, -32768); |
| 2161 | __ StoreFpuToOffset(mips64::kStoreDoubleword, mips64::F0, mips64::A0, 0xABCDEF00); |
| 2162 | |
| 2163 | const char* expected = |
| 2164 | "swc1 $f0, 0($a0)\n" |
| 2165 | "swc1 $f0, 4($a0)\n" |
| 2166 | "swc1 $f0, 256($a0)\n" |
| 2167 | "swc1 $f0, 0x7FFC($a0)\n" |
| 2168 | "ori $at, $zero, 0x8000\n" |
| 2169 | "daddu $at, $at, $a0\n" |
| 2170 | "swc1 $f0, 0($at)\n" |
| 2171 | "ori $at, $zero, 0x8000\n" |
| 2172 | "daddu $at, $at, $a0\n" |
| 2173 | "swc1 $f0, 4($at)\n" |
| 2174 | "lui $at, 1\n" |
| 2175 | "daddu $at, $at, $a0\n" |
| 2176 | "swc1 $f0, 0($at)\n" |
| 2177 | "lui $at, 0x1234\n" |
| 2178 | "ori $at, 0x5678\n" |
| 2179 | "daddu $at, $at, $a0\n" |
| 2180 | "swc1 $f0, 0($at)\n" |
| 2181 | "swc1 $f0, -256($a0)\n" |
| 2182 | "swc1 $f0, -32768($a0)\n" |
| 2183 | "lui $at, 0xABCD\n" |
| 2184 | "ori $at, 0xEF00\n" |
| 2185 | "daddu $at, $at, $a0\n" |
| 2186 | "swc1 $f0, 0($at)\n" |
| 2187 | |
| 2188 | "sdc1 $f0, 0($a0)\n" |
| 2189 | "mfhc1 $t3, $f0\n" |
| 2190 | "swc1 $f0, 4($a0)\n" |
| 2191 | "sw $t3, 8($a0)\n" |
| 2192 | "sdc1 $f0, 256($a0)\n" |
| 2193 | "ori $at, $zero, 0x7FF8\n" |
| 2194 | "daddu $at, $at, $a0\n" |
| 2195 | "mfhc1 $t3, $f0\n" |
| 2196 | "swc1 $f0, 4($at)\n" |
| 2197 | "sw $t3, 8($at)\n" |
| 2198 | "ori $at, $zero, 0x8000\n" |
| 2199 | "daddu $at, $at, $a0\n" |
| 2200 | "sdc1 $f0, 0($at)\n" |
| 2201 | "ori $at, $zero, 0x8000\n" |
| 2202 | "daddu $at, $at, $a0\n" |
| 2203 | "mfhc1 $t3, $f0\n" |
| 2204 | "swc1 $f0, 4($at)\n" |
| 2205 | "sw $t3, 8($at)\n" |
| 2206 | "lui $at, 1\n" |
| 2207 | "daddu $at, $at, $a0\n" |
| 2208 | "sdc1 $f0, 0($at)\n" |
| 2209 | "lui $at, 0x1234\n" |
| 2210 | "ori $at, 0x5678\n" |
| 2211 | "daddu $at, $at, $a0\n" |
| 2212 | "sdc1 $f0, 0($at)\n" |
| 2213 | "sdc1 $f0, -256($a0)\n" |
| 2214 | "sdc1 $f0, -32768($a0)\n" |
| 2215 | "lui $at, 0xABCD\n" |
| 2216 | "ori $at, 0xEF00\n" |
| 2217 | "daddu $at, $at, $a0\n" |
| 2218 | "sdc1 $f0, 0($at)\n"; |
| 2219 | DriverStr(expected, "StoreFpuToOffset"); |
| 2220 | } |
| 2221 | |
Tijana Jakovljevic | ba89c34 | 2017-03-10 13:36:08 +0100 | [diff] [blame] | 2222 | TEST_F(AssemblerMIPS64Test, StoreConstToOffset) { |
| 2223 | __ StoreConstToOffset(mips64::kStoreByte, 0xFF, mips64::A1, +0, mips64::T8); |
| 2224 | __ StoreConstToOffset(mips64::kStoreHalfword, 0xFFFF, mips64::A1, +0, mips64::T8); |
| 2225 | __ StoreConstToOffset(mips64::kStoreWord, 0x12345678, mips64::A1, +0, mips64::T8); |
| 2226 | __ StoreConstToOffset(mips64::kStoreDoubleword, 0x123456789ABCDEF0, mips64::A1, +0, mips64::T8); |
| 2227 | |
| 2228 | __ StoreConstToOffset(mips64::kStoreByte, 0, mips64::A1, +0, mips64::T8); |
| 2229 | __ StoreConstToOffset(mips64::kStoreHalfword, 0, mips64::A1, +0, mips64::T8); |
| 2230 | __ StoreConstToOffset(mips64::kStoreWord, 0, mips64::A1, +0, mips64::T8); |
| 2231 | __ StoreConstToOffset(mips64::kStoreDoubleword, 0, mips64::A1, +0, mips64::T8); |
| 2232 | |
| 2233 | __ StoreConstToOffset(mips64::kStoreDoubleword, 0x1234567812345678, mips64::A1, +0, mips64::T8); |
| 2234 | __ StoreConstToOffset(mips64::kStoreDoubleword, 0x1234567800000000, mips64::A1, +0, mips64::T8); |
| 2235 | __ StoreConstToOffset(mips64::kStoreDoubleword, 0x0000000012345678, mips64::A1, +0, mips64::T8); |
| 2236 | |
| 2237 | __ StoreConstToOffset(mips64::kStoreWord, 0, mips64::T8, +0, mips64::T8); |
| 2238 | __ StoreConstToOffset(mips64::kStoreWord, 0x12345678, mips64::T8, +0, mips64::T8); |
| 2239 | |
| 2240 | __ StoreConstToOffset(mips64::kStoreWord, 0, mips64::A1, -0xFFF0, mips64::T8); |
| 2241 | __ StoreConstToOffset(mips64::kStoreWord, 0x12345678, mips64::A1, +0xFFF0, mips64::T8); |
| 2242 | |
| 2243 | __ StoreConstToOffset(mips64::kStoreWord, 0, mips64::T8, -0xFFF0, mips64::T8); |
| 2244 | __ StoreConstToOffset(mips64::kStoreWord, 0x12345678, mips64::T8, +0xFFF0, mips64::T8); |
| 2245 | |
| 2246 | const char* expected = |
| 2247 | "ori $t8, $zero, 0xFF\n" |
| 2248 | "sb $t8, 0($a1)\n" |
| 2249 | "ori $t8, $zero, 0xFFFF\n" |
| 2250 | "sh $t8, 0($a1)\n" |
| 2251 | "lui $t8, 0x1234\n" |
| 2252 | "ori $t8, $t8,0x5678\n" |
| 2253 | "sw $t8, 0($a1)\n" |
| 2254 | "lui $t8, 0x9abc\n" |
| 2255 | "ori $t8, $t8,0xdef0\n" |
| 2256 | "dahi $t8, $t8, 0x5679\n" |
| 2257 | "dati $t8, $t8, 0x1234\n" |
| 2258 | "sd $t8, 0($a1)\n" |
| 2259 | "sb $zero, 0($a1)\n" |
| 2260 | "sh $zero, 0($a1)\n" |
| 2261 | "sw $zero, 0($a1)\n" |
| 2262 | "sd $zero, 0($a1)\n" |
| 2263 | "lui $t8, 0x1234\n" |
| 2264 | "ori $t8, $t8,0x5678\n" |
| 2265 | "dins $t8, $t8, 0x20, 0x20\n" |
| 2266 | "sd $t8, 0($a1)\n" |
| 2267 | "lui $t8, 0x246\n" |
| 2268 | "ori $t8, $t8, 0x8acf\n" |
| 2269 | "dsll32 $t8, $t8, 0x3\n" |
| 2270 | "sd $t8, 0($a1)\n" |
| 2271 | "lui $t8, 0x1234\n" |
| 2272 | "ori $t8, $t8, 0x5678\n" |
| 2273 | "sd $t8, 0($a1)\n" |
| 2274 | "sw $zero, 0($t8)\n" |
| 2275 | "lui $at,0x1234\n" |
| 2276 | "ori $at, $at, 0x5678\n" |
| 2277 | "sw $at, 0($t8)\n" |
| 2278 | "lui $at, 0xffff\n" |
| 2279 | "ori $at, $at, 0x10\n" |
| 2280 | "daddu $at, $at, $a1\n" |
| 2281 | "sw $zero, 0($at)\n" |
| 2282 | "li $at, 0xfff0\n" |
| 2283 | "daddu $at, $at, $a1\n" |
| 2284 | "lui $t8, 0x1234\n" |
| 2285 | "ori $t8, $t8, 0x5678\n" |
| 2286 | "sw $t8, 0($at)\n" |
| 2287 | "lui $at, 0xffff\n" |
| 2288 | "ori $at, $at, 0x10\n" |
| 2289 | "daddu $at, $at, $t8\n" |
| 2290 | "sw $zero, 0($at)\n" |
| 2291 | "li $at, 0xfff0\n" |
| 2292 | "daddu $at, $at, $t8\n" |
| 2293 | "lui $t8, 0x1234\n" |
| 2294 | "ori $t8, $t8, 0x5678\n" |
| 2295 | "sw $t8, 0($at)\n"; |
| 2296 | DriverStr(expected, "StoreConstToOffset"); |
| 2297 | } |
Alexey Frunze | 0960ac5 | 2016-12-20 17:24:59 -0800 | [diff] [blame] | 2298 | ////////////////////////////// |
| 2299 | // Loading/adding Constants // |
| 2300 | ////////////////////////////// |
Chris Larsen | c733dca | 2016-05-13 16:11:47 -0700 | [diff] [blame] | 2301 | |
| 2302 | TEST_F(AssemblerMIPS64Test, LoadConst32) { |
| 2303 | // IsUint<16>(value) |
| 2304 | __ LoadConst32(mips64::V0, 0); |
| 2305 | __ LoadConst32(mips64::V0, 65535); |
| 2306 | // IsInt<16>(value) |
| 2307 | __ LoadConst32(mips64::V0, -1); |
| 2308 | __ LoadConst32(mips64::V0, -32768); |
| 2309 | // Everything else |
| 2310 | __ LoadConst32(mips64::V0, 65536); |
| 2311 | __ LoadConst32(mips64::V0, 65537); |
| 2312 | __ LoadConst32(mips64::V0, 2147483647); |
| 2313 | __ LoadConst32(mips64::V0, -32769); |
| 2314 | __ LoadConst32(mips64::V0, -65536); |
| 2315 | __ LoadConst32(mips64::V0, -65537); |
| 2316 | __ LoadConst32(mips64::V0, -2147483647); |
| 2317 | __ LoadConst32(mips64::V0, -2147483648); |
| 2318 | |
| 2319 | const char* expected = |
| 2320 | // IsUint<16>(value) |
| 2321 | "ori $v0, $zero, 0\n" // __ LoadConst32(mips64::V0, 0); |
| 2322 | "ori $v0, $zero, 65535\n" // __ LoadConst32(mips64::V0, 65535); |
| 2323 | // IsInt<16>(value) |
| 2324 | "addiu $v0, $zero, -1\n" // __ LoadConst32(mips64::V0, -1); |
| 2325 | "addiu $v0, $zero, -32768\n" // __ LoadConst32(mips64::V0, -32768); |
| 2326 | // Everything else |
| 2327 | "lui $v0, 1\n" // __ LoadConst32(mips64::V0, 65536); |
| 2328 | "lui $v0, 1\n" // __ LoadConst32(mips64::V0, 65537); |
| 2329 | "ori $v0, 1\n" // " |
| 2330 | "lui $v0, 32767\n" // __ LoadConst32(mips64::V0, 2147483647); |
| 2331 | "ori $v0, 65535\n" // " |
| 2332 | "lui $v0, 65535\n" // __ LoadConst32(mips64::V0, -32769); |
| 2333 | "ori $v0, 32767\n" // " |
| 2334 | "lui $v0, 65535\n" // __ LoadConst32(mips64::V0, -65536); |
| 2335 | "lui $v0, 65534\n" // __ LoadConst32(mips64::V0, -65537); |
| 2336 | "ori $v0, 65535\n" // " |
| 2337 | "lui $v0, 32768\n" // __ LoadConst32(mips64::V0, -2147483647); |
| 2338 | "ori $v0, 1\n" // " |
| 2339 | "lui $v0, 32768\n"; // __ LoadConst32(mips64::V0, -2147483648); |
| 2340 | DriverStr(expected, "LoadConst32"); |
| 2341 | } |
| 2342 | |
Alexey Frunze | 0960ac5 | 2016-12-20 17:24:59 -0800 | [diff] [blame] | 2343 | TEST_F(AssemblerMIPS64Test, Addiu32) { |
| 2344 | __ Addiu32(mips64::A1, mips64::A2, -0x8000); |
| 2345 | __ Addiu32(mips64::A1, mips64::A2, +0); |
| 2346 | __ Addiu32(mips64::A1, mips64::A2, +0x7FFF); |
| 2347 | __ Addiu32(mips64::A1, mips64::A2, -0x8001); |
| 2348 | __ Addiu32(mips64::A1, mips64::A2, +0x8000); |
| 2349 | __ Addiu32(mips64::A1, mips64::A2, -0x10000); |
| 2350 | __ Addiu32(mips64::A1, mips64::A2, +0x10000); |
| 2351 | __ Addiu32(mips64::A1, mips64::A2, +0x12345678); |
| 2352 | |
| 2353 | const char* expected = |
| 2354 | "addiu $a1, $a2, -0x8000\n" |
| 2355 | "addiu $a1, $a2, 0\n" |
| 2356 | "addiu $a1, $a2, 0x7FFF\n" |
| 2357 | "aui $a1, $a2, 0xFFFF\n" |
| 2358 | "addiu $a1, $a1, 0x7FFF\n" |
| 2359 | "aui $a1, $a2, 1\n" |
| 2360 | "addiu $a1, $a1, -0x8000\n" |
| 2361 | "aui $a1, $a2, 0xFFFF\n" |
| 2362 | "aui $a1, $a2, 1\n" |
| 2363 | "aui $a1, $a2, 0x1234\n" |
| 2364 | "addiu $a1, $a1, 0x5678\n"; |
| 2365 | DriverStr(expected, "Addiu32"); |
| 2366 | } |
| 2367 | |
Chris Larsen | c733dca | 2016-05-13 16:11:47 -0700 | [diff] [blame] | 2368 | static uint64_t SignExtend16To64(uint16_t n) { |
| 2369 | return static_cast<int16_t>(n); |
| 2370 | } |
| 2371 | |
| 2372 | // The art::mips64::Mips64Assembler::LoadConst64() method uses a template |
| 2373 | // to minimize the number of instructions needed to load a 64-bit constant |
| 2374 | // value into a register. The template calls various methods which emit |
| 2375 | // MIPS machine instructions. This struct (class) uses the same template |
| 2376 | // but overrides the definitions of the methods which emit MIPS instructions |
| 2377 | // to use methods which simulate the operation of the corresponding MIPS |
| 2378 | // instructions. After invoking LoadConst64() the target register should |
| 2379 | // contain the same 64-bit value as was input to LoadConst64(). If the |
| 2380 | // simulated register doesn't contain the correct value then there is probably |
| 2381 | // an error in the template function. |
| 2382 | struct LoadConst64Tester { |
| 2383 | LoadConst64Tester() { |
| 2384 | // Initialize all of the registers for simulation to zero. |
| 2385 | for (int r = 0; r < 32; r++) { |
| 2386 | regs_[r] = 0; |
| 2387 | } |
| 2388 | // Clear all of the path flags. |
| 2389 | loadconst64_paths_ = art::mips64::kLoadConst64PathZero; |
| 2390 | } |
| 2391 | void Addiu(mips64::GpuRegister rd, mips64::GpuRegister rs, uint16_t c) { |
| 2392 | regs_[rd] = static_cast<int32_t>(regs_[rs] + SignExtend16To64(c)); |
| 2393 | } |
| 2394 | void Daddiu(mips64::GpuRegister rd, mips64::GpuRegister rs, uint16_t c) { |
| 2395 | regs_[rd] = regs_[rs] + SignExtend16To64(c); |
| 2396 | } |
| 2397 | void Dahi(mips64::GpuRegister rd, uint16_t c) { |
| 2398 | regs_[rd] += SignExtend16To64(c) << 32; |
| 2399 | } |
| 2400 | void Dati(mips64::GpuRegister rd, uint16_t c) { |
| 2401 | regs_[rd] += SignExtend16To64(c) << 48; |
| 2402 | } |
| 2403 | void Dinsu(mips64::GpuRegister rt, mips64::GpuRegister rs, int pos, int size) { |
| 2404 | CHECK(IsUint<5>(pos - 32)) << pos; |
| 2405 | CHECK(IsUint<5>(size - 1)) << size; |
| 2406 | CHECK(IsUint<5>(pos + size - 33)) << pos << " + " << size; |
| 2407 | uint64_t src_mask = (UINT64_C(1) << size) - 1; |
| 2408 | uint64_t dsk_mask = ~(src_mask << pos); |
| 2409 | |
| 2410 | regs_[rt] = (regs_[rt] & dsk_mask) | ((regs_[rs] & src_mask) << pos); |
| 2411 | } |
| 2412 | void Dsll(mips64::GpuRegister rd, mips64::GpuRegister rt, int shamt) { |
| 2413 | regs_[rd] = regs_[rt] << (shamt & 0x1f); |
| 2414 | } |
| 2415 | void Dsll32(mips64::GpuRegister rd, mips64::GpuRegister rt, int shamt) { |
| 2416 | regs_[rd] = regs_[rt] << (32 + (shamt & 0x1f)); |
| 2417 | } |
| 2418 | void Dsrl(mips64::GpuRegister rd, mips64::GpuRegister rt, int shamt) { |
| 2419 | regs_[rd] = regs_[rt] >> (shamt & 0x1f); |
| 2420 | } |
| 2421 | void Dsrl32(mips64::GpuRegister rd, mips64::GpuRegister rt, int shamt) { |
| 2422 | regs_[rd] = regs_[rt] >> (32 + (shamt & 0x1f)); |
| 2423 | } |
| 2424 | void Lui(mips64::GpuRegister rd, uint16_t c) { |
| 2425 | regs_[rd] = SignExtend16To64(c) << 16; |
| 2426 | } |
| 2427 | void Ori(mips64::GpuRegister rd, mips64::GpuRegister rs, uint16_t c) { |
| 2428 | regs_[rd] = regs_[rs] | c; |
| 2429 | } |
| 2430 | void LoadConst32(mips64::GpuRegister rd, int32_t c) { |
| 2431 | CHECK_NE(rd, 0); |
| 2432 | mips64::TemplateLoadConst32<LoadConst64Tester>(this, rd, c); |
| 2433 | CHECK_EQ(regs_[rd], static_cast<uint64_t>(c)); |
| 2434 | } |
| 2435 | void LoadConst64(mips64::GpuRegister rd, int64_t c) { |
| 2436 | CHECK_NE(rd, 0); |
| 2437 | mips64::TemplateLoadConst64<LoadConst64Tester>(this, rd, c); |
| 2438 | CHECK_EQ(regs_[rd], static_cast<uint64_t>(c)); |
| 2439 | } |
| 2440 | uint64_t regs_[32]; |
| 2441 | |
| 2442 | // Getter function for loadconst64_paths_. |
| 2443 | int GetPathsCovered() { |
| 2444 | return loadconst64_paths_; |
| 2445 | } |
| 2446 | |
| 2447 | void RecordLoadConst64Path(int value) { |
| 2448 | loadconst64_paths_ |= value; |
| 2449 | } |
| 2450 | |
| 2451 | private: |
| 2452 | // This variable holds a bitmask to tell us which paths were taken |
| 2453 | // through the template function which loads 64-bit values. |
| 2454 | int loadconst64_paths_; |
| 2455 | }; |
| 2456 | |
| 2457 | TEST_F(AssemblerMIPS64Test, LoadConst64) { |
| 2458 | const uint16_t imms[] = { |
| 2459 | 0, 1, 2, 3, 4, 0x33, 0x66, 0x55, 0x99, 0xaa, 0xcc, 0xff, 0x5500, 0x5555, |
| 2460 | 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff, 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, |
| 2461 | 0xaaaa, 0xfffc, 0xfffd, 0xfffe, 0xffff |
| 2462 | }; |
| 2463 | unsigned d0, d1, d2, d3; |
| 2464 | LoadConst64Tester tester; |
| 2465 | |
| 2466 | union { |
| 2467 | int64_t v64; |
| 2468 | uint16_t v16[4]; |
| 2469 | } u; |
| 2470 | |
| 2471 | for (d3 = 0; d3 < sizeof imms / sizeof imms[0]; d3++) { |
| 2472 | u.v16[3] = imms[d3]; |
| 2473 | |
| 2474 | for (d2 = 0; d2 < sizeof imms / sizeof imms[0]; d2++) { |
| 2475 | u.v16[2] = imms[d2]; |
| 2476 | |
| 2477 | for (d1 = 0; d1 < sizeof imms / sizeof imms[0]; d1++) { |
| 2478 | u.v16[1] = imms[d1]; |
| 2479 | |
| 2480 | for (d0 = 0; d0 < sizeof imms / sizeof imms[0]; d0++) { |
| 2481 | u.v16[0] = imms[d0]; |
| 2482 | |
| 2483 | tester.LoadConst64(mips64::V0, u.v64); |
| 2484 | } |
| 2485 | } |
| 2486 | } |
| 2487 | } |
| 2488 | |
| 2489 | // Verify that we tested all paths through the "load 64-bit value" |
| 2490 | // function template. |
| 2491 | EXPECT_EQ(tester.GetPathsCovered(), art::mips64::kLoadConst64PathAllPaths); |
| 2492 | } |
| 2493 | |
Goran Jakovljevic | 5a9e51d | 2017-03-16 16:11:43 +0000 | [diff] [blame^] | 2494 | // MSA instructions. |
| 2495 | |
| 2496 | TEST_F(AssemblerMIPS64Test, AndV) { |
| 2497 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::AndV, "and.v ${reg1}, ${reg2}, ${reg3}"), "and.v"); |
| 2498 | } |
| 2499 | |
| 2500 | TEST_F(AssemblerMIPS64Test, OrV) { |
| 2501 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::OrV, "or.v ${reg1}, ${reg2}, ${reg3}"), "or.v"); |
| 2502 | } |
| 2503 | |
| 2504 | TEST_F(AssemblerMIPS64Test, NorV) { |
| 2505 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::NorV, "nor.v ${reg1}, ${reg2}, ${reg3}"), "nor.v"); |
| 2506 | } |
| 2507 | |
| 2508 | TEST_F(AssemblerMIPS64Test, XorV) { |
| 2509 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::XorV, "xor.v ${reg1}, ${reg2}, ${reg3}"), "xor.v"); |
| 2510 | } |
| 2511 | |
| 2512 | TEST_F(AssemblerMIPS64Test, AddvB) { |
| 2513 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::AddvB, "addv.b ${reg1}, ${reg2}, ${reg3}"), |
| 2514 | "addv.b"); |
| 2515 | } |
| 2516 | |
| 2517 | TEST_F(AssemblerMIPS64Test, AddvH) { |
| 2518 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::AddvH, "addv.h ${reg1}, ${reg2}, ${reg3}"), |
| 2519 | "addv.h"); |
| 2520 | } |
| 2521 | |
| 2522 | TEST_F(AssemblerMIPS64Test, AddvW) { |
| 2523 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::AddvW, "addv.w ${reg1}, ${reg2}, ${reg3}"), |
| 2524 | "addv.w"); |
| 2525 | } |
| 2526 | |
| 2527 | TEST_F(AssemblerMIPS64Test, AddvD) { |
| 2528 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::AddvD, "addv.d ${reg1}, ${reg2}, ${reg3}"), |
| 2529 | "addv.d"); |
| 2530 | } |
| 2531 | |
| 2532 | TEST_F(AssemblerMIPS64Test, SubvB) { |
| 2533 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SubvB, "subv.b ${reg1}, ${reg2}, ${reg3}"), |
| 2534 | "subv.b"); |
| 2535 | } |
| 2536 | |
| 2537 | TEST_F(AssemblerMIPS64Test, SubvH) { |
| 2538 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SubvH, "subv.h ${reg1}, ${reg2}, ${reg3}"), |
| 2539 | "subv.h"); |
| 2540 | } |
| 2541 | |
| 2542 | TEST_F(AssemblerMIPS64Test, SubvW) { |
| 2543 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SubvW, "subv.w ${reg1}, ${reg2}, ${reg3}"), |
| 2544 | "subv.w"); |
| 2545 | } |
| 2546 | |
| 2547 | TEST_F(AssemblerMIPS64Test, SubvD) { |
| 2548 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SubvD, "subv.d ${reg1}, ${reg2}, ${reg3}"), |
| 2549 | "subv.d"); |
| 2550 | } |
| 2551 | |
| 2552 | TEST_F(AssemblerMIPS64Test, MulvB) { |
| 2553 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::MulvB, "mulv.b ${reg1}, ${reg2}, ${reg3}"), |
| 2554 | "mulv.b"); |
| 2555 | } |
| 2556 | |
| 2557 | TEST_F(AssemblerMIPS64Test, MulvH) { |
| 2558 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::MulvH, "mulv.h ${reg1}, ${reg2}, ${reg3}"), |
| 2559 | "mulv.h"); |
| 2560 | } |
| 2561 | |
| 2562 | TEST_F(AssemblerMIPS64Test, MulvW) { |
| 2563 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::MulvW, "mulv.w ${reg1}, ${reg2}, ${reg3}"), |
| 2564 | "mulv.w"); |
| 2565 | } |
| 2566 | |
| 2567 | TEST_F(AssemblerMIPS64Test, MulvD) { |
| 2568 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::MulvD, "mulv.d ${reg1}, ${reg2}, ${reg3}"), |
| 2569 | "mulv.d"); |
| 2570 | } |
| 2571 | |
| 2572 | TEST_F(AssemblerMIPS64Test, Div_sB) { |
| 2573 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_sB, "div_s.b ${reg1}, ${reg2}, ${reg3}"), |
| 2574 | "div_s.b"); |
| 2575 | } |
| 2576 | |
| 2577 | TEST_F(AssemblerMIPS64Test, Div_sH) { |
| 2578 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_sH, "div_s.h ${reg1}, ${reg2}, ${reg3}"), |
| 2579 | "div_s.h"); |
| 2580 | } |
| 2581 | |
| 2582 | TEST_F(AssemblerMIPS64Test, Div_sW) { |
| 2583 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_sW, "div_s.w ${reg1}, ${reg2}, ${reg3}"), |
| 2584 | "div_s.w"); |
| 2585 | } |
| 2586 | |
| 2587 | TEST_F(AssemblerMIPS64Test, Div_sD) { |
| 2588 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_sD, "div_s.d ${reg1}, ${reg2}, ${reg3}"), |
| 2589 | "div_s.d"); |
| 2590 | } |
| 2591 | |
| 2592 | TEST_F(AssemblerMIPS64Test, Div_uB) { |
| 2593 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_uB, "div_u.b ${reg1}, ${reg2}, ${reg3}"), |
| 2594 | "div_u.b"); |
| 2595 | } |
| 2596 | |
| 2597 | TEST_F(AssemblerMIPS64Test, Div_uH) { |
| 2598 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_uH, "div_u.h ${reg1}, ${reg2}, ${reg3}"), |
| 2599 | "div_u.h"); |
| 2600 | } |
| 2601 | |
| 2602 | TEST_F(AssemblerMIPS64Test, Div_uW) { |
| 2603 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_uW, "div_u.w ${reg1}, ${reg2}, ${reg3}"), |
| 2604 | "div_u.w"); |
| 2605 | } |
| 2606 | |
| 2607 | TEST_F(AssemblerMIPS64Test, Div_uD) { |
| 2608 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Div_uD, "div_u.d ${reg1}, ${reg2}, ${reg3}"), |
| 2609 | "div_u.d"); |
| 2610 | } |
| 2611 | |
| 2612 | TEST_F(AssemblerMIPS64Test, Mod_sB) { |
| 2613 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_sB, "mod_s.b ${reg1}, ${reg2}, ${reg3}"), |
| 2614 | "mod_s.b"); |
| 2615 | } |
| 2616 | |
| 2617 | TEST_F(AssemblerMIPS64Test, Mod_sH) { |
| 2618 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_sH, "mod_s.h ${reg1}, ${reg2}, ${reg3}"), |
| 2619 | "mod_s.h"); |
| 2620 | } |
| 2621 | |
| 2622 | TEST_F(AssemblerMIPS64Test, Mod_sW) { |
| 2623 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_sW, "mod_s.w ${reg1}, ${reg2}, ${reg3}"), |
| 2624 | "mod_s.w"); |
| 2625 | } |
| 2626 | |
| 2627 | TEST_F(AssemblerMIPS64Test, Mod_sD) { |
| 2628 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_sD, "mod_s.d ${reg1}, ${reg2}, ${reg3}"), |
| 2629 | "mod_s.d"); |
| 2630 | } |
| 2631 | |
| 2632 | TEST_F(AssemblerMIPS64Test, Mod_uB) { |
| 2633 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_uB, "mod_u.b ${reg1}, ${reg2}, ${reg3}"), |
| 2634 | "mod_u.b"); |
| 2635 | } |
| 2636 | |
| 2637 | TEST_F(AssemblerMIPS64Test, Mod_uH) { |
| 2638 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_uH, "mod_u.h ${reg1}, ${reg2}, ${reg3}"), |
| 2639 | "mod_u.h"); |
| 2640 | } |
| 2641 | |
| 2642 | TEST_F(AssemblerMIPS64Test, Mod_uW) { |
| 2643 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_uW, "mod_u.w ${reg1}, ${reg2}, ${reg3}"), |
| 2644 | "mod_u.w"); |
| 2645 | } |
| 2646 | |
| 2647 | TEST_F(AssemblerMIPS64Test, Mod_uD) { |
| 2648 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::Mod_uD, "mod_u.d ${reg1}, ${reg2}, ${reg3}"), |
| 2649 | "mod_u.d"); |
| 2650 | } |
| 2651 | |
| 2652 | TEST_F(AssemblerMIPS64Test, FaddW) { |
| 2653 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FaddW, "fadd.w ${reg1}, ${reg2}, ${reg3}"), |
| 2654 | "fadd.w"); |
| 2655 | } |
| 2656 | |
| 2657 | TEST_F(AssemblerMIPS64Test, FaddD) { |
| 2658 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FaddD, "fadd.d ${reg1}, ${reg2}, ${reg3}"), |
| 2659 | "fadd.d"); |
| 2660 | } |
| 2661 | |
| 2662 | TEST_F(AssemblerMIPS64Test, FsubW) { |
| 2663 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FsubW, "fsub.w ${reg1}, ${reg2}, ${reg3}"), |
| 2664 | "fsub.w"); |
| 2665 | } |
| 2666 | |
| 2667 | TEST_F(AssemblerMIPS64Test, FsubD) { |
| 2668 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FsubD, "fsub.d ${reg1}, ${reg2}, ${reg3}"), |
| 2669 | "fsub.d"); |
| 2670 | } |
| 2671 | |
| 2672 | TEST_F(AssemblerMIPS64Test, FmulW) { |
| 2673 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FmulW, "fmul.w ${reg1}, ${reg2}, ${reg3}"), |
| 2674 | "fmul.w"); |
| 2675 | } |
| 2676 | |
| 2677 | TEST_F(AssemblerMIPS64Test, FmulD) { |
| 2678 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FmulD, "fmul.d ${reg1}, ${reg2}, ${reg3}"), |
| 2679 | "fmul.d"); |
| 2680 | } |
| 2681 | |
| 2682 | TEST_F(AssemblerMIPS64Test, FdivW) { |
| 2683 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FdivW, "fdiv.w ${reg1}, ${reg2}, ${reg3}"), |
| 2684 | "fdiv.w"); |
| 2685 | } |
| 2686 | |
| 2687 | TEST_F(AssemblerMIPS64Test, FdivD) { |
| 2688 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::FdivD, "fdiv.d ${reg1}, ${reg2}, ${reg3}"), |
| 2689 | "fdiv.d"); |
| 2690 | } |
| 2691 | |
| 2692 | TEST_F(AssemblerMIPS64Test, Ffint_sW) { |
| 2693 | DriverStr(RepeatVV(&mips64::Mips64Assembler::Ffint_sW, "ffint_s.w ${reg1}, ${reg2}"), |
| 2694 | "ffint_s.w"); |
| 2695 | } |
| 2696 | |
| 2697 | TEST_F(AssemblerMIPS64Test, Ffint_sD) { |
| 2698 | DriverStr(RepeatVV(&mips64::Mips64Assembler::Ffint_sD, "ffint_s.d ${reg1}, ${reg2}"), |
| 2699 | "ffint_s.d"); |
| 2700 | } |
| 2701 | |
| 2702 | TEST_F(AssemblerMIPS64Test, Ftint_sW) { |
| 2703 | DriverStr(RepeatVV(&mips64::Mips64Assembler::Ftint_sW, "ftint_s.w ${reg1}, ${reg2}"), |
| 2704 | "ftint_s.w"); |
| 2705 | } |
| 2706 | |
| 2707 | TEST_F(AssemblerMIPS64Test, Ftint_sD) { |
| 2708 | DriverStr(RepeatVV(&mips64::Mips64Assembler::Ftint_sD, "ftint_s.d ${reg1}, ${reg2}"), |
| 2709 | "ftint_s.d"); |
| 2710 | } |
| 2711 | |
| 2712 | TEST_F(AssemblerMIPS64Test, SllB) { |
| 2713 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SllB, "sll.b ${reg1}, ${reg2}, ${reg3}"), "sll.b"); |
| 2714 | } |
| 2715 | |
| 2716 | TEST_F(AssemblerMIPS64Test, SllH) { |
| 2717 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SllH, "sll.h ${reg1}, ${reg2}, ${reg3}"), "sll.h"); |
| 2718 | } |
| 2719 | |
| 2720 | TEST_F(AssemblerMIPS64Test, SllW) { |
| 2721 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SllW, "sll.w ${reg1}, ${reg2}, ${reg3}"), "sll.w"); |
| 2722 | } |
| 2723 | |
| 2724 | TEST_F(AssemblerMIPS64Test, SllD) { |
| 2725 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SllD, "sll.d ${reg1}, ${reg2}, ${reg3}"), "sll.d"); |
| 2726 | } |
| 2727 | |
| 2728 | TEST_F(AssemblerMIPS64Test, SraB) { |
| 2729 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SraB, "sra.b ${reg1}, ${reg2}, ${reg3}"), "sra.b"); |
| 2730 | } |
| 2731 | |
| 2732 | TEST_F(AssemblerMIPS64Test, SraH) { |
| 2733 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SraH, "sra.h ${reg1}, ${reg2}, ${reg3}"), "sra.h"); |
| 2734 | } |
| 2735 | |
| 2736 | TEST_F(AssemblerMIPS64Test, SraW) { |
| 2737 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SraW, "sra.w ${reg1}, ${reg2}, ${reg3}"), "sra.w"); |
| 2738 | } |
| 2739 | |
| 2740 | TEST_F(AssemblerMIPS64Test, SraD) { |
| 2741 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SraD, "sra.d ${reg1}, ${reg2}, ${reg3}"), "sra.d"); |
| 2742 | } |
| 2743 | |
| 2744 | TEST_F(AssemblerMIPS64Test, SrlB) { |
| 2745 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SrlB, "srl.b ${reg1}, ${reg2}, ${reg3}"), "srl.b"); |
| 2746 | } |
| 2747 | |
| 2748 | TEST_F(AssemblerMIPS64Test, SrlH) { |
| 2749 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SrlH, "srl.h ${reg1}, ${reg2}, ${reg3}"), "srl.h"); |
| 2750 | } |
| 2751 | |
| 2752 | TEST_F(AssemblerMIPS64Test, SrlW) { |
| 2753 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SrlW, "srl.w ${reg1}, ${reg2}, ${reg3}"), "srl.w"); |
| 2754 | } |
| 2755 | |
| 2756 | TEST_F(AssemblerMIPS64Test, SrlD) { |
| 2757 | DriverStr(RepeatVVV(&mips64::Mips64Assembler::SrlD, "srl.d ${reg1}, ${reg2}, ${reg3}"), "srl.d"); |
| 2758 | } |
| 2759 | |
| 2760 | TEST_F(AssemblerMIPS64Test, SlliB) { |
| 2761 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SlliB, 3, "slli.b ${reg1}, ${reg2}, {imm}"), |
| 2762 | "slli.b"); |
| 2763 | } |
| 2764 | |
| 2765 | TEST_F(AssemblerMIPS64Test, SlliH) { |
| 2766 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SlliH, 4, "slli.h ${reg1}, ${reg2}, {imm}"), |
| 2767 | "slli.h"); |
| 2768 | } |
| 2769 | |
| 2770 | TEST_F(AssemblerMIPS64Test, SlliW) { |
| 2771 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SlliW, 5, "slli.w ${reg1}, ${reg2}, {imm}"), |
| 2772 | "slli.w"); |
| 2773 | } |
| 2774 | |
| 2775 | TEST_F(AssemblerMIPS64Test, SlliD) { |
| 2776 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SlliD, 6, "slli.d ${reg1}, ${reg2}, {imm}"), |
| 2777 | "slli.d"); |
| 2778 | } |
| 2779 | |
| 2780 | TEST_F(AssemblerMIPS64Test, MoveV) { |
| 2781 | DriverStr(RepeatVV(&mips64::Mips64Assembler::MoveV, "move.v ${reg1}, ${reg2}"), "move.v"); |
| 2782 | } |
| 2783 | |
| 2784 | TEST_F(AssemblerMIPS64Test, SplatiB) { |
| 2785 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SplatiB, 4, "splati.b ${reg1}, ${reg2}[{imm}]"), |
| 2786 | "splati.b"); |
| 2787 | } |
| 2788 | |
| 2789 | TEST_F(AssemblerMIPS64Test, SplatiH) { |
| 2790 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SplatiH, 3, "splati.h ${reg1}, ${reg2}[{imm}]"), |
| 2791 | "splati.h"); |
| 2792 | } |
| 2793 | |
| 2794 | TEST_F(AssemblerMIPS64Test, SplatiW) { |
| 2795 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SplatiW, 2, "splati.w ${reg1}, ${reg2}[{imm}]"), |
| 2796 | "splati.w"); |
| 2797 | } |
| 2798 | |
| 2799 | TEST_F(AssemblerMIPS64Test, SplatiD) { |
| 2800 | DriverStr(RepeatVVIb(&mips64::Mips64Assembler::SplatiD, 1, "splati.d ${reg1}, ${reg2}[{imm}]"), |
| 2801 | "splati.d"); |
| 2802 | } |
| 2803 | |
| 2804 | TEST_F(AssemblerMIPS64Test, FillB) { |
| 2805 | DriverStr(RepeatVR(&mips64::Mips64Assembler::FillB, "fill.b ${reg1}, ${reg2}"), "fill.b"); |
| 2806 | } |
| 2807 | |
| 2808 | TEST_F(AssemblerMIPS64Test, FillH) { |
| 2809 | DriverStr(RepeatVR(&mips64::Mips64Assembler::FillH, "fill.h ${reg1}, ${reg2}"), "fill.h"); |
| 2810 | } |
| 2811 | |
| 2812 | TEST_F(AssemblerMIPS64Test, FillW) { |
| 2813 | DriverStr(RepeatVR(&mips64::Mips64Assembler::FillW, "fill.w ${reg1}, ${reg2}"), "fill.w"); |
| 2814 | } |
| 2815 | |
| 2816 | TEST_F(AssemblerMIPS64Test, FillD) { |
| 2817 | DriverStr(RepeatVR(&mips64::Mips64Assembler::FillD, "fill.d ${reg1}, ${reg2}"), "fill.d"); |
| 2818 | } |
| 2819 | |
| 2820 | TEST_F(AssemblerMIPS64Test, LdB) { |
| 2821 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::LdB, -10, "ld.b ${reg1}, {imm}(${reg2})"), "ld.b"); |
| 2822 | } |
| 2823 | |
| 2824 | TEST_F(AssemblerMIPS64Test, LdH) { |
| 2825 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::LdH, -10, "ld.h ${reg1}, {imm}(${reg2})", 0, 2), |
| 2826 | "ld.h"); |
| 2827 | } |
| 2828 | |
| 2829 | TEST_F(AssemblerMIPS64Test, LdW) { |
| 2830 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::LdW, -10, "ld.w ${reg1}, {imm}(${reg2})", 0, 4), |
| 2831 | "ld.w"); |
| 2832 | } |
| 2833 | |
| 2834 | TEST_F(AssemblerMIPS64Test, LdD) { |
| 2835 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::LdD, -10, "ld.d ${reg1}, {imm}(${reg2})", 0, 8), |
| 2836 | "ld.d"); |
| 2837 | } |
| 2838 | |
| 2839 | TEST_F(AssemblerMIPS64Test, StB) { |
| 2840 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::StB, -10, "st.b ${reg1}, {imm}(${reg2})"), "st.b"); |
| 2841 | } |
| 2842 | |
| 2843 | TEST_F(AssemblerMIPS64Test, StH) { |
| 2844 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::StH, -10, "st.h ${reg1}, {imm}(${reg2})", 0, 2), |
| 2845 | "st.h"); |
| 2846 | } |
| 2847 | |
| 2848 | TEST_F(AssemblerMIPS64Test, StW) { |
| 2849 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::StW, -10, "st.w ${reg1}, {imm}(${reg2})", 0, 4), |
| 2850 | "st.w"); |
| 2851 | } |
| 2852 | |
| 2853 | TEST_F(AssemblerMIPS64Test, StD) { |
| 2854 | DriverStr(RepeatVRIb(&mips64::Mips64Assembler::StD, -10, "st.d ${reg1}, {imm}(${reg2})", 0, 8), |
| 2855 | "st.d"); |
| 2856 | } |
| 2857 | |
Lazar Trsic | d967266 | 2015-09-03 17:33:01 +0200 | [diff] [blame] | 2858 | #undef __ |
| 2859 | |
Chris Larsen | dbce0d7 | 2015-09-17 13:34:00 -0700 | [diff] [blame] | 2860 | } // namespace art |