| 1 |
// Copyright 2015, VIXL authors |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// Redistribution and use in source and binary forms, with or without |
| 5 |
// modification, are permitted provided that the following conditions are met: |
| 6 |
// |
| 7 |
// * Redistributions of source code must retain the above copyright notice, |
| 8 |
// this list of conditions and the following disclaimer. |
| 9 |
// * Redistributions in binary form must reproduce the above copyright notice, |
| 10 |
// this list of conditions and the following disclaimer in the documentation |
| 11 |
// and/or other materials provided with the distribution. |
| 12 |
// * Neither the name of ARM Limited nor the names of its contributors may be |
| 13 |
// used to endorse or promote products derived from this software without |
| 14 |
// specific prior written permission. |
| 15 |
// |
| 16 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND |
| 17 |
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 |
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 20 |
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 |
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 22 |
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 23 |
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 |
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
|
| 27 |
#ifndef VIXL_A64_SIMULATOR_A64_H_ |
| 28 |
#define VIXL_A64_SIMULATOR_A64_H_ |
| 29 |
|
| 30 |
#include "jstypes.h" |
| 31 |
|
| 32 |
#ifdef JS_SIMULATOR_ARM64 |
| 33 |
|
| 34 |
#include "mozilla/Vector.h" |
| 35 |
|
| 36 |
#include "jit/arm64/vixl/Assembler-vixl.h" |
| 37 |
#include "jit/arm64/vixl/Disasm-vixl.h" |
| 38 |
#include "jit/arm64/vixl/Globals-vixl.h" |
| 39 |
#include "jit/arm64/vixl/Instructions-vixl.h" |
| 40 |
#include "jit/arm64/vixl/Instrument-vixl.h" |
| 41 |
#include "jit/arm64/vixl/MozCachingDecoder.h" |
| 42 |
#include "jit/arm64/vixl/Simulator-Constants-vixl.h" |
| 43 |
#include "jit/arm64/vixl/Utils-vixl.h" |
| 44 |
#include "jit/IonTypes.h" |
| 45 |
#include "js/AllocPolicy.h" |
| 46 |
#include "vm/MutexIDs.h" |
| 47 |
#include "wasm/WasmSignalHandlers.h" |
| 48 |
|
| 49 |
namespace vixl { |
| 50 |
|
| 51 |
// Representation of memory, with typed getters and setters for access. |
| 52 |
class Memory { |
| 53 |
public: |
| 54 |
template <typename T> |
| 55 |
static T AddressUntag(T address) { |
| 56 |
// Cast the address using a C-style cast. A reinterpret_cast would be |
| 57 |
// appropriate, but it can't cast one integral type to another. |
| 58 |
uint64_t bits = (uint64_t)address; |
| 59 |
return (T)(bits & ~kAddressTagMask); |
| 60 |
} |
| 61 |
|
| 62 |
template <typename T, typename A> |
| 63 |
static T Read(A address) { |
| 64 |
T value; |
| 65 |
address = AddressUntag(address); |
| 66 |
VIXL_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) || |
| 67 |
(sizeof(value) == 4) || (sizeof(value) == 8) || |
| 68 |
(sizeof(value) == 16)); |
| 69 |
memcpy(&value, reinterpret_cast<const char *>(address), sizeof(value)); |
| 70 |
return value; |
| 71 |
} |
| 72 |
|
| 73 |
template <typename T, typename A> |
| 74 |
static void Write(A address, T value) { |
| 75 |
address = AddressUntag(address); |
| 76 |
VIXL_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) || |
| 77 |
(sizeof(value) == 4) || (sizeof(value) == 8) || |
| 78 |
(sizeof(value) == 16)); |
| 79 |
memcpy(reinterpret_cast<char *>(address), &value, sizeof(value)); |
| 80 |
} |
| 81 |
}; |
| 82 |
|
| 83 |
// Represent a register (r0-r31, v0-v31). |
| 84 |
template<int kSizeInBytes> |
| 85 |
class SimRegisterBase { |
| 86 |
public: |
| 87 |
SimRegisterBase() : written_since_last_log_(false) {} |
| 88 |
|
| 89 |
// Write the specified value. The value is zero-extended if necessary. |
| 90 |
template<typename T> |
| 91 |
void Set(T new_value) { |
| 92 |
VIXL_STATIC_ASSERT(sizeof(new_value) <= kSizeInBytes); |
| 93 |
if (sizeof(new_value) < kSizeInBytes) { |
| 94 |
// All AArch64 registers are zero-extending. |
| 95 |
memset(value_ + sizeof(new_value), 0, kSizeInBytes - sizeof(new_value)); |
| 96 |
} |
| 97 |
memcpy(value_, &new_value, sizeof(new_value)); |
| 98 |
NotifyRegisterWrite(); |
| 99 |
} |
| 100 |
|
| 101 |
// Insert a typed value into a register, leaving the rest of the register |
| 102 |
// unchanged. The lane parameter indicates where in the register the value |
| 103 |
// should be inserted, in the range [ 0, sizeof(value_) / sizeof(T) ), where |
| 104 |
// 0 represents the least significant bits. |
| 105 |
template<typename T> |
| 106 |
void Insert(int lane, T new_value) { |
| 107 |
VIXL_ASSERT(lane >= 0); |
| 108 |
VIXL_ASSERT((sizeof(new_value) + |
| 109 |
(lane * sizeof(new_value))) <= kSizeInBytes); |
| 110 |
memcpy(&value_[lane * sizeof(new_value)], &new_value, sizeof(new_value)); |
| 111 |
NotifyRegisterWrite(); |
| 112 |
} |
| 113 |
|
| 114 |
// Read the value as the specified type. The value is truncated if necessary. |
| 115 |
template<typename T> |
| 116 |
T Get(int lane = 0) const { |
| 117 |
T result; |
| 118 |
VIXL_ASSERT(lane >= 0); |
| 119 |
VIXL_ASSERT((sizeof(result) + (lane * sizeof(result))) <= kSizeInBytes); |
| 120 |
memcpy(&result, &value_[lane * sizeof(result)], sizeof(result)); |
| 121 |
return result; |
| 122 |
} |
| 123 |
|
| 124 |
// TODO: Make this return a map of updated bytes, so that we can highlight |
| 125 |
// updated lanes for load-and-insert. (That never happens for scalar code, but |
| 126 |
// NEON has some instructions that can update individual lanes.) |
| 127 |
bool WrittenSinceLastLog() const { |
| 128 |
return written_since_last_log_; |
| 129 |
} |
| 130 |
|
| 131 |
void NotifyRegisterLogged() { |
| 132 |
written_since_last_log_ = false; |
| 133 |
} |
| 134 |
|
| 135 |
protected: |
| 136 |
uint8_t value_[kSizeInBytes]; |
| 137 |
|
| 138 |
// Helpers to aid with register tracing. |
| 139 |
bool written_since_last_log_; |
| 140 |
|
| 141 |
void NotifyRegisterWrite() { |
| 142 |
written_since_last_log_ = true; |
| 143 |
} |
| 144 |
}; |
| 145 |
typedef SimRegisterBase<kXRegSizeInBytes> SimRegister; // r0-r31 |
| 146 |
typedef SimRegisterBase<kQRegSizeInBytes> SimVRegister; // v0-v31 |
| 147 |
|
| 148 |
// Representation of a vector register, with typed getters and setters for lanes |
| 149 |
// and additional information to represent lane state. |
| 150 |
class LogicVRegister { |
| 151 |
public: |
| 152 |
inline LogicVRegister(SimVRegister& other) // NOLINT |
| 153 |
: register_(other) { |
| 154 |
for (unsigned i = 0; i < sizeof(saturated_) / sizeof(saturated_[0]); i++) { |
| 155 |
saturated_[i] = kNotSaturated; |
| 156 |
} |
| 157 |
for (unsigned i = 0; i < sizeof(round_) / sizeof(round_[0]); i++) { |
| 158 |
round_[i] = 0; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
int64_t Int(VectorFormat vform, int index) const { |
| 163 |
int64_t element; |
| 164 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 165 |
case 8: element = register_.Get<int8_t>(index); break; |
| 166 |
case 16: element = register_.Get<int16_t>(index); break; |
| 167 |
case 32: element = register_.Get<int32_t>(index); break; |
| 168 |
case 64: element = register_.Get<int64_t>(index); break; |
| 169 |
default: VIXL_UNREACHABLE(); return 0; |
| 170 |
} |
| 171 |
return element; |
| 172 |
} |
| 173 |
|
| 174 |
uint64_t Uint(VectorFormat vform, int index) const { |
| 175 |
uint64_t element; |
| 176 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 177 |
case 8: element = register_.Get<uint8_t>(index); break; |
| 178 |
case 16: element = register_.Get<uint16_t>(index); break; |
| 179 |
case 32: element = register_.Get<uint32_t>(index); break; |
| 180 |
case 64: element = register_.Get<uint64_t>(index); break; |
| 181 |
default: VIXL_UNREACHABLE(); return 0; |
| 182 |
} |
| 183 |
return element; |
| 184 |
} |
| 185 |
|
| 186 |
int64_t IntLeftJustified(VectorFormat vform, int index) const { |
| 187 |
return Int(vform, index) << (64 - LaneSizeInBitsFromFormat(vform)); |
| 188 |
} |
| 189 |
|
| 190 |
uint64_t UintLeftJustified(VectorFormat vform, int index) const { |
| 191 |
return Uint(vform, index) << (64 - LaneSizeInBitsFromFormat(vform)); |
| 192 |
} |
| 193 |
|
| 194 |
void SetInt(VectorFormat vform, int index, int64_t value) const { |
| 195 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 196 |
case 8: register_.Insert(index, static_cast<int8_t>(value)); break; |
| 197 |
case 16: register_.Insert(index, static_cast<int16_t>(value)); break; |
| 198 |
case 32: register_.Insert(index, static_cast<int32_t>(value)); break; |
| 199 |
case 64: register_.Insert(index, static_cast<int64_t>(value)); break; |
| 200 |
default: VIXL_UNREACHABLE(); return; |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
void SetUint(VectorFormat vform, int index, uint64_t value) const { |
| 205 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 206 |
case 8: register_.Insert(index, static_cast<uint8_t>(value)); break; |
| 207 |
case 16: register_.Insert(index, static_cast<uint16_t>(value)); break; |
| 208 |
case 32: register_.Insert(index, static_cast<uint32_t>(value)); break; |
| 209 |
case 64: register_.Insert(index, static_cast<uint64_t>(value)); break; |
| 210 |
default: VIXL_UNREACHABLE(); return; |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
void ReadUintFromMem(VectorFormat vform, int index, uint64_t addr) const { |
| 215 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 216 |
case 8: register_.Insert(index, Memory::Read<uint8_t>(addr)); break; |
| 217 |
case 16: register_.Insert(index, Memory::Read<uint16_t>(addr)); break; |
| 218 |
case 32: register_.Insert(index, Memory::Read<uint32_t>(addr)); break; |
| 219 |
case 64: register_.Insert(index, Memory::Read<uint64_t>(addr)); break; |
| 220 |
default: VIXL_UNREACHABLE(); return; |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
void WriteUintToMem(VectorFormat vform, int index, uint64_t addr) const { |
| 225 |
uint64_t value = Uint(vform, index); |
| 226 |
switch (LaneSizeInBitsFromFormat(vform)) { |
| 227 |
case 8: Memory::Write(addr, static_cast<uint8_t>(value)); break; |
| 228 |
case 16: Memory::Write(addr, static_cast<uint16_t>(value)); break; |
| 229 |
case 32: Memory::Write(addr, static_cast<uint32_t>(value)); break; |
| 230 |
case 64: Memory::Write(addr, value); break; |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
template <typename T> |
| 235 |
T Float(int index) const { |
| 236 |
return register_.Get<T>(index); |
| 237 |
} |
| 238 |
|
| 239 |
template <typename T> |
| 240 |
void SetFloat(int index, T value) const { |
| 241 |
register_.Insert(index, value); |
| 242 |
} |
| 243 |
|
| 244 |
// When setting a result in a register of size less than Q, the top bits of |
| 245 |
// the Q register must be cleared. |
| 246 |
void ClearForWrite(VectorFormat vform) const { |
| 247 |
unsigned size = RegisterSizeInBytesFromFormat(vform); |
| 248 |
for (unsigned i = size; i < kQRegSizeInBytes; i++) { |
| 249 |
SetUint(kFormat16B, i, 0); |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
// Saturation state for each lane of a vector. |
| 254 |
enum Saturation { |
| 255 |
kNotSaturated = 0, |
| 256 |
kSignedSatPositive = 1 << 0, |
| 257 |
kSignedSatNegative = 1 << 1, |
| 258 |
kSignedSatMask = kSignedSatPositive | kSignedSatNegative, |
| 259 |
kSignedSatUndefined = kSignedSatMask, |
| 260 |
kUnsignedSatPositive = 1 << 2, |
| 261 |
kUnsignedSatNegative = 1 << 3, |
| 262 |
kUnsignedSatMask = kUnsignedSatPositive | kUnsignedSatNegative, |
| 263 |
kUnsignedSatUndefined = kUnsignedSatMask |
| 264 |
}; |
| 265 |
|
| 266 |
// Getters for saturation state. |
| 267 |
Saturation GetSignedSaturation(int index) { |
| 268 |
return static_cast<Saturation>(saturated_[index] & kSignedSatMask); |
| 269 |
} |
| 270 |
|
| 271 |
Saturation GetUnsignedSaturation(int index) { |
| 272 |
return static_cast<Saturation>(saturated_[index] & kUnsignedSatMask); |
| 273 |
} |
| 274 |
|
| 275 |
// Setters for saturation state. |
| 276 |
void ClearSat(int index) { |
| 277 |
saturated_[index] = kNotSaturated; |
| 278 |
} |
| 279 |
|
| 280 |
void SetSignedSat(int index, bool positive) { |
| 281 |
SetSatFlag(index, positive ? kSignedSatPositive : kSignedSatNegative); |
| 282 |
} |
| 283 |
|
| 284 |
void SetUnsignedSat(int index, bool positive) { |
| 285 |
SetSatFlag(index, positive ? kUnsignedSatPositive : kUnsignedSatNegative); |
| 286 |
} |
| 287 |
|
| 288 |
void SetSatFlag(int index, Saturation sat) { |
| 289 |
saturated_[index] = static_cast<Saturation>(saturated_[index] | sat); |
| 290 |
VIXL_ASSERT((sat & kUnsignedSatMask) != kUnsignedSatUndefined); |
| 291 |
VIXL_ASSERT((sat & kSignedSatMask) != kSignedSatUndefined); |
| 292 |
} |
| 293 |
|
| 294 |
// Saturate lanes of a vector based on saturation state. |
| 295 |
LogicVRegister& SignedSaturate(VectorFormat vform) { |
| 296 |
for (int i = 0; i < LaneCountFromFormat(vform); i++) { |
| 297 |
Saturation sat = GetSignedSaturation(i); |
| 298 |
if (sat == kSignedSatPositive) { |
| 299 |
SetInt(vform, i, MaxIntFromFormat(vform)); |
| 300 |
} else if (sat == kSignedSatNegative) { |
| 301 |
SetInt(vform, i, MinIntFromFormat(vform)); |
| 302 |
} |
| 303 |
} |
| 304 |
return *this; |
| 305 |
} |
| 306 |
|
| 307 |
LogicVRegister& UnsignedSaturate(VectorFormat vform) { |
| 308 |
for (int i = 0; i < LaneCountFromFormat(vform); i++) { |
| 309 |
Saturation sat = GetUnsignedSaturation(i); |
| 310 |
if (sat == kUnsignedSatPositive) { |
| 311 |
SetUint(vform, i, MaxUintFromFormat(vform)); |
| 312 |
} else if (sat == kUnsignedSatNegative) { |
| 313 |
SetUint(vform, i, 0); |
| 314 |
} |
| 315 |
} |
| 316 |
return *this; |
| 317 |
} |
| 318 |
|
| 319 |
// Getter for rounding state. |
| 320 |
bool GetRounding(int index) { |
| 321 |
return round_[index]; |
| 322 |
} |
| 323 |
|
| 324 |
// Setter for rounding state. |
| 325 |
void SetRounding(int index, bool round) { |
| 326 |
round_[index] = round; |
| 327 |
} |
| 328 |
|
| 329 |
// Round lanes of a vector based on rounding state. |
| 330 |
LogicVRegister& Round(VectorFormat vform) { |
| 331 |
for (int i = 0; i < LaneCountFromFormat(vform); i++) { |
| 332 |
SetInt(vform, i, Int(vform, i) + (GetRounding(i) ? 1 : 0)); |
| 333 |
} |
| 334 |
return *this; |
| 335 |
} |
| 336 |
|
| 337 |
// Unsigned halve lanes of a vector, and use the saturation state to set the |
| 338 |
// top bit. |
| 339 |
LogicVRegister& Uhalve(VectorFormat vform) { |
| 340 |
for (int i = 0; i < LaneCountFromFormat(vform); i++) { |
| 341 |
uint64_t val = Uint(vform, i); |
| 342 |
SetRounding(i, (val & 1) == 1); |
| 343 |
val >>= 1; |
| 344 |
if (GetUnsignedSaturation(i) != kNotSaturated) { |
| 345 |
// If the operation causes unsigned saturation, the bit shifted into the |
| 346 |
// most significant bit must be set. |
| 347 |
val |= (MaxUintFromFormat(vform) >> 1) + 1; |
| 348 |
} |
| 349 |
SetInt(vform, i, val); |
| 350 |
} |
| 351 |
return *this; |
| 352 |
} |
| 353 |
|
| 354 |
// Signed halve lanes of a vector, and use the carry state to set the top bit. |
| 355 |
LogicVRegister& Halve(VectorFormat vform) { |
| 356 |
for (int i = 0; i < LaneCountFromFormat(vform); i++) { |
| 357 |
int64_t val = Int(vform, i); |
| 358 |
SetRounding(i, (val & 1) == 1); |
| 359 |
val >>= 1; |
| 360 |
if (GetSignedSaturation(i) != kNotSaturated) { |
| 361 |
// If the operation causes signed saturation, the sign bit must be |
| 362 |
// inverted. |
| 363 |
val ^= (MaxUintFromFormat(vform) >> 1) + 1; |
| 364 |
} |
| 365 |
SetInt(vform, i, val); |
| 366 |
} |
| 367 |
return *this; |
| 368 |
} |
| 369 |
|
| 370 |
private: |
| 371 |
SimVRegister& register_; |
| 372 |
|
| 373 |
// Allocate one saturation state entry per lane; largest register is type Q, |
| 374 |
// and lanes can be a minimum of one byte wide. |
| 375 |
Saturation saturated_[kQRegSizeInBytes]; |
| 376 |
|
| 377 |
// Allocate one rounding state entry per lane. |
| 378 |
bool round_[kQRegSizeInBytes]; |
| 379 |
}; |
| 380 |
|
| 381 |
// The proper way to initialize a simulated system register (such as NZCV) is as |
| 382 |
// follows: |
| 383 |
// SimSystemRegister nzcv = SimSystemRegister::DefaultValueFor(NZCV); |
| 384 |
class SimSystemRegister { |
| 385 |
public: |
| 386 |
// The default constructor represents a register which has no writable bits. |
| 387 |
// It is not possible to set its value to anything other than 0. |
| 388 |
SimSystemRegister() : value_(0), write_ignore_mask_(0xffffffff) { } |
| 389 |
|
| 390 |
uint32_t RawValue() const { |
| 391 |
return value_; |
| 392 |
} |
| 393 |
|
| 394 |
void SetRawValue(uint32_t new_value) { |
| 395 |
value_ = (value_ & write_ignore_mask_) | (new_value & ~write_ignore_mask_); |
| 396 |
} |
| 397 |
|
| 398 |
uint32_t Bits(int msb, int lsb) const { |
| 399 |
return ExtractUnsignedBitfield32(msb, lsb, value_); |
| 400 |
} |
| 401 |
|
| 402 |
int32_t SignedBits(int msb, int lsb) const { |
| 403 |
return ExtractSignedBitfield32(msb, lsb, value_); |
| 404 |
} |
| 405 |
|
| 406 |
void SetBits(int msb, int lsb, uint32_t bits); |
| 407 |
|
| 408 |
// Default system register values. |
| 409 |
static SimSystemRegister DefaultValueFor(SystemRegister id); |
| 410 |
|
| 411 |
#define DEFINE_GETTER(Name, HighBit, LowBit, Func) \ |
| 412 |
uint32_t Name() const { return Func(HighBit, LowBit); } \ |
| 413 |
void Set##Name(uint32_t bits) { SetBits(HighBit, LowBit, bits); } |
| 414 |
#define DEFINE_WRITE_IGNORE_MASK(Name, Mask) \ |
| 415 |
static const uint32_t Name##WriteIgnoreMask = ~static_cast<uint32_t>(Mask); |
| 416 |
|
| 417 |
SYSTEM_REGISTER_FIELDS_LIST(DEFINE_GETTER, DEFINE_WRITE_IGNORE_MASK) |
| 418 |
|
| 419 |
#undef DEFINE_ZERO_BITS |
| 420 |
#undef DEFINE_GETTER |
| 421 |
|
| 422 |
protected: |
| 423 |
// Most system registers only implement a few of the bits in the word. Other |
| 424 |
// bits are "read-as-zero, write-ignored". The write_ignore_mask argument |
| 425 |
// describes the bits which are not modifiable. |
| 426 |
SimSystemRegister(uint32_t value, uint32_t write_ignore_mask) |
| 427 |
: value_(value), write_ignore_mask_(write_ignore_mask) { } |
| 428 |
|
| 429 |
uint32_t value_; |
| 430 |
uint32_t write_ignore_mask_; |
| 431 |
}; |
| 432 |
|
| 433 |
|
| 434 |
class SimExclusiveLocalMonitor { |
| 435 |
public: |
| 436 |
SimExclusiveLocalMonitor() : kSkipClearProbability(8), seed_(0x87654321) { |
| 437 |
Clear(); |
| 438 |
} |
| 439 |
|
| 440 |
// Clear the exclusive monitor (like clrex). |
| 441 |
void Clear() { |
| 442 |
address_ = 0; |
| 443 |
size_ = 0; |
| 444 |
} |
| 445 |
|
| 446 |
// Clear the exclusive monitor most of the time. |
| 447 |
void MaybeClear() { |
| 448 |
if ((seed_ % kSkipClearProbability) != 0) { |
| 449 |
Clear(); |
| 450 |
} |
| 451 |
|
| 452 |
// Advance seed_ using a simple linear congruential generator. |
| 453 |
seed_ = (seed_ * 48271) % 2147483647; |
| 454 |
} |
| 455 |
|
| 456 |
// Mark the address range for exclusive access (like load-exclusive). |
| 457 |
void MarkExclusive(uint64_t address, size_t size) { |
| 458 |
address_ = address; |
| 459 |
size_ = size; |
| 460 |
} |
| 461 |
|
| 462 |
// Return true if the address range is marked (like store-exclusive). |
| 463 |
// This helper doesn't implicitly clear the monitor. |
| 464 |
bool IsExclusive(uint64_t address, size_t size) { |
| 465 |
VIXL_ASSERT(size > 0); |
| 466 |
// Be pedantic: Require both the address and the size to match. |
| 467 |
return (size == size_) && (address == address_); |
| 468 |
} |
| 469 |
|
| 470 |
private: |
| 471 |
uint64_t address_; |
| 472 |
size_t size_; |
| 473 |
|
| 474 |
const int kSkipClearProbability; |
| 475 |
uint32_t seed_; |
| 476 |
}; |
| 477 |
|
| 478 |
|
| 479 |
// We can't accurate simulate the global monitor since it depends on external |
| 480 |
// influences. Instead, this implementation occasionally causes accesses to |
| 481 |
// fail, according to kPassProbability. |
| 482 |
class SimExclusiveGlobalMonitor { |
| 483 |
public: |
| 484 |
SimExclusiveGlobalMonitor() : kPassProbability(8), seed_(0x87654321) {} |
| 485 |
|
| 486 |
bool IsExclusive(uint64_t address, size_t size) { |
| 487 |
USE(address, size); |
| 488 |
|
| 489 |
bool pass = (seed_ % kPassProbability) != 0; |
| 490 |
// Advance seed_ using a simple linear congruential generator. |
| 491 |
seed_ = (seed_ * 48271) % 2147483647; |
| 492 |
return pass; |
| 493 |
} |
| 494 |
|
| 495 |
private: |
| 496 |
const int kPassProbability; |
| 497 |
uint32_t seed_; |
| 498 |
}; |
| 499 |
|
| 500 |
class Redirection; |
| 501 |
class Simulator; |
| 502 |
|
| 503 |
// When the SingleStepCallback is called, the simulator is about to execute |
| 504 |
// sim->get_pc() and the current machine state represents the completed |
| 505 |
// execution of the previous pc. |
| 506 |
typedef void (*SingleStepCallback)(void* arg, Simulator* sim, void* pc); |
| 507 |
|
| 508 |
class Simulator : public DecoderVisitor { |
| 509 |
public: |
| 510 |
#ifdef JS_CACHE_SIMULATOR_ARM64 |
| 511 |
using Decoder = CachingDecoder; |
| 512 |
mozilla::Atomic<bool> pendingCacheRequests = mozilla::Atomic<bool>{ false }; |
| 513 |
#endif |
| 514 |
explicit Simulator(Decoder* decoder, FILE* stream = stdout); |
| 515 |
~Simulator(); |
| 516 |
|
| 517 |
// Moz changes. |
| 518 |
void init(Decoder* decoder, FILE* stream); |
| 519 |
static Simulator* Current(); |
| 520 |
static Simulator* Create(); |
| 521 |
static void Destroy(Simulator* sim); |
| 522 |
uintptr_t stackLimit() const; |
| 523 |
uintptr_t* addressOfStackLimit(); |
| 524 |
bool overRecursed(uintptr_t newsp = 0) const; |
| 525 |
bool overRecursedWithExtra(uint32_t extra) const; |
| 526 |
int64_t call(uint8_t* entry, int argument_count, ...); |
| 527 |
static void* RedirectNativeFunction(void* nativeFunction, js::jit::ABIFunctionType type); |
| 528 |
void setGPR32Result(int32_t result); |
| 529 |
void setGPR64Result(int64_t result); |
| 530 |
void setFP32Result(float result); |
| 531 |
void setFP64Result(double result); |
| 532 |
#ifdef JS_CACHE_SIMULATOR_ARM64 |
| 533 |
void FlushICache(); |
| 534 |
#endif |
| 535 |
void VisitCallRedirection(const Instruction* instr); |
| 536 |
static uintptr_t StackLimit() { |
| 537 |
return Simulator::Current()->stackLimit(); |
| 538 |
} |
| 539 |
template<typename T> T Read(uintptr_t address); |
| 540 |
template <typename T> void Write(uintptr_t address_, T value); |
| 541 |
JS::ProfilingFrameIterator::RegisterState registerState(); |
| 542 |
|
| 543 |
void ResetState(); |
| 544 |
|
| 545 |
// Profiler support. |
| 546 |
void enable_single_stepping(SingleStepCallback cb, void* arg); |
| 547 |
void disable_single_stepping(); |
| 548 |
|
| 549 |
// Run the simulator. |
| 550 |
virtual void Run(); |
| 551 |
void RunFrom(const Instruction* first); |
| 552 |
|
| 553 |
// Simulation helpers. |
| 554 |
const Instruction* pc() const { return pc_; } |
| 555 |
const Instruction* get_pc() const { return pc_; } |
| 556 |
int64_t get_sp() const { return xreg(31, Reg31IsStackPointer); } |
| 557 |
int64_t get_lr() const { return xreg(30); } |
| 558 |
int64_t get_fp() const { return xreg(29); } |
| 559 |
|
| 560 |
template <typename T> |
| 561 |
T get_pc_as() const { return reinterpret_cast<T>(const_cast<Instruction*>(pc())); } |
| 562 |
|
| 563 |
void set_pc(const Instruction* new_pc) { |
| 564 |
pc_ = Memory::AddressUntag(new_pc); |
| 565 |
pc_modified_ = true; |
| 566 |
} |
| 567 |
|
| 568 |
// Handle any wasm faults, returning true if the fault was handled. |
| 569 |
// This method is rather hot so inline the normal (no-wasm) case. |
| 570 |
bool MOZ_ALWAYS_INLINE handle_wasm_seg_fault(uintptr_t addr, unsigned numBytes) { |
| 571 |
if (MOZ_LIKELY(!js::wasm::CodeExists)) { |
| 572 |
return false; |
| 573 |
} |
| 574 |
|
| 575 |
uint8_t* newPC; |
| 576 |
if (!js::wasm::MemoryAccessTraps(registerState(), (uint8_t*)addr, numBytes, &newPC)) { |
| 577 |
return false; |
| 578 |
} |
| 579 |
|
| 580 |
set_pc((Instruction*)newPC); |
| 581 |
return true; |
| 582 |
} |
| 583 |
|
| 584 |
void increment_pc() { |
| 585 |
if (!pc_modified_) { |
| 586 |
pc_ = pc_->NextInstruction(); |
| 587 |
} |
| 588 |
|
| 589 |
pc_modified_ = false; |
| 590 |
} |
| 591 |
|
| 592 |
void ExecuteInstruction(); |
| 593 |
|
| 594 |
// Declare all Visitor functions. |
| 595 |
#define DECLARE(A) virtual void Visit##A(const Instruction* instr) override; |
| 596 |
VISITOR_LIST_THAT_RETURN(DECLARE) |
| 597 |
VISITOR_LIST_THAT_DONT_RETURN(DECLARE) |
| 598 |
#undef DECLARE |
| 599 |
|
| 600 |
|
| 601 |
// Integer register accessors. |
| 602 |
|
| 603 |
// Basic accessor: Read the register as the specified type. |
| 604 |
template<typename T> |
| 605 |
T reg(unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 606 |
VIXL_ASSERT(code < kNumberOfRegisters); |
| 607 |
if ((code == 31) && (r31mode == Reg31IsZeroRegister)) { |
| 608 |
T result; |
| 609 |
memset(&result, 0, sizeof(result)); |
| 610 |
return result; |
| 611 |
} |
| 612 |
return registers_[code].Get<T>(); |
| 613 |
} |
| 614 |
|
| 615 |
// Common specialized accessors for the reg() template. |
| 616 |
int32_t wreg(unsigned code, |
| 617 |
Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 618 |
return reg<int32_t>(code, r31mode); |
| 619 |
} |
| 620 |
|
| 621 |
int64_t xreg(unsigned code, |
| 622 |
Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 623 |
return reg<int64_t>(code, r31mode); |
| 624 |
} |
| 625 |
|
| 626 |
// As above, with parameterized size and return type. The value is |
| 627 |
// either zero-extended or truncated to fit, as required. |
| 628 |
template<typename T> |
| 629 |
T reg(unsigned size, unsigned code, |
| 630 |
Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 631 |
uint64_t raw; |
| 632 |
switch (size) { |
| 633 |
case kWRegSize: raw = reg<uint32_t>(code, r31mode); break; |
| 634 |
case kXRegSize: raw = reg<uint64_t>(code, r31mode); break; |
| 635 |
default: |
| 636 |
VIXL_UNREACHABLE(); |
| 637 |
return 0; |
| 638 |
} |
| 639 |
|
| 640 |
T result; |
| 641 |
VIXL_STATIC_ASSERT(sizeof(result) <= sizeof(raw)); |
| 642 |
// Copy the result and truncate to fit. This assumes a little-endian host. |
| 643 |
memcpy(&result, &raw, sizeof(result)); |
| 644 |
return result; |
| 645 |
} |
| 646 |
|
| 647 |
// Use int64_t by default if T is not specified. |
| 648 |
int64_t reg(unsigned size, unsigned code, |
| 649 |
Reg31Mode r31mode = Reg31IsZeroRegister) const { |
| 650 |
return reg<int64_t>(size, code, r31mode); |
| 651 |
} |
| 652 |
|
| 653 |
enum RegLogMode { |
| 654 |
LogRegWrites, |
| 655 |
NoRegLog |
| 656 |
}; |
| 657 |
|
| 658 |
// Write 'value' into an integer register. The value is zero-extended. This |
| 659 |
// behaviour matches AArch64 register writes. |
| 660 |
template<typename T> |
| 661 |
void set_reg(unsigned code, T value, |
| 662 |
RegLogMode log_mode = LogRegWrites, |
| 663 |
Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 664 |
if (sizeof(T) < kWRegSizeInBytes) { |
| 665 |
// We use a C-style cast on purpose here. |
| 666 |
// Since we do not have access to 'constepxr if', the casts in this `if` |
| 667 |
// must be valid even if we know the code will never be executed, in |
| 668 |
// particular when `T` is a pointer type. |
| 669 |
int64_t tmp_64bit = (int64_t)value; |
| 670 |
int32_t tmp_32bit = static_cast<int32_t>(tmp_64bit); |
| 671 |
set_reg<int32_t>(code, tmp_32bit, log_mode, r31mode); |
| 672 |
return; |
| 673 |
} |
| 674 |
|
| 675 |
VIXL_ASSERT((sizeof(T) == kWRegSizeInBytes) || |
| 676 |
(sizeof(T) == kXRegSizeInBytes)); |
| 677 |
VIXL_ASSERT(code < kNumberOfRegisters); |
| 678 |
|
| 679 |
if ((code == 31) && (r31mode == Reg31IsZeroRegister)) { |
| 680 |
return; |
| 681 |
} |
| 682 |
|
| 683 |
registers_[code].Set(value); |
| 684 |
|
| 685 |
if (log_mode == LogRegWrites) LogRegister(code, r31mode); |
| 686 |
} |
| 687 |
|
| 688 |
// Common specialized accessors for the set_reg() template. |
| 689 |
void set_wreg(unsigned code, int32_t value, |
| 690 |
RegLogMode log_mode = LogRegWrites, |
| 691 |
Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 692 |
set_reg(code, value, log_mode, r31mode); |
| 693 |
} |
| 694 |
|
| 695 |
void set_xreg(unsigned code, int64_t value, |
| 696 |
RegLogMode log_mode = LogRegWrites, |
| 697 |
Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 698 |
set_reg(code, value, log_mode, r31mode); |
| 699 |
} |
| 700 |
|
| 701 |
// As above, with parameterized size and type. The value is either |
| 702 |
// zero-extended or truncated to fit, as required. |
| 703 |
template<typename T> |
| 704 |
void set_reg(unsigned size, unsigned code, T value, |
| 705 |
RegLogMode log_mode = LogRegWrites, |
| 706 |
Reg31Mode r31mode = Reg31IsZeroRegister) { |
| 707 |
// Zero-extend the input. |
| 708 |
uint64_t raw = 0; |
| 709 |
VIXL_STATIC_ASSERT(sizeof(value) <= sizeof(raw)); |
| 710 |
memcpy(&raw, &value, sizeof(value)); |
| 711 |
|
| 712 |
// Write (and possibly truncate) the value. |
| 713 |
switch (size) { |
| 714 |
case kWRegSize: |
| 715 |
set_reg(code, static_cast<uint32_t>(raw), log_mode, r31mode); |
| 716 |
break; |
| 717 |
case kXRegSize: |
| 718 |
set_reg(code, raw, log_mode, r31mode); |
| 719 |
break; |
| 720 |
default: |
| 721 |
VIXL_UNREACHABLE(); |
| 722 |
return; |
| 723 |
} |
| 724 |
} |
| 725 |
|
| 726 |
// Common specialized accessors for the set_reg() template. |
| 727 |
|
| 728 |
// Commonly-used special cases. |
| 729 |
template<typename T> |
| 730 |
void set_lr(T value) { |
| 731 |
set_reg(kLinkRegCode, value); |
| 732 |
} |
| 733 |
|
| 734 |
template<typename T> |
| 735 |
void set_sp(T value) { |
| 736 |
set_reg(31, value, LogRegWrites, Reg31IsStackPointer); |
| 737 |
} |
| 738 |
|
| 739 |
// Vector register accessors. |
| 740 |
// These are equivalent to the integer register accessors, but for vector |
| 741 |
// registers. |
| 742 |
|
| 743 |
// A structure for representing a 128-bit Q register. |
| 744 |
struct qreg_t { uint8_t val[kQRegSizeInBytes]; }; |
| 745 |
|
| 746 |
// Basic accessor: read the register as the specified type. |
| 747 |
template<typename T> |
| 748 |
T vreg(unsigned code) const { |
| 749 |
VIXL_STATIC_ASSERT((sizeof(T) == kBRegSizeInBytes) || |
| 750 |
(sizeof(T) == kHRegSizeInBytes) || |
| 751 |
(sizeof(T) == kSRegSizeInBytes) || |
| 752 |
(sizeof(T) == kDRegSizeInBytes) || |
| 753 |
(sizeof(T) == kQRegSizeInBytes)); |
| 754 |
VIXL_ASSERT(code < kNumberOfVRegisters); |
| 755 |
|
| 756 |
return vregisters_[code].Get<T>(); |
| 757 |
} |
| 758 |
|
| 759 |
// Common specialized accessors for the vreg() template. |
| 760 |
int8_t breg(unsigned code) const { |
| 761 |
return vreg<int8_t>(code); |
| 762 |
} |
| 763 |
|
| 764 |
int16_t hreg(unsigned code) const { |
| 765 |
return vreg<int16_t>(code); |
| 766 |
} |
| 767 |
|
| 768 |
float sreg(unsigned code) const { |
| 769 |
return vreg<float>(code); |
| 770 |
} |
| 771 |
|
| 772 |
uint32_t sreg_bits(unsigned code) const { |
| 773 |
return vreg<uint32_t>(code); |
| 774 |
} |
| 775 |
|
| 776 |
double dreg(unsigned code) const { |
| 777 |
return vreg<double>(code); |
| 778 |
} |
| 779 |
|
| 780 |
uint64_t dreg_bits(unsigned code) const { |
| 781 |
return vreg<uint64_t>(code); |
| 782 |
} |
| 783 |
|
| 784 |
qreg_t qreg(unsigned code) const { |
| 785 |
return vreg<qreg_t>(code); |
| 786 |
} |
| 787 |
|
| 788 |
// As above, with parameterized size and return type. The value is |
| 789 |
// either zero-extended or truncated to fit, as required. |
| 790 |
template<typename T> |
| 791 |
T vreg(unsigned size, unsigned code) const { |
| 792 |
uint64_t raw = 0; |
| 793 |
T result; |
| 794 |
|
| 795 |
switch (size) { |
| 796 |
case kSRegSize: raw = vreg<uint32_t>(code); break; |
| 797 |
case kDRegSize: raw = vreg<uint64_t>(code); break; |
| 798 |
default: |
| 799 |
VIXL_UNREACHABLE(); |
| 800 |
break; |
| 801 |
} |
| 802 |
|
| 803 |
VIXL_STATIC_ASSERT(sizeof(result) <= sizeof(raw)); |
| 804 |
// Copy the result and truncate to fit. This assumes a little-endian host. |
| 805 |
memcpy(&result, &raw, sizeof(result)); |
| 806 |
return result; |
| 807 |
} |
| 808 |
|
| 809 |
inline SimVRegister& vreg(unsigned code) { |
| 810 |
return vregisters_[code]; |
| 811 |
} |
| 812 |
|
| 813 |
// Basic accessor: Write the specified value. |
| 814 |
template<typename T> |
| 815 |
void set_vreg(unsigned code, T value, |
| 816 |
RegLogMode log_mode = LogRegWrites) { |
| 817 |
VIXL_STATIC_ASSERT((sizeof(value) == kBRegSizeInBytes) || |
| 818 |
(sizeof(value) == kHRegSizeInBytes) || |
| 819 |
(sizeof(value) == kSRegSizeInBytes) || |
| 820 |
(sizeof(value) == kDRegSizeInBytes) || |
| 821 |
(sizeof(value) == kQRegSizeInBytes)); |
| 822 |
VIXL_ASSERT(code < kNumberOfVRegisters); |
| 823 |
vregisters_[code].Set(value); |
| 824 |
|
| 825 |
if (log_mode == LogRegWrites) { |
| 826 |
LogVRegister(code, GetPrintRegisterFormat(value)); |
| 827 |
} |
| 828 |
} |
| 829 |
|
| 830 |
// Common specialized accessors for the set_vreg() template. |
| 831 |
void set_breg(unsigned code, int8_t value, |
| 832 |
RegLogMode log_mode = LogRegWrites) { |
| 833 |
set_vreg(code, value, log_mode); |
| 834 |
} |
| 835 |
|
| 836 |
void set_hreg(unsigned code, int16_t value, |
| 837 |
RegLogMode log_mode = LogRegWrites) { |
| 838 |
set_vreg(code, value, log_mode); |
| 839 |
} |
| 840 |
|
| 841 |
void set_sreg(unsigned code, float value, |
| 842 |
RegLogMode log_mode = LogRegWrites) { |
| 843 |
set_vreg(code, value, log_mode); |
| 844 |
} |
| 845 |
|
| 846 |
void set_sreg_bits(unsigned code, uint32_t value, |
| 847 |
RegLogMode log_mode = LogRegWrites) { |
| 848 |
set_vreg(code, value, log_mode); |
| 849 |
} |
| 850 |
|
| 851 |
void set_dreg(unsigned code, double value, |
| 852 |
RegLogMode log_mode = LogRegWrites) { |
| 853 |
set_vreg(code, value, log_mode); |
| 854 |
} |
| 855 |
|
| 856 |
void set_dreg_bits(unsigned code, uint64_t value, |
| 857 |
RegLogMode log_mode = LogRegWrites) { |
| 858 |
set_vreg(code, value, log_mode); |
| 859 |
} |
| 860 |
|
| 861 |
void set_qreg(unsigned code, qreg_t value, |
| 862 |
RegLogMode log_mode = LogRegWrites) { |
| 863 |
set_vreg(code, value, log_mode); |
| 864 |
} |
| 865 |
|
| 866 |
bool N() const { return nzcv_.N() != 0; } |
| 867 |
bool Z() const { return nzcv_.Z() != 0; } |
| 868 |
bool C() const { return nzcv_.C() != 0; } |
| 869 |
bool V() const { return nzcv_.V() != 0; } |
| 870 |
|
| 871 |
SimSystemRegister& ReadNzcv() { return nzcv_; } |
| 872 |
SimSystemRegister& nzcv() { return nzcv_; } |
| 873 |
|
| 874 |
// TODO: Find a way to make the fpcr_ members return the proper types, so |
| 875 |
// these accessors are not necessary. |
| 876 |
FPRounding RMode() { return static_cast<FPRounding>(fpcr_.RMode()); } |
| 877 |
bool DN() { return fpcr_.DN() != 0; } |
| 878 |
SimSystemRegister& fpcr() { return fpcr_; } |
| 879 |
|
| 880 |
UseDefaultNaN ReadDN() const { |
| 881 |
return fpcr_.DN() != 0 ? kUseDefaultNaN : kIgnoreDefaultNaN; |
| 882 |
} |
| 883 |
|
| 884 |
// Specify relevant register formats for Print(V)Register and related helpers. |
| 885 |
enum PrintRegisterFormat { |
| 886 |
// The lane size. |
| 887 |
kPrintRegLaneSizeB = 0 << 0, |
| 888 |
kPrintRegLaneSizeH = 1 << 0, |
| 889 |
kPrintRegLaneSizeS = 2 << 0, |
| 890 |
kPrintRegLaneSizeW = kPrintRegLaneSizeS, |
| 891 |
kPrintRegLaneSizeD = 3 << 0, |
| 892 |
kPrintRegLaneSizeX = kPrintRegLaneSizeD, |
| 893 |
kPrintRegLaneSizeQ = 4 << 0, |
| 894 |
|
| 895 |
kPrintRegLaneSizeOffset = 0, |
| 896 |
kPrintRegLaneSizeMask = 7 << 0, |
| 897 |
|
| 898 |
// The lane count. |
| 899 |
kPrintRegAsScalar = 0, |
| 900 |
kPrintRegAsDVector = 1 << 3, |
| 901 |
kPrintRegAsQVector = 2 << 3, |
| 902 |
|
| 903 |
kPrintRegAsVectorMask = 3 << 3, |
| 904 |
|
| 905 |
// Indicate floating-point format lanes. (This flag is only supported for S- |
| 906 |
// and D-sized lanes.) |
| 907 |
kPrintRegAsFP = 1 << 5, |
| 908 |
|
| 909 |
// Supported combinations. |
| 910 |
|
| 911 |
kPrintXReg = kPrintRegLaneSizeX | kPrintRegAsScalar, |
| 912 |
kPrintWReg = kPrintRegLaneSizeW | kPrintRegAsScalar, |
| 913 |
kPrintSReg = kPrintRegLaneSizeS | kPrintRegAsScalar | kPrintRegAsFP, |
| 914 |
kPrintDReg = kPrintRegLaneSizeD | kPrintRegAsScalar | kPrintRegAsFP, |
| 915 |
|
| 916 |
kPrintReg1B = kPrintRegLaneSizeB | kPrintRegAsScalar, |
| 917 |
kPrintReg8B = kPrintRegLaneSizeB | kPrintRegAsDVector, |
| 918 |
kPrintReg16B = kPrintRegLaneSizeB | kPrintRegAsQVector, |
| 919 |
kPrintReg1H = kPrintRegLaneSizeH | kPrintRegAsScalar, |
| 920 |
kPrintReg4H = kPrintRegLaneSizeH | kPrintRegAsDVector, |
| 921 |
kPrintReg8H = kPrintRegLaneSizeH | kPrintRegAsQVector, |
| 922 |
kPrintReg1S = kPrintRegLaneSizeS | kPrintRegAsScalar, |
| 923 |
kPrintReg2S = kPrintRegLaneSizeS | kPrintRegAsDVector, |
| 924 |
kPrintReg4S = kPrintRegLaneSizeS | kPrintRegAsQVector, |
| 925 |
kPrintReg1SFP = kPrintRegLaneSizeS | kPrintRegAsScalar | kPrintRegAsFP, |
| 926 |
kPrintReg2SFP = kPrintRegLaneSizeS | kPrintRegAsDVector | kPrintRegAsFP, |
| 927 |
kPrintReg4SFP = kPrintRegLaneSizeS | kPrintRegAsQVector | kPrintRegAsFP, |
| 928 |
kPrintReg1D = kPrintRegLaneSizeD | kPrintRegAsScalar, |
| 929 |
kPrintReg2D = kPrintRegLaneSizeD | kPrintRegAsQVector, |
| 930 |
kPrintReg1DFP = kPrintRegLaneSizeD | kPrintRegAsScalar | kPrintRegAsFP, |
| 931 |
kPrintReg2DFP = kPrintRegLaneSizeD | kPrintRegAsQVector | kPrintRegAsFP, |
| 932 |
kPrintReg1Q = kPrintRegLaneSizeQ | kPrintRegAsScalar |
| 933 |
}; |
| 934 |
|
| 935 |
unsigned GetPrintRegLaneSizeInBytesLog2(PrintRegisterFormat format) { |
| 936 |
return (format & kPrintRegLaneSizeMask) >> kPrintRegLaneSizeOffset; |
| 937 |
} |
| 938 |
|
| 939 |
unsigned GetPrintRegLaneSizeInBytes(PrintRegisterFormat format) { |
| 940 |
return 1 << GetPrintRegLaneSizeInBytesLog2(format); |
| 941 |
} |
| 942 |
|
| 943 |
unsigned GetPrintRegSizeInBytesLog2(PrintRegisterFormat format) { |
| 944 |
if (format & kPrintRegAsDVector) return kDRegSizeInBytesLog2; |
| 945 |
if (format & kPrintRegAsQVector) return kQRegSizeInBytesLog2; |
| 946 |
|
| 947 |
// Scalar types. |
| 948 |
return GetPrintRegLaneSizeInBytesLog2(format); |
| 949 |
} |
| 950 |
|
| 951 |
unsigned GetPrintRegSizeInBytes(PrintRegisterFormat format) { |
| 952 |
return 1 << GetPrintRegSizeInBytesLog2(format); |
| 953 |
} |
| 954 |
|
| 955 |
unsigned GetPrintRegLaneCount(PrintRegisterFormat format) { |
| 956 |
unsigned reg_size_log2 = GetPrintRegSizeInBytesLog2(format); |
| 957 |
unsigned lane_size_log2 = GetPrintRegLaneSizeInBytesLog2(format); |
| 958 |
VIXL_ASSERT(reg_size_log2 >= lane_size_log2); |
| 959 |
return 1 << (reg_size_log2 - lane_size_log2); |
| 960 |
} |
| 961 |
|
| 962 |
PrintRegisterFormat GetPrintRegisterFormatForSize(unsigned reg_size, |
| 963 |
unsigned lane_size); |
| 964 |
|
| 965 |
PrintRegisterFormat GetPrintRegisterFormatForSize(unsigned size) { |
| 966 |
return GetPrintRegisterFormatForSize(size, size); |
| 967 |
} |
| 968 |
|
| 969 |
PrintRegisterFormat GetPrintRegisterFormatForSizeFP(unsigned size) { |
| 970 |
switch (size) { |
| 971 |
default: VIXL_UNREACHABLE(); return kPrintDReg; |
| 972 |
case kDRegSizeInBytes: return kPrintDReg; |
| 973 |
case kSRegSizeInBytes: return kPrintSReg; |
| 974 |
} |
| 975 |
} |
| 976 |
|
| 977 |
PrintRegisterFormat GetPrintRegisterFormatTryFP(PrintRegisterFormat format) { |
| 978 |
if ((GetPrintRegLaneSizeInBytes(format) == kSRegSizeInBytes) || |
| 979 |
(GetPrintRegLaneSizeInBytes(format) == kDRegSizeInBytes)) { |
| 980 |
return static_cast<PrintRegisterFormat>(format | kPrintRegAsFP); |
| 981 |
} |
| 982 |
return format; |
| 983 |
} |
| 984 |
|
| 985 |
template<typename T> |
| 986 |
PrintRegisterFormat GetPrintRegisterFormat(T value) { |
| 987 |
return GetPrintRegisterFormatForSize(sizeof(value)); |
| 988 |
} |
| 989 |
|
| 990 |
PrintRegisterFormat GetPrintRegisterFormat(double value) { |
| 991 |
VIXL_STATIC_ASSERT(sizeof(value) == kDRegSizeInBytes); |
| 992 |
return GetPrintRegisterFormatForSizeFP(sizeof(value)); |
| 993 |
} |
| 994 |
|
| 995 |
PrintRegisterFormat GetPrintRegisterFormat(float value) { |
| 996 |
VIXL_STATIC_ASSERT(sizeof(value) == kSRegSizeInBytes); |
| 997 |
return GetPrintRegisterFormatForSizeFP(sizeof(value)); |
| 998 |
} |
| 999 |
|
| 1000 |
PrintRegisterFormat GetPrintRegisterFormat(VectorFormat vform); |
| 1001 |
|
| 1002 |
// Print all registers of the specified types. |
| 1003 |
void PrintRegisters(); |
| 1004 |
void PrintVRegisters(); |
| 1005 |
void PrintSystemRegisters(); |
| 1006 |
|
| 1007 |
// As above, but only print the registers that have been updated. |
| 1008 |
void PrintWrittenRegisters(); |
| 1009 |
void PrintWrittenVRegisters(); |
| 1010 |
|
| 1011 |
// As above, but respect LOG_REG and LOG_VREG. |
| 1012 |
inline void LogWrittenRegisters() { |
| 1013 |
if (trace_parameters() & LOG_REGS) PrintWrittenRegisters(); |
| 1014 |
} |
| 1015 |
inline void LogWrittenVRegisters() { |
| 1016 |
if (trace_parameters() & LOG_VREGS) PrintWrittenVRegisters(); |
| 1017 |
} |
| 1018 |
inline void LogAllWrittenRegisters() { |
| 1019 |
LogWrittenRegisters(); |
| 1020 |
LogWrittenVRegisters(); |
| 1021 |
} |
| 1022 |
|
| 1023 |
// Print individual register values (after update). |
| 1024 |
void PrintRegister(unsigned code, Reg31Mode r31mode = Reg31IsStackPointer); |
| 1025 |
void PrintVRegister(unsigned code, PrintRegisterFormat format); |
| 1026 |
void PrintSystemRegister(SystemRegister id); |
| 1027 |
|
| 1028 |
// Like Print* (above), but respect trace_parameters(). |
| 1029 |
void LogRegister(unsigned code, Reg31Mode r31mode = Reg31IsStackPointer) { |
| 1030 |
if (trace_parameters() & LOG_REGS) PrintRegister(code, r31mode); |
| 1031 |
} |
| 1032 |
void LogVRegister(unsigned code, PrintRegisterFormat format) { |
| 1033 |
if (trace_parameters() & LOG_VREGS) PrintVRegister(code, format); |
| 1034 |
} |
| 1035 |
void LogSystemRegister(SystemRegister id) { |
| 1036 |
if (trace_parameters() & LOG_SYSREGS) PrintSystemRegister(id); |
| 1037 |
} |
| 1038 |
|
| 1039 |
// Print memory accesses. |
| 1040 |
void PrintRead(uintptr_t address, unsigned reg_code, |
| 1041 |
PrintRegisterFormat format); |
| 1042 |
void PrintWrite(uintptr_t address, unsigned reg_code, |
| 1043 |
PrintRegisterFormat format); |
| 1044 |
void PrintVRead(uintptr_t address, unsigned reg_code, |
| 1045 |
PrintRegisterFormat format, unsigned lane); |
| 1046 |
void PrintVWrite(uintptr_t address, unsigned reg_code, |
| 1047 |
PrintRegisterFormat format, unsigned lane); |
| 1048 |
|
| 1049 |
// Like Print* (above), but respect trace_parameters(). |
| 1050 |
void LogRead(uintptr_t address, unsigned reg_code, |
| 1051 |
PrintRegisterFormat format) { |
| 1052 |
if (trace_parameters() & LOG_REGS) PrintRead(address, reg_code, format); |
| 1053 |
} |
| 1054 |
void LogWrite(uintptr_t address, unsigned reg_code, |
| 1055 |
PrintRegisterFormat format) { |
| 1056 |
if (trace_parameters() & LOG_WRITE) PrintWrite(address, reg_code, format); |
| 1057 |
} |
| 1058 |
void LogVRead(uintptr_t address, unsigned reg_code, |
| 1059 |
PrintRegisterFormat format, unsigned lane = 0) { |
| 1060 |
if (trace_parameters() & LOG_VREGS) { |
| 1061 |
PrintVRead(address, reg_code, format, lane); |
| 1062 |
} |
| 1063 |
} |
| 1064 |
void LogVWrite(uintptr_t address, unsigned reg_code, |
| 1065 |
PrintRegisterFormat format, unsigned lane = 0) { |
| 1066 |
if (trace_parameters() & LOG_WRITE) { |
| 1067 |
PrintVWrite(address, reg_code, format, lane); |
| 1068 |
} |
| 1069 |
} |
| 1070 |
|
| 1071 |
// Helper functions for register tracing. |
| 1072 |
void PrintRegisterRawHelper(unsigned code, Reg31Mode r31mode, |
| 1073 |
int size_in_bytes = kXRegSizeInBytes); |
| 1074 |
void PrintVRegisterRawHelper(unsigned code, int bytes = kQRegSizeInBytes, |
| 1075 |
int lsb = 0); |
| 1076 |
void PrintVRegisterFPHelper(unsigned code, unsigned lane_size_in_bytes, |
| 1077 |
int lane_count = 1, int rightmost_lane = 0); |
| 1078 |
|
| 1079 |
void DoUnreachable(const Instruction* instr); |
| 1080 |
void DoTrace(const Instruction* instr); |
| 1081 |
void DoLog(const Instruction* instr); |
| 1082 |
|
| 1083 |
static const char* WRegNameForCode(unsigned code, |
| 1084 |
Reg31Mode mode = Reg31IsZeroRegister); |
| 1085 |
static const char* XRegNameForCode(unsigned code, |
| 1086 |
Reg31Mode mode = Reg31IsZeroRegister); |
| 1087 |
static const char* SRegNameForCode(unsigned code); |
| 1088 |
static const char* DRegNameForCode(unsigned code); |
| 1089 |
static const char* VRegNameForCode(unsigned code); |
| 1090 |
|
| 1091 |
bool coloured_trace() const { return coloured_trace_; } |
| 1092 |
void set_coloured_trace(bool value); |
| 1093 |
|
| 1094 |
int trace_parameters() const { return trace_parameters_; } |
| 1095 |
void set_trace_parameters(int parameters); |
| 1096 |
|
| 1097 |
void set_instruction_stats(bool value); |
| 1098 |
|
| 1099 |
// Clear the simulated local monitor to force the next store-exclusive |
| 1100 |
// instruction to fail. |
| 1101 |
void ClearLocalMonitor() { |
| 1102 |
local_monitor_.Clear(); |
| 1103 |
} |
| 1104 |
|
| 1105 |
void SilenceExclusiveAccessWarning() { |
| 1106 |
print_exclusive_access_warning_ = false; |
| 1107 |
} |
| 1108 |
|
| 1109 |
protected: |
| 1110 |
const char* clr_normal; |
| 1111 |
const char* clr_flag_name; |
| 1112 |
const char* clr_flag_value; |
| 1113 |
const char* clr_reg_name; |
| 1114 |
const char* clr_reg_value; |
| 1115 |
const char* clr_vreg_name; |
| 1116 |
const char* clr_vreg_value; |
| 1117 |
const char* clr_memory_address; |
| 1118 |
const char* clr_warning; |
| 1119 |
const char* clr_warning_message; |
| 1120 |
const char* clr_printf; |
| 1121 |
|
| 1122 |
// Simulation helpers ------------------------------------ |
| 1123 |
bool ConditionPassed(Condition cond) { |
| 1124 |
switch (cond) { |
| 1125 |
case eq: |
| 1126 |
return Z(); |
| 1127 |
case ne: |
| 1128 |
return !Z(); |
| 1129 |
case hs: |
| 1130 |
return C(); |
| 1131 |
case lo: |
| 1132 |
return !C(); |
| 1133 |
case mi: |
| 1134 |
return N(); |
| 1135 |
case pl: |
| 1136 |
return !N(); |
| 1137 |
case vs: |
| 1138 |
return V(); |
| 1139 |
case vc: |
| 1140 |
return !V(); |
| 1141 |
case hi: |
| 1142 |
return C() && !Z(); |
| 1143 |
case ls: |
| 1144 |
return !(C() && !Z()); |
| 1145 |
case ge: |
| 1146 |
return N() == V(); |
| 1147 |
case lt: |
| 1148 |
return N() != V(); |
| 1149 |
case gt: |
| 1150 |
return !Z() && (N() == V()); |
| 1151 |
case le: |
| 1152 |
return !(!Z() && (N() == V())); |
| 1153 |
case nv: |
| 1154 |
VIXL_FALLTHROUGH(); |
| 1155 |
case al: |
| 1156 |
return true; |
| 1157 |
default: |
| 1158 |
VIXL_UNREACHABLE(); |
| 1159 |
return false; |
| 1160 |
} |
| 1161 |
} |
| 1162 |
|
| 1163 |
bool ConditionPassed(Instr cond) { |
| 1164 |
return ConditionPassed(static_cast<Condition>(cond)); |
| 1165 |
} |
| 1166 |
|
| 1167 |
bool ConditionFailed(Condition cond) { |
| 1168 |
return !ConditionPassed(cond); |
| 1169 |
} |
| 1170 |
|
| 1171 |
void AddSubHelper(const Instruction* instr, int64_t op2); |
| 1172 |
uint64_t AddWithCarry(unsigned reg_size, |
| 1173 |
bool set_flags, |
| 1174 |
uint64_t left, |
| 1175 |
uint64_t right, |
| 1176 |
int carry_in = 0); |
| 1177 |
void LogicalHelper(const Instruction* instr, int64_t op2); |
| 1178 |
void ConditionalCompareHelper(const Instruction* instr, int64_t op2); |
| 1179 |
void LoadStoreHelper(const Instruction* instr, |
| 1180 |
int64_t offset, |
| 1181 |
AddrMode addrmode); |
| 1182 |
void LoadStorePairHelper(const Instruction* instr, AddrMode addrmode); |
| 1183 |
template <typename T> |
| 1184 |
void CompareAndSwapHelper(const Instruction* instr); |
| 1185 |
template <typename T> |
| 1186 |
void CompareAndSwapPairHelper(const Instruction* instr); |
| 1187 |
template <typename T> |
| 1188 |
void AtomicMemorySimpleHelper(const Instruction* instr); |
| 1189 |
template <typename T> |
| 1190 |
void AtomicMemorySwapHelper(const Instruction* instr); |
| 1191 |
template <typename T> |
| 1192 |
void LoadAcquireRCpcHelper(const Instruction* instr); |
| 1193 |
uintptr_t AddressModeHelper(unsigned addr_reg, |
| 1194 |
int64_t offset, |
| 1195 |
AddrMode addrmode); |
| 1196 |
void NEONLoadStoreMultiStructHelper(const Instruction* instr, |
| 1197 |
AddrMode addr_mode); |
| 1198 |
void NEONLoadStoreSingleStructHelper(const Instruction* instr, |
| 1199 |
AddrMode addr_mode); |
| 1200 |
|
| 1201 |
uint64_t AddressUntag(uint64_t address) { |
| 1202 |
return address & ~kAddressTagMask; |
| 1203 |
} |
| 1204 |
|
| 1205 |
template <typename T> |
| 1206 |
T* AddressUntag(T* address) { |
| 1207 |
uintptr_t address_raw = reinterpret_cast<uintptr_t>(address); |
| 1208 |
return reinterpret_cast<T*>(AddressUntag(address_raw)); |
| 1209 |
} |
| 1210 |
|
| 1211 |
int64_t ShiftOperand(unsigned reg_size, |
| 1212 |
int64_t value, |
| 1213 |
Shift shift_type, |
| 1214 |
unsigned amount); |
| 1215 |
int64_t Rotate(unsigned reg_width, |
| 1216 |
int64_t value, |
| 1217 |
Shift shift_type, |
| 1218 |
unsigned amount); |
| 1219 |
int64_t ExtendValue(unsigned reg_width, |
| 1220 |
int64_t value, |
| 1221 |
Extend extend_type, |
| 1222 |
unsigned left_shift = 0); |
| 1223 |
uint16_t PolynomialMult(uint8_t op1, uint8_t op2); |
| 1224 |
|
| 1225 |
void ld1(VectorFormat vform, |
| 1226 |
LogicVRegister dst, |
| 1227 |
uint64_t addr); |
| 1228 |
void ld1(VectorFormat vform, |
| 1229 |
LogicVRegister dst, |
| 1230 |
int index, |
| 1231 |
uint64_t addr); |
| 1232 |
void ld1r(VectorFormat vform, |
| 1233 |
LogicVRegister dst, |
| 1234 |
uint64_t addr); |
| 1235 |
void ld2(VectorFormat vform, |
| 1236 |
LogicVRegister dst1, |
| 1237 |
LogicVRegister dst2, |
| 1238 |
uint64_t addr); |
| 1239 |
void ld2(VectorFormat vform, |
| 1240 |
LogicVRegister dst1, |
| 1241 |
LogicVRegister dst2, |
| 1242 |
int index, |
| 1243 |
uint64_t addr); |
| 1244 |
void ld2r(VectorFormat vform, |
| 1245 |
LogicVRegister dst1, |
| 1246 |
LogicVRegister dst2, |
| 1247 |
uint64_t addr); |
| 1248 |
void ld3(VectorFormat vform, |
| 1249 |
LogicVRegister dst1, |
| 1250 |
LogicVRegister dst2, |
| 1251 |
LogicVRegister dst3, |
| 1252 |
uint64_t addr); |
| 1253 |
void ld3(VectorFormat vform, |
| 1254 |
LogicVRegister dst1, |
| 1255 |
LogicVRegister dst2, |
| 1256 |
LogicVRegister dst3, |
| 1257 |
int index, |
| 1258 |
uint64_t addr); |
| 1259 |
void ld3r(VectorFormat vform, |
| 1260 |
LogicVRegister dst1, |
| 1261 |
LogicVRegister dst2, |
| 1262 |
LogicVRegister dst3, |
| 1263 |
uint64_t addr); |
| 1264 |
void ld4(VectorFormat vform, |
| 1265 |
LogicVRegister dst1, |
| 1266 |
LogicVRegister dst2, |
| 1267 |
LogicVRegister dst3, |
| 1268 |
LogicVRegister dst4, |
| 1269 |
uint64_t addr); |
| 1270 |
void ld4(VectorFormat vform, |
| 1271 |
LogicVRegister dst1, |
| 1272 |
LogicVRegister dst2, |
| 1273 |
LogicVRegister dst3, |
| 1274 |
LogicVRegister dst4, |
| 1275 |
int index, |
| 1276 |
uint64_t addr); |
| 1277 |
void ld4r(VectorFormat vform, |
| 1278 |
LogicVRegister dst1, |
| 1279 |
LogicVRegister dst2, |
| 1280 |
LogicVRegister dst3, |
| 1281 |
LogicVRegister dst4, |
| 1282 |
uint64_t addr); |
| 1283 |
void st1(VectorFormat vform, |
| 1284 |
LogicVRegister src, |
| 1285 |
uint64_t addr); |
| 1286 |
void st1(VectorFormat vform, |
| 1287 |
LogicVRegister src, |
| 1288 |
int index, |
| 1289 |
uint64_t addr); |
| 1290 |
void st2(VectorFormat vform, |
| 1291 |
LogicVRegister src, |
| 1292 |
LogicVRegister src2, |
| 1293 |
uint64_t addr); |
| 1294 |
void st2(VectorFormat vform, |
| 1295 |
LogicVRegister src, |
| 1296 |
LogicVRegister src2, |
| 1297 |
int index, |
| 1298 |
uint64_t addr); |
| 1299 |
void st3(VectorFormat vform, |
| 1300 |
LogicVRegister src, |
| 1301 |
LogicVRegister src2, |
| 1302 |
LogicVRegister src3, |
| 1303 |
uint64_t addr); |
| 1304 |
void st3(VectorFormat vform, |
| 1305 |
LogicVRegister src, |
| 1306 |
LogicVRegister src2, |
| 1307 |
LogicVRegister src3, |
| 1308 |
int index, |
| 1309 |
uint64_t addr); |
| 1310 |
void st4(VectorFormat vform, |
| 1311 |
LogicVRegister src, |
| 1312 |
LogicVRegister src2, |
| 1313 |
LogicVRegister src3, |
| 1314 |
LogicVRegister src4, |
| 1315 |
uint64_t addr); |
| 1316 |
void st4(VectorFormat vform, |
| 1317 |
LogicVRegister src, |
| 1318 |
LogicVRegister src2, |
| 1319 |
LogicVRegister src3, |
| 1320 |
LogicVRegister src4, |
| 1321 |
int index, |
| 1322 |
uint64_t addr); |
| 1323 |
LogicVRegister cmp(VectorFormat vform, |
| 1324 |
LogicVRegister dst, |
| 1325 |
const LogicVRegister& src1, |
| 1326 |
const LogicVRegister& src2, |
| 1327 |
Condition cond); |
| 1328 |
LogicVRegister cmp(VectorFormat vform, |
| 1329 |
LogicVRegister dst, |
| 1330 |
const LogicVRegister& src1, |
| 1331 |
int imm, |
| 1332 |
Condition cond); |
| 1333 |
LogicVRegister cmptst(VectorFormat vform, |
| 1334 |
LogicVRegister dst, |
| 1335 |
const LogicVRegister& src1, |
| 1336 |
const LogicVRegister& src2); |
| 1337 |
LogicVRegister add(VectorFormat vform, |
| 1338 |
LogicVRegister dst, |
| 1339 |
const LogicVRegister& src1, |
| 1340 |
const LogicVRegister& src2); |
| 1341 |
LogicVRegister addp(VectorFormat vform, |
| 1342 |
LogicVRegister dst, |
| 1343 |
const LogicVRegister& src1, |
| 1344 |
const LogicVRegister& src2); |
| 1345 |
LogicVRegister mla(VectorFormat vform, |
| 1346 |
LogicVRegister dst, |
| 1347 |
const LogicVRegister& src1, |
| 1348 |
const LogicVRegister& src2); |
| 1349 |
LogicVRegister mls(VectorFormat vform, |
| 1350 |
LogicVRegister dst, |
| 1351 |
const LogicVRegister& src1, |
| 1352 |
const LogicVRegister& src2); |
| 1353 |
LogicVRegister mul(VectorFormat vform, |
| 1354 |
LogicVRegister dst, |
| 1355 |
const LogicVRegister& src1, |
| 1356 |
const LogicVRegister& src2); |
| 1357 |
LogicVRegister mul(VectorFormat vform, |
| 1358 |
LogicVRegister dst, |
| 1359 |
const LogicVRegister& src1, |
| 1360 |
const LogicVRegister& src2, |
| 1361 |
int index); |
| 1362 |
LogicVRegister mla(VectorFormat vform, |
| 1363 |
LogicVRegister dst, |
| 1364 |
const LogicVRegister& src1, |
| 1365 |
const LogicVRegister& src2, |
| 1366 |
int index); |
| 1367 |
LogicVRegister mls(VectorFormat vform, |
| 1368 |
LogicVRegister dst, |
| 1369 |
const LogicVRegister& src1, |
| 1370 |
const LogicVRegister& src2, |
| 1371 |
int index); |
| 1372 |
LogicVRegister pmul(VectorFormat vform, |
| 1373 |
LogicVRegister dst, |
| 1374 |
const LogicVRegister& src1, |
| 1375 |
const LogicVRegister& src2); |
| 1376 |
|
| 1377 |
typedef LogicVRegister (Simulator::*ByElementOp)(VectorFormat vform, |
| 1378 |
LogicVRegister dst, |
| 1379 |
const LogicVRegister& src1, |
| 1380 |
const LogicVRegister& src2, |
| 1381 |
int index); |
| 1382 |
LogicVRegister fmul(VectorFormat vform, |
| 1383 |
LogicVRegister dst, |
| 1384 |
const LogicVRegister& src1, |
| 1385 |
const LogicVRegister& src2, |
| 1386 |
int index); |
| 1387 |
LogicVRegister fmla(VectorFormat vform, |
| 1388 |
LogicVRegister dst, |
| 1389 |
const LogicVRegister& src1, |
| 1390 |
const LogicVRegister& src2, |
| 1391 |
int index); |
| 1392 |
LogicVRegister fmls(VectorFormat vform, |
| 1393 |
LogicVRegister dst, |
| 1394 |
const LogicVRegister& src1, |
| 1395 |
const LogicVRegister& src2, |
| 1396 |
int index); |
| 1397 |
LogicVRegister fmulx(VectorFormat vform, |
| 1398 |
LogicVRegister dst, |
| 1399 |
const LogicVRegister& src1, |
| 1400 |
const LogicVRegister& src2, |
| 1401 |
int index); |
| 1402 |
LogicVRegister smull(VectorFormat vform, |
| 1403 |
LogicVRegister dst, |
| 1404 |
const LogicVRegister& src1, |
| 1405 |
const LogicVRegister& src2, |
| 1406 |
int index); |
| 1407 |
LogicVRegister smull2(VectorFormat vform, |
| 1408 |
LogicVRegister dst, |
| 1409 |
const LogicVRegister& src1, |
| 1410 |
const LogicVRegister& src2, |
| 1411 |
int index); |
| 1412 |
LogicVRegister umull(VectorFormat vform, |
| 1413 |
LogicVRegister dst, |
| 1414 |
const LogicVRegister& src1, |
| 1415 |
const LogicVRegister& src2, |
| 1416 |
int index); |
| 1417 |
LogicVRegister umull2(VectorFormat vform, |
| 1418 |
LogicVRegister dst, |
| 1419 |
const LogicVRegister& src1, |
| 1420 |
const LogicVRegister& src2, |
| 1421 |
int index); |
| 1422 |
LogicVRegister smlal(VectorFormat vform, |
| 1423 |
LogicVRegister dst, |
| 1424 |
const LogicVRegister& src1, |
| 1425 |
const LogicVRegister& src2, |
| 1426 |
int index); |
| 1427 |
LogicVRegister smlal2(VectorFormat vform, |
| 1428 |
LogicVRegister dst, |
| 1429 |
const LogicVRegister& src1, |
| 1430 |
const LogicVRegister& src2, |
| 1431 |
int index); |
| 1432 |
LogicVRegister umlal(VectorFormat vform, |
| 1433 |
LogicVRegister dst, |
| 1434 |
const LogicVRegister& src1, |
| 1435 |
const LogicVRegister& src2, |
| 1436 |
int index); |
| 1437 |
LogicVRegister umlal2(VectorFormat vform, |
| 1438 |
LogicVRegister dst, |
| 1439 |
const LogicVRegister& src1, |
| 1440 |
const LogicVRegister& src2, |
| 1441 |
int index); |
| 1442 |
LogicVRegister smlsl(VectorFormat vform, |
| 1443 |
LogicVRegister dst, |
| 1444 |
const LogicVRegister& src1, |
| 1445 |
const LogicVRegister& src2, |
| 1446 |
int index); |
| 1447 |
LogicVRegister smlsl2(VectorFormat vform, |
| 1448 |
LogicVRegister dst, |
| 1449 |
const LogicVRegister& src1, |
| 1450 |
const LogicVRegister& src2, |
| 1451 |
int index); |
| 1452 |
LogicVRegister umlsl(VectorFormat vform, |
| 1453 |
LogicVRegister dst, |
| 1454 |
const LogicVRegister& src1, |
| 1455 |
const LogicVRegister& src2, |
| 1456 |
int index); |
| 1457 |
LogicVRegister umlsl2(VectorFormat vform, |
| 1458 |
LogicVRegister dst, |
| 1459 |
const LogicVRegister& src1, |
| 1460 |
const LogicVRegister& src2, |
| 1461 |
int index); |
| 1462 |
LogicVRegister sqdmull(VectorFormat vform, |
| 1463 |
LogicVRegister dst, |
| 1464 |
const LogicVRegister& src1, |
| 1465 |
const LogicVRegister& src2, |
| 1466 |
int index); |
| 1467 |
LogicVRegister sqdmull2(VectorFormat vform, |
| 1468 |
LogicVRegister dst, |
| 1469 |
const LogicVRegister& src1, |
| 1470 |
const LogicVRegister& src2, |
| 1471 |
int index); |
| 1472 |
LogicVRegister sqdmlal(VectorFormat vform, |
| 1473 |
LogicVRegister dst, |
| 1474 |
const LogicVRegister& src1, |
| 1475 |
const LogicVRegister& src2, |
| 1476 |
int index); |
| 1477 |
LogicVRegister sqdmlal2(VectorFormat vform, |
| 1478 |
LogicVRegister dst, |
| 1479 |
const LogicVRegister& src1, |
| 1480 |
const LogicVRegister& src2, |
| 1481 |
int index); |
| 1482 |
LogicVRegister sqdmlsl(VectorFormat vform, |
| 1483 |
LogicVRegister dst, |
| 1484 |
const LogicVRegister& src1, |
| 1485 |
const LogicVRegister& src2, |
| 1486 |
int index); |
| 1487 |
LogicVRegister sqdmlsl2(VectorFormat vform, |
| 1488 |
LogicVRegister dst, |
| 1489 |
const LogicVRegister& src1, |
| 1490 |
const LogicVRegister& src2, |
| 1491 |
int index); |
| 1492 |
LogicVRegister sqdmulh(VectorFormat vform, |
| 1493 |
LogicVRegister dst, |
| 1494 |
const LogicVRegister& src1, |
| 1495 |
const LogicVRegister& src2, |
| 1496 |
int index); |
| 1497 |
LogicVRegister sqrdmulh(VectorFormat vform, |
| 1498 |
LogicVRegister dst, |
| 1499 |
const LogicVRegister& src1, |
| 1500 |
const LogicVRegister& src2, |
| 1501 |
int index); |
| 1502 |
LogicVRegister sub(VectorFormat vform, |
| 1503 |
LogicVRegister dst, |
| 1504 |
const LogicVRegister& src1, |
| 1505 |
const LogicVRegister& src2); |
| 1506 |
LogicVRegister and_(VectorFormat vform, |
| 1507 |
LogicVRegister dst, |
| 1508 |
const LogicVRegister& src1, |
| 1509 |
const LogicVRegister& src2); |
| 1510 |
LogicVRegister orr(VectorFormat vform, |
| 1511 |
LogicVRegister dst, |
| 1512 |
const LogicVRegister& src1, |
| 1513 |
const LogicVRegister& src2); |
| 1514 |
LogicVRegister orn(VectorFormat vform, |
| 1515 |
LogicVRegister dst, |
| 1516 |
const LogicVRegister& src1, |
| 1517 |
const LogicVRegister& src2); |
| 1518 |
LogicVRegister eor(VectorFormat vform, |
| 1519 |
LogicVRegister dst, |
| 1520 |
const LogicVRegister& src1, |
| 1521 |
const LogicVRegister& src2); |
| 1522 |
LogicVRegister bic(VectorFormat vform, |
| 1523 |
LogicVRegister dst, |
| 1524 |
const LogicVRegister& src1, |
| 1525 |
const LogicVRegister& src2); |
| 1526 |
LogicVRegister bic(VectorFormat vform, |
| 1527 |
LogicVRegister dst, |
| 1528 |
const LogicVRegister& src, |
| 1529 |
uint64_t imm); |
| 1530 |
LogicVRegister bif(VectorFormat vform, |
| 1531 |
LogicVRegister dst, |
| 1532 |
const LogicVRegister& src1, |
| 1533 |
const LogicVRegister& src2); |
| 1534 |
LogicVRegister bit(VectorFormat vform, |
| 1535 |
LogicVRegister dst, |
| 1536 |
const LogicVRegister& src1, |
| 1537 |
const LogicVRegister& src2); |
| 1538 |
LogicVRegister bsl(VectorFormat vform, |
| 1539 |
LogicVRegister dst, |
| 1540 |
const LogicVRegister& src1, |
| 1541 |
const LogicVRegister& src2); |
| 1542 |
LogicVRegister cls(VectorFormat vform, |
| 1543 |
LogicVRegister dst, |
| 1544 |
const LogicVRegister& src); |
| 1545 |
LogicVRegister clz(VectorFormat vform, |
| 1546 |
LogicVRegister dst, |
| 1547 |
const LogicVRegister& src); |
| 1548 |
LogicVRegister cnt(VectorFormat vform, |
| 1549 |
LogicVRegister dst, |
| 1550 |
const LogicVRegister& src); |
| 1551 |
LogicVRegister not_(VectorFormat vform, |
| 1552 |
LogicVRegister dst, |
| 1553 |
const LogicVRegister& src); |
| 1554 |
LogicVRegister rbit(VectorFormat vform, |
| 1555 |
LogicVRegister dst, |
| 1556 |
const LogicVRegister& src); |
| 1557 |
LogicVRegister rev(VectorFormat vform, |
| 1558 |
LogicVRegister dst, |
| 1559 |
const LogicVRegister& src, |
| 1560 |
int revSize); |
| 1561 |
LogicVRegister rev16(VectorFormat vform, |
| 1562 |
LogicVRegister dst, |
| 1563 |
const LogicVRegister& src); |
| 1564 |
LogicVRegister rev32(VectorFormat vform, |
| 1565 |
LogicVRegister dst, |
| 1566 |
const LogicVRegister& src); |
| 1567 |
LogicVRegister rev64(VectorFormat vform, |
| 1568 |
LogicVRegister dst, |
| 1569 |
const LogicVRegister& src); |
| 1570 |
LogicVRegister addlp(VectorFormat vform, |
| 1571 |
LogicVRegister dst, |
| 1572 |
const LogicVRegister& src, |
| 1573 |
bool is_signed, |
| 1574 |
bool do_accumulate); |
| 1575 |
LogicVRegister saddlp(VectorFormat vform, |
| 1576 |
LogicVRegister dst, |
| 1577 |
const LogicVRegister& src); |
| 1578 |
LogicVRegister uaddlp(VectorFormat vform, |
| 1579 |
LogicVRegister dst, |
| 1580 |
const LogicVRegister& src); |
| 1581 |
LogicVRegister sadalp(VectorFormat vform, |
| 1582 |
LogicVRegister dst, |
| 1583 |
const LogicVRegister& src); |
| 1584 |
LogicVRegister uadalp(VectorFormat vform, |
| 1585 |
LogicVRegister dst, |
| 1586 |
const LogicVRegister& src); |
| 1587 |
LogicVRegister ext(VectorFormat vform, |
| 1588 |
LogicVRegister dst, |
| 1589 |
const LogicVRegister& src1, |
| 1590 |
const LogicVRegister& src2, |
| 1591 |
int index); |
| 1592 |
LogicVRegister ins_element(VectorFormat vform, |
| 1593 |
LogicVRegister dst, |
| 1594 |
int dst_index, |
| 1595 |
const LogicVRegister& src, |
| 1596 |
int src_index); |
| 1597 |
LogicVRegister ins_immediate(VectorFormat vform, |
| 1598 |
LogicVRegister dst, |
| 1599 |
int dst_index, |
| 1600 |
uint64_t imm); |
| 1601 |
LogicVRegister dup_element(VectorFormat vform, |
| 1602 |
LogicVRegister dst, |
| 1603 |
const LogicVRegister& src, |
| 1604 |
int src_index); |
| 1605 |
LogicVRegister dup_immediate(VectorFormat vform, |
| 1606 |
LogicVRegister dst, |
| 1607 |
uint64_t imm); |
| 1608 |
LogicVRegister mov(VectorFormat vform, |
| 1609 |
LogicVRegister dst, |
| 1610 |
const LogicVRegister& src); |
| 1611 |
LogicVRegister movi(VectorFormat vform, |
| 1612 |
LogicVRegister dst, |
| 1613 |
uint64_t imm); |
| 1614 |
LogicVRegister mvni(VectorFormat vform, |
| 1615 |
LogicVRegister dst, |
| 1616 |
uint64_t imm); |
| 1617 |
LogicVRegister orr(VectorFormat vform, |
| 1618 |
LogicVRegister dst, |
| 1619 |
const LogicVRegister& src, |
| 1620 |
uint64_t imm); |
| 1621 |
LogicVRegister sshl(VectorFormat vform, |
| 1622 |
LogicVRegister dst, |
| 1623 |
const LogicVRegister& src1, |
| 1624 |
const LogicVRegister& src2); |
| 1625 |
LogicVRegister ushl(VectorFormat vform, |
| 1626 |
LogicVRegister dst, |
| 1627 |
const LogicVRegister& src1, |
| 1628 |
const LogicVRegister& src2); |
| 1629 |
LogicVRegister sminmax(VectorFormat vform, |
| 1630 |
LogicVRegister dst, |
| 1631 |
const LogicVRegister& src1, |
| 1632 |
const LogicVRegister& src2, |
| 1633 |
bool max); |
| 1634 |
LogicVRegister smax(VectorFormat vform, |
| 1635 |
LogicVRegister dst, |
| 1636 |
const LogicVRegister& src1, |
| 1637 |
const LogicVRegister& src2); |
| 1638 |
LogicVRegister smin(VectorFormat vform, |
| 1639 |
LogicVRegister dst, |
| 1640 |
const LogicVRegister& src1, |
| 1641 |
const LogicVRegister& src2); |
| 1642 |
LogicVRegister sminmaxp(VectorFormat vform, |
| 1643 |
LogicVRegister dst, |
| 1644 |
int dst_index, |
| 1645 |
const LogicVRegister& src, |
| 1646 |
bool max); |
| 1647 |
LogicVRegister smaxp(VectorFormat vform, |
| 1648 |
LogicVRegister dst, |
| 1649 |
const LogicVRegister& src1, |
| 1650 |
const LogicVRegister& src2); |
| 1651 |
LogicVRegister sminp(VectorFormat vform, |
| 1652 |
LogicVRegister dst, |
| 1653 |
const LogicVRegister& src1, |
| 1654 |
const LogicVRegister& src2); |
| 1655 |
LogicVRegister addp(VectorFormat vform, |
| 1656 |
LogicVRegister dst, |
| 1657 |
const LogicVRegister& src); |
| 1658 |
LogicVRegister addv(VectorFormat vform, |
| 1659 |
LogicVRegister dst, |
| 1660 |
const LogicVRegister& src); |
| 1661 |
LogicVRegister uaddlv(VectorFormat vform, |
| 1662 |
LogicVRegister dst, |
| 1663 |
const LogicVRegister& src); |
| 1664 |
LogicVRegister saddlv(VectorFormat vform, |
| 1665 |
LogicVRegister dst, |
| 1666 |
const LogicVRegister& src); |
| 1667 |
LogicVRegister sminmaxv(VectorFormat vform, |
| 1668 |
LogicVRegister dst, |
| 1669 |
const LogicVRegister& src, |
| 1670 |
bool max); |
| 1671 |
LogicVRegister smaxv(VectorFormat vform, |
| 1672 |
LogicVRegister dst, |
| 1673 |
const LogicVRegister& src); |
| 1674 |
LogicVRegister sminv(VectorFormat vform, |
| 1675 |
LogicVRegister dst, |
| 1676 |
const LogicVRegister& src); |
| 1677 |
LogicVRegister uxtl(VectorFormat vform, |
| 1678 |
LogicVRegister dst, |
| 1679 |
const LogicVRegister& src); |
| 1680 |
LogicVRegister uxtl2(VectorFormat vform, |
| 1681 |
LogicVRegister dst, |
| 1682 |
const LogicVRegister& src); |
| 1683 |
LogicVRegister sxtl(VectorFormat vform, |
| 1684 |
LogicVRegister dst, |
| 1685 |
const LogicVRegister& src); |
| 1686 |
LogicVRegister sxtl2(VectorFormat vform, |
| 1687 |
LogicVRegister dst, |
| 1688 |
const LogicVRegister& src); |
| 1689 |
LogicVRegister tbl(VectorFormat vform, |
| 1690 |
LogicVRegister dst, |
| 1691 |
const LogicVRegister& tab, |
| 1692 |
const LogicVRegister& ind); |
| 1693 |
LogicVRegister tbl(VectorFormat vform, |
| 1694 |
LogicVRegister dst, |
| 1695 |
const LogicVRegister& tab, |
| 1696 |
const LogicVRegister& tab2, |
| 1697 |
const LogicVRegister& ind); |
| 1698 |
LogicVRegister tbl(VectorFormat vform, |
| 1699 |
LogicVRegister dst, |
| 1700 |
const LogicVRegister& tab, |
| 1701 |
const LogicVRegister& tab2, |
| 1702 |
const LogicVRegister& tab3, |
| 1703 |
const LogicVRegister& ind); |
| 1704 |
LogicVRegister tbl(VectorFormat vform, |
| 1705 |
LogicVRegister dst, |
| 1706 |
const LogicVRegister& tab, |
| 1707 |
const LogicVRegister& tab2, |
| 1708 |
const LogicVRegister& tab3, |
| 1709 |
const LogicVRegister& tab4, |
| 1710 |
const LogicVRegister& ind); |
| 1711 |
LogicVRegister tbx(VectorFormat vform, |
| 1712 |
LogicVRegister dst, |
| 1713 |
const LogicVRegister& tab, |
| 1714 |
const LogicVRegister& ind); |
| 1715 |
LogicVRegister tbx(VectorFormat vform, |
| 1716 |
LogicVRegister dst, |
| 1717 |
const LogicVRegister& tab, |
| 1718 |
const LogicVRegister& tab2, |
| 1719 |
const LogicVRegister& ind); |
| 1720 |
LogicVRegister tbx(VectorFormat vform, |
| 1721 |
LogicVRegister dst, |
| 1722 |
const LogicVRegister& tab, |
| 1723 |
const LogicVRegister& tab2, |
| 1724 |
const LogicVRegister& tab3, |
| 1725 |
const LogicVRegister& ind); |
| 1726 |
LogicVRegister tbx(VectorFormat vform, |
| 1727 |
LogicVRegister dst, |
| 1728 |
const LogicVRegister& tab, |
| 1729 |
const LogicVRegister& tab2, |
| 1730 |
const LogicVRegister& tab3, |
| 1731 |
const LogicVRegister& tab4, |
| 1732 |
const LogicVRegister& ind); |
| 1733 |
LogicVRegister uaddl(VectorFormat vform, |
| 1734 |
LogicVRegister dst, |
| 1735 |
const LogicVRegister& src1, |
| 1736 |
const LogicVRegister& src2); |
| 1737 |
LogicVRegister uaddl2(VectorFormat vform, |
| 1738 |
LogicVRegister dst, |
| 1739 |
const LogicVRegister& src1, |
| 1740 |
const LogicVRegister& src2); |
| 1741 |
LogicVRegister uaddw(VectorFormat vform, |
| 1742 |
LogicVRegister dst, |
| 1743 |
const LogicVRegister& src1, |
| 1744 |
const LogicVRegister& src2); |
| 1745 |
LogicVRegister uaddw2(VectorFormat vform, |
| 1746 |
LogicVRegister dst, |
| 1747 |
const LogicVRegister& src1, |
| 1748 |
const LogicVRegister& src2); |
| 1749 |
LogicVRegister saddl(VectorFormat vform, |
| 1750 |
LogicVRegister dst, |
| 1751 |
const LogicVRegister& src1, |
| 1752 |
const LogicVRegister& src2); |
| 1753 |
LogicVRegister saddl2(VectorFormat vform, |
| 1754 |
LogicVRegister dst, |
| 1755 |
const LogicVRegister& src1, |
| 1756 |
const LogicVRegister& src2); |
| 1757 |
LogicVRegister saddw(VectorFormat vform, |
| 1758 |
LogicVRegister dst, |
| 1759 |
const LogicVRegister& src1, |
| 1760 |
const LogicVRegister& src2); |
| 1761 |
LogicVRegister saddw2(VectorFormat vform, |
| 1762 |
LogicVRegister dst, |
| 1763 |
const LogicVRegister& src1, |
| 1764 |
const LogicVRegister& src2); |
| 1765 |
LogicVRegister usubl(VectorFormat vform, |
| 1766 |
LogicVRegister dst, |
| 1767 |
const LogicVRegister& src1, |
| 1768 |
const LogicVRegister& src2); |
| 1769 |
LogicVRegister usubl2(VectorFormat vform, |
| 1770 |
LogicVRegister dst, |
| 1771 |
const LogicVRegister& src1, |
| 1772 |
const LogicVRegister& src2); |
| 1773 |
LogicVRegister usubw(VectorFormat vform, |
| 1774 |
LogicVRegister dst, |
| 1775 |
const LogicVRegister& src1, |
| 1776 |
const LogicVRegister& src2); |
| 1777 |
LogicVRegister usubw2(VectorFormat vform, |
| 1778 |
LogicVRegister dst, |
| 1779 |
const LogicVRegister& src1, |
| 1780 |
const LogicVRegister& src2); |
| 1781 |
LogicVRegister ssubl(VectorFormat vform, |
| 1782 |
LogicVRegister dst, |
| 1783 |
const LogicVRegister& src1, |
| 1784 |
const LogicVRegister& src2); |
| 1785 |
LogicVRegister ssubl2(VectorFormat vform, |
| 1786 |
LogicVRegister dst, |
| 1787 |
const LogicVRegister& src1, |
| 1788 |
const LogicVRegister& src2); |
| 1789 |
LogicVRegister ssubw(VectorFormat vform, |
| 1790 |
LogicVRegister dst, |
| 1791 |
const LogicVRegister& src1, |
| 1792 |
const LogicVRegister& src2); |
| 1793 |
LogicVRegister ssubw2(VectorFormat vform, |
| 1794 |
LogicVRegister dst, |
| 1795 |
const LogicVRegister& src1, |
| 1796 |
const LogicVRegister& src2); |
| 1797 |
LogicVRegister uminmax(VectorFormat vform, |
| 1798 |
LogicVRegister dst, |
| 1799 |
const LogicVRegister& src1, |
| 1800 |
const LogicVRegister& src2, |
| 1801 |
bool max); |
| 1802 |
LogicVRegister umax(VectorFormat vform, |
| 1803 |
LogicVRegister dst, |
| 1804 |
const LogicVRegister& src1, |
| 1805 |
const LogicVRegister& src2); |
| 1806 |
LogicVRegister umin(VectorFormat vform, |
| 1807 |
LogicVRegister dst, |
| 1808 |
const LogicVRegister& src1, |
| 1809 |
const LogicVRegister& src2); |
| 1810 |
LogicVRegister uminmaxp(VectorFormat vform, |
| 1811 |
LogicVRegister dst, |
| 1812 |
int dst_index, |
| 1813 |
const LogicVRegister& src, |
| 1814 |
bool max); |
| 1815 |
LogicVRegister umaxp(VectorFormat vform, |
| 1816 |
LogicVRegister dst, |
| 1817 |
const LogicVRegister& src1, |
| 1818 |
const LogicVRegister& src2); |
| 1819 |
LogicVRegister uminp(VectorFormat vform, |
| 1820 |
LogicVRegister dst, |
| 1821 |
const LogicVRegister& src1, |
| 1822 |
const LogicVRegister& src2); |
| 1823 |
LogicVRegister uminmaxv(VectorFormat vform, |
| 1824 |
LogicVRegister dst, |
| 1825 |
const LogicVRegister& src, |
| 1826 |
bool max); |
| 1827 |
LogicVRegister umaxv(VectorFormat vform, |
| 1828 |
LogicVRegister dst, |
| 1829 |
const LogicVRegister& src); |
| 1830 |
LogicVRegister uminv(VectorFormat vform, |
| 1831 |
LogicVRegister dst, |
| 1832 |
const LogicVRegister& src); |
| 1833 |
LogicVRegister trn1(VectorFormat vform, |
| 1834 |
LogicVRegister dst, |
| 1835 |
const LogicVRegister& src1, |
| 1836 |
const LogicVRegister& src2); |
| 1837 |
LogicVRegister trn2(VectorFormat vform, |
| 1838 |
LogicVRegister dst, |
| 1839 |
const LogicVRegister& src1, |
| 1840 |
const LogicVRegister& src2); |
| 1841 |
LogicVRegister zip1(VectorFormat vform, |
| 1842 |
LogicVRegister dst, |
| 1843 |
const LogicVRegister& src1, |
| 1844 |
const LogicVRegister& src2); |
| 1845 |
LogicVRegister zip2(VectorFormat vform, |
| 1846 |
LogicVRegister dst, |
| 1847 |
const LogicVRegister& src1, |
| 1848 |
const LogicVRegister& src2); |
| 1849 |
LogicVRegister uzp1(VectorFormat vform, |
| 1850 |
LogicVRegister dst, |
| 1851 |
const LogicVRegister& src1, |
| 1852 |
const LogicVRegister& src2); |
| 1853 |
LogicVRegister uzp2(VectorFormat vform, |
| 1854 |
LogicVRegister dst, |
| 1855 |
const LogicVRegister& src1, |
| 1856 |
const LogicVRegister& src2); |
| 1857 |
LogicVRegister shl(VectorFormat vform, |
| 1858 |
LogicVRegister dst, |
| 1859 |
const LogicVRegister& src, |
| 1860 |
int shift); |
| 1861 |
LogicVRegister scvtf(VectorFormat vform, |
| 1862 |
LogicVRegister dst, |
| 1863 |
const LogicVRegister& src, |
| 1864 |
int fbits, |
| 1865 |
FPRounding rounding_mode); |
| 1866 |
LogicVRegister ucvtf(VectorFormat vform, |
| 1867 |
LogicVRegister dst, |
| 1868 |
const LogicVRegister& src, |
| 1869 |
int fbits, |
| 1870 |
FPRounding rounding_mode); |
| 1871 |
LogicVRegister sshll(VectorFormat vform, |
| 1872 |
LogicVRegister dst, |
| 1873 |
const LogicVRegister& src, |
| 1874 |
int shift); |
| 1875 |
LogicVRegister sshll2(VectorFormat vform, |
| 1876 |
LogicVRegister dst, |
| 1877 |
const LogicVRegister& src, |
| 1878 |
int shift); |
| 1879 |
LogicVRegister shll(VectorFormat vform, |
| 1880 |
LogicVRegister dst, |
| 1881 |
const LogicVRegister& src); |
| 1882 |
LogicVRegister shll2(VectorFormat vform, |
| 1883 |
LogicVRegister dst, |
| 1884 |
const LogicVRegister& src); |
| 1885 |
LogicVRegister ushll(VectorFormat vform, |
| 1886 |
LogicVRegister dst, |
| 1887 |
const LogicVRegister& src, |
| 1888 |
int shift); |
| 1889 |
LogicVRegister ushll2(VectorFormat vform, |
| 1890 |
LogicVRegister dst, |
| 1891 |
const LogicVRegister& src, |
| 1892 |
int shift); |
| 1893 |
LogicVRegister sli(VectorFormat vform, |
| 1894 |
LogicVRegister dst, |
| 1895 |
const LogicVRegister& src, |
| 1896 |
int shift); |
| 1897 |
LogicVRegister sri(VectorFormat vform, |
| 1898 |
LogicVRegister dst, |
| 1899 |
const LogicVRegister& src, |
| 1900 |
int shift); |
| 1901 |
LogicVRegister sshr(VectorFormat vform, |
| 1902 |
LogicVRegister dst, |
| 1903 |
const LogicVRegister& src, |
| 1904 |
int shift); |
| 1905 |
LogicVRegister ushr(VectorFormat vform, |
| 1906 |
LogicVRegister dst, |
| 1907 |
const LogicVRegister& src, |
| 1908 |
int shift); |
| 1909 |
LogicVRegister ssra(VectorFormat vform, |
| 1910 |
LogicVRegister dst, |
| 1911 |
const LogicVRegister& src, |
| 1912 |
int shift); |
| 1913 |
LogicVRegister usra(VectorFormat vform, |
| 1914 |
LogicVRegister dst, |
| 1915 |
const LogicVRegister& src, |
| 1916 |
int shift); |
| 1917 |
LogicVRegister srsra(VectorFormat vform, |
| 1918 |
LogicVRegister dst, |
| 1919 |
const LogicVRegister& src, |
| 1920 |
int shift); |
| 1921 |
LogicVRegister ursra(VectorFormat vform, |
| 1922 |
LogicVRegister dst, |
| 1923 |
const LogicVRegister& src, |
| 1924 |
int shift); |
| 1925 |
LogicVRegister suqadd(VectorFormat vform, |
| 1926 |
LogicVRegister dst, |
| 1927 |
const LogicVRegister& src); |
| 1928 |
LogicVRegister usqadd(VectorFormat vform, |
| 1929 |
LogicVRegister dst, |
| 1930 |
const LogicVRegister& src); |
| 1931 |
LogicVRegister sqshl(VectorFormat vform, |
| 1932 |
LogicVRegister dst, |
| 1933 |
const LogicVRegister& src, |
| 1934 |
int shift); |
| 1935 |
LogicVRegister uqshl(VectorFormat vform, |
| 1936 |
LogicVRegister dst, |
| 1937 |
const LogicVRegister& src, |
| 1938 |
int shift); |
| 1939 |
LogicVRegister sqshlu(VectorFormat vform, |
| 1940 |
LogicVRegister dst, |
| 1941 |
const LogicVRegister& src, |
| 1942 |
int shift); |
| 1943 |
LogicVRegister abs(VectorFormat vform, |
| 1944 |
LogicVRegister dst, |
| 1945 |
const LogicVRegister& src); |
| 1946 |
LogicVRegister neg(VectorFormat vform, |
| 1947 |
LogicVRegister dst, |
| 1948 |
const LogicVRegister& src); |
| 1949 |
LogicVRegister extractnarrow(VectorFormat vform, |
| 1950 |
LogicVRegister dst, |
| 1951 |
bool dstIsSigned, |
| 1952 |
const LogicVRegister& src, |
| 1953 |
bool srcIsSigned); |
| 1954 |
LogicVRegister xtn(VectorFormat vform, |
| 1955 |
LogicVRegister dst, |
| 1956 |
const LogicVRegister& src); |
| 1957 |
LogicVRegister sqxtn(VectorFormat vform, |
| 1958 |
LogicVRegister dst, |
| 1959 |
const LogicVRegister& src); |
| 1960 |
LogicVRegister uqxtn(VectorFormat vform, |
| 1961 |
LogicVRegister dst, |
| 1962 |
const LogicVRegister& src); |
| 1963 |
LogicVRegister sqxtun(VectorFormat vform, |
| 1964 |
LogicVRegister dst, |
| 1965 |
const LogicVRegister& src); |
| 1966 |
LogicVRegister absdiff(VectorFormat vform, |
| 1967 |
LogicVRegister dst, |
| 1968 |
const LogicVRegister& src1, |
| 1969 |
const LogicVRegister& src2, |
| 1970 |
bool issigned); |
| 1971 |
LogicVRegister saba(VectorFormat vform, |
| 1972 |
LogicVRegister dst, |
| 1973 |
const LogicVRegister& src1, |
| 1974 |
const LogicVRegister& src2); |
| 1975 |
LogicVRegister uaba(VectorFormat vform, |
| 1976 |
LogicVRegister dst, |
| 1977 |
const LogicVRegister& src1, |
| 1978 |
const LogicVRegister& src2); |
| 1979 |
LogicVRegister shrn(VectorFormat vform, |
| 1980 |
LogicVRegister dst, |
| 1981 |
const LogicVRegister& src, |
| 1982 |
int shift); |
| 1983 |
LogicVRegister shrn2(VectorFormat vform, |
| 1984 |
LogicVRegister dst, |
| 1985 |
const LogicVRegister& src, |
| 1986 |
int shift); |
| 1987 |
LogicVRegister rshrn(VectorFormat vform, |
| 1988 |
LogicVRegister dst, |
| 1989 |
const LogicVRegister& src, |
| 1990 |
int shift); |
| 1991 |
LogicVRegister rshrn2(VectorFormat vform, |
| 1992 |
LogicVRegister dst, |
| 1993 |
const LogicVRegister& src, |
| 1994 |
int shift); |
| 1995 |
LogicVRegister uqshrn(VectorFormat vform, |
| 1996 |
LogicVRegister dst, |
| 1997 |
const LogicVRegister& src, |
| 1998 |
int shift); |
| 1999 |
LogicVRegister uqshrn2(VectorFormat vform, |
| 2000 |
LogicVRegister dst, |
| 2001 |
const LogicVRegister& src, |
| 2002 |
int shift); |
| 2003 |
LogicVRegister uqrshrn(VectorFormat vform, |
| 2004 |
LogicVRegister dst, |
| 2005 |
const LogicVRegister& src, |
| 2006 |
int shift); |
| 2007 |
LogicVRegister uqrshrn2(VectorFormat vform, |
| 2008 |
LogicVRegister dst, |
| 2009 |
const LogicVRegister& src, |
| 2010 |
int shift); |
| 2011 |
LogicVRegister sqshrn(VectorFormat vform, |
| 2012 |
LogicVRegister dst, |
| 2013 |
const LogicVRegister& src, |
| 2014 |
int shift); |
| 2015 |
LogicVRegister sqshrn2(VectorFormat vform, |
| 2016 |
LogicVRegister dst, |
| 2017 |
const LogicVRegister& src, |
| 2018 |
int shift); |
| 2019 |
LogicVRegister sqrshrn(VectorFormat vform, |
| 2020 |
LogicVRegister dst, |
| 2021 |
const LogicVRegister& src, |
| 2022 |
int shift); |
| 2023 |
LogicVRegister sqrshrn2(VectorFormat vform, |
| 2024 |
LogicVRegister dst, |
| 2025 |
const LogicVRegister& src, |
| 2026 |
int shift); |
| 2027 |
LogicVRegister sqshrun(VectorFormat vform, |
| 2028 |
LogicVRegister dst, |
| 2029 |
const LogicVRegister& src, |
| 2030 |
int shift); |
| 2031 |
LogicVRegister sqshrun2(VectorFormat vform, |
| 2032 |
LogicVRegister dst, |
| 2033 |
const LogicVRegister& src, |
| 2034 |
int shift); |
| 2035 |
LogicVRegister sqrshrun(VectorFormat vform, |
| 2036 |
LogicVRegister dst, |
| 2037 |
const LogicVRegister& src, |
| 2038 |
int shift); |
| 2039 |
LogicVRegister sqrshrun2(VectorFormat vform, |
| 2040 |
LogicVRegister dst, |
| 2041 |
const LogicVRegister& src, |
| 2042 |
int shift); |
| 2043 |
LogicVRegister sqrdmulh(VectorFormat vform, |
| 2044 |
LogicVRegister dst, |
| 2045 |
const LogicVRegister& src1, |
| 2046 |
const LogicVRegister& src2, |
| 2047 |
bool round = true); |
| 2048 |
LogicVRegister sqdmulh(VectorFormat vform, |
| 2049 |
LogicVRegister dst, |
| 2050 |
const LogicVRegister& src1, |
| 2051 |
const LogicVRegister& src2); |
| 2052 |
#define NEON_3VREG_LOGIC_LIST(V) \ |
| 2053 |
V(addhn) \ |
| 2054 |
V(addhn2) \ |
| 2055 |
V(raddhn) \ |
| 2056 |
V(raddhn2) \ |
| 2057 |
V(subhn) \ |
| 2058 |
V(subhn2) \ |
| 2059 |
V(rsubhn) \ |
| 2060 |
V(rsubhn2) \ |
| 2061 |
V(pmull) \ |
| 2062 |
V(pmull2) \ |
| 2063 |
V(sabal) \ |
| 2064 |
V(sabal2) \ |
| 2065 |
V(uabal) \ |
| 2066 |
V(uabal2) \ |
| 2067 |
V(sabdl) \ |
| 2068 |
V(sabdl2) \ |
| 2069 |
V(uabdl) \ |
| 2070 |
V(uabdl2) \ |
| 2071 |
V(smull) \ |
| 2072 |
V(smull2) \ |
| 2073 |
V(umull) \ |
| 2074 |
V(umull2) \ |
| 2075 |
V(smlal) \ |
| 2076 |
V(smlal2) \ |
| 2077 |
V(umlal) \ |
| 2078 |
V(umlal2) \ |
| 2079 |
V(smlsl) \ |
| 2080 |
V(smlsl2) \ |
| 2081 |
V(umlsl) \ |
| 2082 |
V(umlsl2) \ |
| 2083 |
V(sqdmlal) \ |
| 2084 |
V(sqdmlal2) \ |
| 2085 |
V(sqdmlsl) \ |
| 2086 |
V(sqdmlsl2) \ |
| 2087 |
V(sqdmull) \ |
| 2088 |
V(sqdmull2) |
| 2089 |
|
| 2090 |
#define DEFINE_LOGIC_FUNC(FXN) \ |
| 2091 |
LogicVRegister FXN(VectorFormat vform, \ |
| 2092 |
LogicVRegister dst, \ |
| 2093 |
const LogicVRegister& src1, \ |
| 2094 |
const LogicVRegister& src2); |
| 2095 |
NEON_3VREG_LOGIC_LIST(DEFINE_LOGIC_FUNC) |
| 2096 |
#undef DEFINE_LOGIC_FUNC |
| 2097 |
|
| 2098 |
#define NEON_FP3SAME_LIST(V) \ |
| 2099 |
V(fadd, FPAdd, false) \ |
| 2100 |
V(fsub, FPSub, true) \ |
| 2101 |
V(fmul, FPMul, true) \ |
| 2102 |
V(fmulx, FPMulx, true) \ |
| 2103 |
V(fdiv, FPDiv, true) \ |
| 2104 |
V(fmax, FPMax, false) \ |
| 2105 |
V(fmin, FPMin, false) \ |
| 2106 |
V(fmaxnm, FPMaxNM, false) \ |
| 2107 |
V(fminnm, FPMinNM, false) |
| 2108 |
|
| 2109 |
#define DECLARE_NEON_FP_VECTOR_OP(FN, OP, PROCNAN) \ |
| 2110 |
template <typename T> \ |
| 2111 |
LogicVRegister FN(VectorFormat vform, \ |
| 2112 |
LogicVRegister dst, \ |
| 2113 |
const LogicVRegister& src1, \ |
| 2114 |
const LogicVRegister& src2); \ |
| 2115 |
LogicVRegister FN(VectorFormat vform, \ |
| 2116 |
LogicVRegister dst, \ |
| 2117 |
const LogicVRegister& src1, \ |
| 2118 |
const LogicVRegister& src2); |
| 2119 |
NEON_FP3SAME_LIST(DECLARE_NEON_FP_VECTOR_OP) |
| 2120 |
#undef DECLARE_NEON_FP_VECTOR_OP |
| 2121 |
|
| 2122 |
#define NEON_FPPAIRWISE_LIST(V) \ |
| 2123 |
V(faddp, fadd, FPAdd) \ |
| 2124 |
V(fmaxp, fmax, FPMax) \ |
| 2125 |
V(fmaxnmp, fmaxnm, FPMaxNM) \ |
| 2126 |
V(fminp, fmin, FPMin) \ |
| 2127 |
V(fminnmp, fminnm, FPMinNM) |
| 2128 |
|
| 2129 |
#define DECLARE_NEON_FP_PAIR_OP(FNP, FN, OP) \ |
| 2130 |
LogicVRegister FNP(VectorFormat vform, \ |
| 2131 |
LogicVRegister dst, \ |
| 2132 |
const LogicVRegister& src1, \ |
| 2133 |
const LogicVRegister& src2); \ |
| 2134 |
LogicVRegister FNP(VectorFormat vform, \ |
| 2135 |
LogicVRegister dst, \ |
| 2136 |
const LogicVRegister& src); |
| 2137 |
NEON_FPPAIRWISE_LIST(DECLARE_NEON_FP_PAIR_OP) |
| 2138 |
#undef DECLARE_NEON_FP_PAIR_OP |
| 2139 |
|
| 2140 |
template <typename T> |
| 2141 |
LogicVRegister frecps(VectorFormat vform, |
| 2142 |
LogicVRegister dst, |
| 2143 |
const LogicVRegister& src1, |
| 2144 |
const LogicVRegister& src2); |
| 2145 |
LogicVRegister frecps(VectorFormat vform, |
| 2146 |
LogicVRegister dst, |
| 2147 |
const LogicVRegister& src1, |
| 2148 |
const LogicVRegister& src2); |
| 2149 |
template <typename T> |
| 2150 |
LogicVRegister frsqrts(VectorFormat vform, |
| 2151 |
LogicVRegister dst, |
| 2152 |
const LogicVRegister& src1, |
| 2153 |
const LogicVRegister& src2); |
| 2154 |
LogicVRegister frsqrts(VectorFormat vform, |
| 2155 |
LogicVRegister dst, |
| 2156 |
const LogicVRegister& src1, |
| 2157 |
const LogicVRegister& src2); |
| 2158 |
template <typename T> |
| 2159 |
LogicVRegister fmla(VectorFormat vform, |
| 2160 |
LogicVRegister dst, |
| 2161 |
const LogicVRegister& src1, |
| 2162 |
const LogicVRegister& src2); |
| 2163 |
LogicVRegister fmla(VectorFormat vform, |
| 2164 |
LogicVRegister dst, |
| 2165 |
const LogicVRegister& src1, |
| 2166 |
const LogicVRegister& src2); |
| 2167 |
template <typename T> |
| 2168 |
LogicVRegister fmls(VectorFormat vform, |
| 2169 |
LogicVRegister dst, |
| 2170 |
const LogicVRegister& src1, |
| 2171 |
const LogicVRegister& src2); |
| 2172 |
LogicVRegister fmls(VectorFormat vform, |
| 2173 |
LogicVRegister dst, |
| 2174 |
const LogicVRegister& src1, |
| 2175 |
const LogicVRegister& src2); |
| 2176 |
LogicVRegister fnmul(VectorFormat vform, |
| 2177 |
LogicVRegister dst, |
| 2178 |
const LogicVRegister& src1, |
| 2179 |
const LogicVRegister& src2); |
| 2180 |
|
| 2181 |
template <typename T> |
| 2182 |
LogicVRegister fcmp(VectorFormat vform, |
| 2183 |
LogicVRegister dst, |
| 2184 |
const LogicVRegister& src1, |
| 2185 |
const LogicVRegister& src2, |
| 2186 |
Condition cond); |
| 2187 |
LogicVRegister fcmp(VectorFormat vform, |
| 2188 |
LogicVRegister dst, |
| 2189 |
const LogicVRegister& src1, |
| 2190 |
const LogicVRegister& src2, |
| 2191 |
Condition cond); |
| 2192 |
LogicVRegister fabscmp(VectorFormat vform, |
| 2193 |
LogicVRegister dst, |
| 2194 |
const LogicVRegister& src1, |
| 2195 |
const LogicVRegister& src2, |
| 2196 |
Condition cond); |
| 2197 |
LogicVRegister fcmp_zero(VectorFormat vform, |
| 2198 |
LogicVRegister dst, |
| 2199 |
const LogicVRegister& src, |
| 2200 |
Condition cond); |
| 2201 |
|
| 2202 |
template <typename T> |
| 2203 |
LogicVRegister fneg(VectorFormat vform, |
| 2204 |
LogicVRegister dst, |
| 2205 |
const LogicVRegister& src); |
| 2206 |
LogicVRegister fneg(VectorFormat vform, |
| 2207 |
LogicVRegister dst, |
| 2208 |
const LogicVRegister& src); |
| 2209 |
template <typename T> |
| 2210 |
LogicVRegister frecpx(VectorFormat vform, |
| 2211 |
LogicVRegister dst, |
| 2212 |
const LogicVRegister& src); |
| 2213 |
LogicVRegister frecpx(VectorFormat vform, |
| 2214 |
LogicVRegister dst, |
| 2215 |
const LogicVRegister& src); |
| 2216 |
template <typename T> |
| 2217 |
LogicVRegister fabs_(VectorFormat vform, |
| 2218 |
LogicVRegister dst, |
| 2219 |
const LogicVRegister& src); |
| 2220 |
LogicVRegister fabs_(VectorFormat vform, |
| 2221 |
LogicVRegister dst, |
| 2222 |
const LogicVRegister& src); |
| 2223 |
LogicVRegister fabd(VectorFormat vform, |
| 2224 |
LogicVRegister dst, |
| 2225 |
const LogicVRegister& src1, |
| 2226 |
const LogicVRegister& src2); |
| 2227 |
LogicVRegister frint(VectorFormat vform, |
| 2228 |
LogicVRegister dst, |
| 2229 |
const LogicVRegister& src, |
| 2230 |
FPRounding rounding_mode, |
| 2231 |
bool inexact_exception = false); |
| 2232 |
LogicVRegister fcvts(VectorFormat vform, |
| 2233 |
LogicVRegister dst, |
| 2234 |
const LogicVRegister& src, |
| 2235 |
FPRounding rounding_mode, |
| 2236 |
int fbits = 0); |
| 2237 |
LogicVRegister fcvtu(VectorFormat vform, |
| 2238 |
LogicVRegister dst, |
| 2239 |
const LogicVRegister& src, |
| 2240 |
FPRounding rounding_mode, |
| 2241 |
int fbits = 0); |
| 2242 |
LogicVRegister fcvtl(VectorFormat vform, |
| 2243 |
LogicVRegister dst, |
| 2244 |
const LogicVRegister& src); |
| 2245 |
LogicVRegister fcvtl2(VectorFormat vform, |
| 2246 |
LogicVRegister dst, |
| 2247 |
const LogicVRegister& src); |
| 2248 |
LogicVRegister fcvtn(VectorFormat vform, |
| 2249 |
LogicVRegister dst, |
| 2250 |
const LogicVRegister& src); |
| 2251 |
LogicVRegister fcvtn2(VectorFormat vform, |
| 2252 |
LogicVRegister dst, |
| 2253 |
const LogicVRegister& src); |
| 2254 |
LogicVRegister fcvtxn(VectorFormat vform, |
| 2255 |
LogicVRegister dst, |
| 2256 |
const LogicVRegister& src); |
| 2257 |
LogicVRegister fcvtxn2(VectorFormat vform, |
| 2258 |
LogicVRegister dst, |
| 2259 |
const LogicVRegister& src); |
| 2260 |
LogicVRegister fsqrt(VectorFormat vform, |
| 2261 |
LogicVRegister dst, |
| 2262 |
const LogicVRegister& src); |
| 2263 |
LogicVRegister frsqrte(VectorFormat vform, |
| 2264 |
LogicVRegister dst, |
| 2265 |
const LogicVRegister& src); |
| 2266 |
LogicVRegister frecpe(VectorFormat vform, |
| 2267 |
LogicVRegister dst, |
| 2268 |
const LogicVRegister& src, |
| 2269 |
FPRounding rounding); |
| 2270 |
LogicVRegister ursqrte(VectorFormat vform, |
| 2271 |
LogicVRegister dst, |
| 2272 |
const LogicVRegister& src); |
| 2273 |
LogicVRegister urecpe(VectorFormat vform, |
| 2274 |
LogicVRegister dst, |
| 2275 |
const LogicVRegister& src); |
| 2276 |
|
| 2277 |
typedef float (Simulator::*FPMinMaxOp)(float a, float b); |
| 2278 |
|
| 2279 |
LogicVRegister fminmaxv(VectorFormat vform, |
| 2280 |
LogicVRegister dst, |
| 2281 |
const LogicVRegister& src, |
| 2282 |
FPMinMaxOp Op); |
| 2283 |
|
| 2284 |
LogicVRegister fminv(VectorFormat vform, |
| 2285 |
LogicVRegister dst, |
| 2286 |
const LogicVRegister& src); |
| 2287 |
LogicVRegister fmaxv(VectorFormat vform, |
| 2288 |
LogicVRegister dst, |
| 2289 |
const LogicVRegister& src); |
| 2290 |
LogicVRegister fminnmv(VectorFormat vform, |
| 2291 |
LogicVRegister dst, |
| 2292 |
const LogicVRegister& src); |
| 2293 |
LogicVRegister fmaxnmv(VectorFormat vform, |
| 2294 |
LogicVRegister dst, |
| 2295 |
const LogicVRegister& src); |
| 2296 |
|
| 2297 |
static const uint32_t CRC32_POLY = 0x04C11DB7; |
| 2298 |
static const uint32_t CRC32C_POLY = 0x1EDC6F41; |
| 2299 |
uint32_t Poly32Mod2(unsigned n, uint64_t data, uint32_t poly); |
| 2300 |
template <typename T> |
| 2301 |
uint32_t Crc32Checksum(uint32_t acc, T val, uint32_t poly); |
| 2302 |
uint32_t Crc32Checksum(uint32_t acc, uint64_t val, uint32_t poly); |
| 2303 |
|
| 2304 |
void SysOp_W(int op, int64_t val); |
| 2305 |
|
| 2306 |
template <typename T> |
| 2307 |
T FPRecipSqrtEstimate(T op); |
| 2308 |
template <typename T> |
| 2309 |
T FPRecipEstimate(T op, FPRounding rounding); |
| 2310 |
template <typename T, typename R> |
| 2311 |
R FPToFixed(T op, int fbits, bool is_signed, FPRounding rounding); |
| 2312 |
|
| 2313 |
void FPCompare(double val0, double val1, FPTrapFlags trap); |
| 2314 |
double FPRoundInt(double value, FPRounding round_mode); |
| 2315 |
double recip_sqrt_estimate(double a); |
| 2316 |
double recip_estimate(double a); |
| 2317 |
double FPRecipSqrtEstimate(double a); |
| 2318 |
double FPRecipEstimate(double a); |
| 2319 |
double FixedToDouble(int64_t src, int fbits, FPRounding round_mode); |
| 2320 |
double UFixedToDouble(uint64_t src, int fbits, FPRounding round_mode); |
| 2321 |
float FixedToFloat(int64_t src, int fbits, FPRounding round_mode); |
| 2322 |
float UFixedToFloat(uint64_t src, int fbits, FPRounding round_mode); |
| 2323 |
int32_t FPToInt32(double value, FPRounding rmode); |
| 2324 |
int64_t FPToInt64(double value, FPRounding rmode); |
| 2325 |
uint32_t FPToUInt32(double value, FPRounding rmode); |
| 2326 |
uint64_t FPToUInt64(double value, FPRounding rmode); |
| 2327 |
int32_t FPToFixedJS(double value); |
| 2328 |
|
| 2329 |
template <typename T> |
| 2330 |
T FPAdd(T op1, T op2); |
| 2331 |
|
| 2332 |
template <typename T> |
| 2333 |
T FPDiv(T op1, T op2); |
| 2334 |
|
| 2335 |
template <typename T> |
| 2336 |
T FPMax(T a, T b); |
| 2337 |
|
| 2338 |
template <typename T> |
| 2339 |
T FPMaxNM(T a, T b); |
| 2340 |
|
| 2341 |
template <typename T> |
| 2342 |
T FPMin(T a, T b); |
| 2343 |
|
| 2344 |
template <typename T> |
| 2345 |
T FPMinNM(T a, T b); |
| 2346 |
|
| 2347 |
template <typename T> |
| 2348 |
T FPMul(T op1, T op2); |
| 2349 |
|
| 2350 |
template <typename T> |
| 2351 |
T FPMulx(T op1, T op2); |
| 2352 |
|
| 2353 |
template <typename T> |
| 2354 |
T FPMulAdd(T a, T op1, T op2); |
| 2355 |
|
| 2356 |
template <typename T> |
| 2357 |
T FPSqrt(T op); |
| 2358 |
|
| 2359 |
template <typename T> |
| 2360 |
T FPSub(T op1, T op2); |
| 2361 |
|
| 2362 |
template <typename T> |
| 2363 |
T FPRecipStepFused(T op1, T op2); |
| 2364 |
|
| 2365 |
template <typename T> |
| 2366 |
T FPRSqrtStepFused(T op1, T op2); |
| 2367 |
|
| 2368 |
// This doesn't do anything at the moment. We'll need it if we want support |
| 2369 |
// for cumulative exception bits or floating-point exceptions. |
| 2370 |
void FPProcessException() { } |
| 2371 |
|
| 2372 |
bool FPProcessNaNs(const Instruction* instr); |
| 2373 |
|
| 2374 |
// Pseudo Printf instruction |
| 2375 |
void DoPrintf(const Instruction* instr); |
| 2376 |
|
| 2377 |
// Processor state --------------------------------------- |
| 2378 |
|
| 2379 |
// Simulated monitors for exclusive access instructions. |
| 2380 |
SimExclusiveLocalMonitor local_monitor_; |
| 2381 |
SimExclusiveGlobalMonitor global_monitor_; |
| 2382 |
|
| 2383 |
// Output stream. |
| 2384 |
FILE* stream_; |
| 2385 |
PrintDisassembler* print_disasm_; |
| 2386 |
|
| 2387 |
// Instruction statistics instrumentation. |
| 2388 |
Instrument* instrumentation_; |
| 2389 |
|
| 2390 |
// General purpose registers. Register 31 is the stack pointer. |
| 2391 |
SimRegister registers_[kNumberOfRegisters]; |
| 2392 |
|
| 2393 |
// Vector registers |
| 2394 |
SimVRegister vregisters_[kNumberOfVRegisters]; |
| 2395 |
|
| 2396 |
// Program Status Register. |
| 2397 |
// bits[31, 27]: Condition flags N, Z, C, and V. |
| 2398 |
// (Negative, Zero, Carry, Overflow) |
| 2399 |
SimSystemRegister nzcv_; |
| 2400 |
|
| 2401 |
// Floating-Point Control Register |
| 2402 |
SimSystemRegister fpcr_; |
| 2403 |
|
| 2404 |
// Only a subset of FPCR features are supported by the simulator. This helper |
| 2405 |
// checks that the FPCR settings are supported. |
| 2406 |
// |
| 2407 |
// This is checked when floating-point instructions are executed, not when |
| 2408 |
// FPCR is set. This allows generated code to modify FPCR for external |
| 2409 |
// functions, or to save and restore it when entering and leaving generated |
| 2410 |
// code. |
| 2411 |
void AssertSupportedFPCR() { |
| 2412 |
VIXL_ASSERT(fpcr().FZ() == 0); // No flush-to-zero support. |
| 2413 |
VIXL_ASSERT(fpcr().RMode() == FPTieEven); // Ties-to-even rounding only. |
| 2414 |
|
| 2415 |
// The simulator does not support half-precision operations so fpcr().AHP() |
| 2416 |
// is irrelevant, and is not checked here. |
| 2417 |
} |
| 2418 |
|
| 2419 |
static int CalcNFlag(uint64_t result, unsigned reg_size) { |
| 2420 |
return (result >> (reg_size - 1)) & 1; |
| 2421 |
} |
| 2422 |
|
| 2423 |
static int CalcZFlag(uint64_t result) { |
| 2424 |
return (result == 0) ? 1 : 0; |
| 2425 |
} |
| 2426 |
|
| 2427 |
static const uint32_t kConditionFlagsMask = 0xf0000000; |
| 2428 |
|
| 2429 |
// Stack |
| 2430 |
byte* stack_; |
| 2431 |
static const int stack_protection_size_ = 512 * KBytes; |
| 2432 |
static const int stack_size_ = (2 * MBytes) + (2 * stack_protection_size_); |
| 2433 |
byte* stack_limit_; |
| 2434 |
|
| 2435 |
Decoder* decoder_; |
| 2436 |
// Indicates if the pc has been modified by the instruction and should not be |
| 2437 |
// automatically incremented. |
| 2438 |
bool pc_modified_; |
| 2439 |
const Instruction* pc_; |
| 2440 |
|
| 2441 |
static const char* xreg_names[]; |
| 2442 |
static const char* wreg_names[]; |
| 2443 |
static const char* sreg_names[]; |
| 2444 |
static const char* dreg_names[]; |
| 2445 |
static const char* vreg_names[]; |
| 2446 |
|
| 2447 |
static const Instruction* kEndOfSimAddress; |
| 2448 |
|
| 2449 |
private: |
| 2450 |
template <typename T> |
| 2451 |
static T FPDefaultNaN(); |
| 2452 |
|
| 2453 |
// Standard NaN processing. |
| 2454 |
template <typename T> |
| 2455 |
T FPProcessNaN(T op) { |
| 2456 |
VIXL_ASSERT(std::isnan(op)); |
| 2457 |
if (IsSignallingNaN(op)) { |
| 2458 |
FPProcessException(); |
| 2459 |
} |
| 2460 |
return DN() ? FPDefaultNaN<T>() : ToQuietNaN(op); |
| 2461 |
} |
| 2462 |
|
| 2463 |
template <typename T> |
| 2464 |
T FPProcessNaNs(T op1, T op2) { |
| 2465 |
if (IsSignallingNaN(op1)) { |
| 2466 |
return FPProcessNaN(op1); |
| 2467 |
} else if (IsSignallingNaN(op2)) { |
| 2468 |
return FPProcessNaN(op2); |
| 2469 |
} else if (std::isnan(op1)) { |
| 2470 |
VIXL_ASSERT(IsQuietNaN(op1)); |
| 2471 |
return FPProcessNaN(op1); |
| 2472 |
} else if (std::isnan(op2)) { |
| 2473 |
VIXL_ASSERT(IsQuietNaN(op2)); |
| 2474 |
return FPProcessNaN(op2); |
| 2475 |
} else { |
| 2476 |
return 0.0; |
| 2477 |
} |
| 2478 |
} |
| 2479 |
|
| 2480 |
template <typename T> |
| 2481 |
T FPProcessNaNs3(T op1, T op2, T op3) { |
| 2482 |
if (IsSignallingNaN(op1)) { |
| 2483 |
return FPProcessNaN(op1); |
| 2484 |
} else if (IsSignallingNaN(op2)) { |
| 2485 |
return FPProcessNaN(op2); |
| 2486 |
} else if (IsSignallingNaN(op3)) { |
| 2487 |
return FPProcessNaN(op3); |
| 2488 |
} else if (std::isnan(op1)) { |
| 2489 |
VIXL_ASSERT(IsQuietNaN(op1)); |
| 2490 |
return FPProcessNaN(op1); |
| 2491 |
} else if (std::isnan(op2)) { |
| 2492 |
VIXL_ASSERT(IsQuietNaN(op2)); |
| 2493 |
return FPProcessNaN(op2); |
| 2494 |
} else if (std::isnan(op3)) { |
| 2495 |
VIXL_ASSERT(IsQuietNaN(op3)); |
| 2496 |
return FPProcessNaN(op3); |
| 2497 |
} else { |
| 2498 |
return 0.0; |
| 2499 |
} |
| 2500 |
} |
| 2501 |
|
| 2502 |
bool coloured_trace_; |
| 2503 |
|
| 2504 |
// A set of TraceParameters flags. |
| 2505 |
int trace_parameters_; |
| 2506 |
|
| 2507 |
// Indicates whether the instruction instrumentation is active. |
| 2508 |
bool instruction_stats_; |
| 2509 |
|
| 2510 |
// Indicates whether the exclusive-access warning has been printed. |
| 2511 |
bool print_exclusive_access_warning_; |
| 2512 |
void PrintExclusiveAccessWarning(); |
| 2513 |
|
| 2514 |
// Indicates that the simulator ran out of memory at some point. |
| 2515 |
// Data structures may not be fully allocated. |
| 2516 |
bool oom_; |
| 2517 |
|
| 2518 |
// Single-stepping support |
| 2519 |
bool single_stepping_; |
| 2520 |
SingleStepCallback single_step_callback_; |
| 2521 |
void* single_step_callback_arg_; |
| 2522 |
|
| 2523 |
public: |
| 2524 |
// True if the simulator ran out of memory during or after construction. |
| 2525 |
bool oom() const { return oom_; } |
| 2526 |
|
| 2527 |
protected: |
| 2528 |
mozilla::Vector<int64_t, 0, js::SystemAllocPolicy> spStack_; |
| 2529 |
}; |
| 2530 |
|
| 2531 |
} // namespace vixl |
| 2532 |
|
| 2533 |
namespace js { |
| 2534 |
namespace jit { |
| 2535 |
|
| 2536 |
class SimulatorProcess |
| 2537 |
{ |
| 2538 |
public: |
| 2539 |
static SimulatorProcess* singleton_; |
| 2540 |
|
| 2541 |
SimulatorProcess() |
| 2542 |
: lock_(mutexid::Arm64SimulatorLock) |
| 2543 |
, redirection_(nullptr) |
| 2544 |
{} |
| 2545 |
|
| 2546 |
// Synchronizes access between main thread and compilation threads. |
| 2547 |
js::Mutex lock_ MOZ_UNANNOTATED; |
| 2548 |
vixl::Redirection* redirection_; |
| 2549 |
|
| 2550 |
#ifdef JS_CACHE_SIMULATOR_ARM64 |
| 2551 |
// For each simulator, record what other thread registered as instruction |
| 2552 |
// being invalidated. |
| 2553 |
struct ICacheFlush { |
| 2554 |
void* start; |
| 2555 |
size_t length; |
| 2556 |
}; |
| 2557 |
using ICacheFlushes = mozilla::Vector<ICacheFlush, 2>; |
| 2558 |
struct SimFlushes { |
| 2559 |
vixl::Simulator* thread; |
| 2560 |
ICacheFlushes records; |
| 2561 |
}; |
| 2562 |
mozilla::Vector<SimFlushes, 1> pendingFlushes_; |
| 2563 |
|
| 2564 |
static void recordICacheFlush(void* start, size_t length); |
| 2565 |
static void membarrier(); |
| 2566 |
static ICacheFlushes& getICacheFlushes(vixl::Simulator* sim); |
| 2567 |
[[nodiscard]] static bool registerSimulator(vixl::Simulator* sim); |
| 2568 |
static void unregisterSimulator(vixl::Simulator* sim); |
| 2569 |
#endif |
| 2570 |
|
| 2571 |
static void setRedirection(vixl::Redirection* redirection) { |
| 2572 |
singleton_->lock_.assertOwnedByCurrentThread(); |
| 2573 |
singleton_->redirection_ = redirection; |
| 2574 |
} |
| 2575 |
|
| 2576 |
static vixl::Redirection* redirection() { |
| 2577 |
singleton_->lock_.assertOwnedByCurrentThread(); |
| 2578 |
return singleton_->redirection_; |
| 2579 |
} |
| 2580 |
|
| 2581 |
static bool initialize() { |
| 2582 |
singleton_ = js_new<SimulatorProcess>(); |
| 2583 |
return !!singleton_; |
| 2584 |
} |
| 2585 |
static void destroy() { |
| 2586 |
js_delete(singleton_); |
| 2587 |
singleton_ = nullptr; |
| 2588 |
} |
| 2589 |
}; |
| 2590 |
|
| 2591 |
// Protects the icache and redirection properties of the simulator. |
| 2592 |
class AutoLockSimulatorCache : public js::LockGuard<js::Mutex> |
| 2593 |
{ |
| 2594 |
using Base = js::LockGuard<js::Mutex>; |
| 2595 |
|
| 2596 |
public: |
| 2597 |
explicit AutoLockSimulatorCache() |
| 2598 |
: Base(SimulatorProcess::singleton_->lock_) |
| 2599 |
{ |
| 2600 |
} |
| 2601 |
}; |
| 2602 |
|
| 2603 |
} // namespace jit |
| 2604 |
} // namespace js |
| 2605 |
|
| 2606 |
#endif // JS_SIMULATOR_ARM64 |
| 2607 |
#endif // VIXL_A64_SIMULATOR_A64_H_ |