5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ 6 #define V8_ARM64_SIMULATOR_ARM64_H_ 11 #include "src/allocation.h" 12 #include "src/arm64/assembler-arm64.h" 13 #include "src/arm64/decoder-arm64.h" 14 #include "src/arm64/disasm-arm64.h" 15 #include "src/arm64/instrument-arm64.h" 16 #include "src/assembler.h" 17 #include "src/base/compiler-specific.h" 18 #include "src/globals.h" 19 #include "src/simulator-base.h" 20 #include "src/utils.h" 25 #if defined(USE_SIMULATOR) 42 template <
class T,
int ebits,
int mbits>
44 FPRounding round_mode) {
45 static_assert((
sizeof(T) * 8) >= (1 + ebits + mbits),
46 "destination type T not large enough");
47 static_assert(
sizeof(T) <=
sizeof(uint64_t),
48 "maximum size of destination type T is 64 bits");
49 static_assert(std::is_unsigned<T>::value,
50 "destination type T must be unsigned");
52 DCHECK((sign == 0) || (sign == 1));
55 DCHECK((round_mode == FPTieEven) || (round_mode == FPRoundOdd));
108 const int mantissa_offset = 0;
109 const int exponent_offset = mantissa_offset + mbits;
110 const int sign_offset = exponent_offset + ebits;
111 DCHECK_EQ(sign_offset, static_cast<int>(
sizeof(T) * 8 - 1));
115 return static_cast<T
>(sign << sign_offset);
120 const int infinite_exponent = (1 << ebits) - 1;
121 const int max_normal_exponent = infinite_exponent - 1;
125 exponent += max_normal_exponent >> 1;
127 if (exponent > max_normal_exponent) {
129 if (round_mode == FPTieEven) {
131 exponent = infinite_exponent;
134 DCHECK_EQ(round_mode, FPRoundOdd);
137 exponent = max_normal_exponent;
138 mantissa = (UINT64_C(1) << exponent_offset) - 1;
140 return static_cast<T
>((sign << sign_offset) |
141 (exponent << exponent_offset) |
142 (mantissa << mantissa_offset));
147 const int highest_significant_bit = 63 - CountLeadingZeros(mantissa, 64);
148 int shift = highest_significant_bit - mbits;
155 shift += -exponent + 1;
162 if (shift > (highest_significant_bit + 1)) {
163 if (round_mode == FPTieEven) {
165 return static_cast<T
>(sign << sign_offset);
167 DCHECK_EQ(round_mode, FPRoundOdd);
168 DCHECK_NE(mantissa, 0U);
171 return static_cast<T
>((sign << sign_offset) | 1);
180 mantissa &= ~(UINT64_C(1) << highest_significant_bit);
184 if (round_mode == FPTieEven) {
187 uint64_t onebit_mantissa = (mantissa >> (shift)) & 1;
188 uint64_t halfbit_mantissa = (mantissa >> (shift - 1)) & 1;
189 uint64_t adjustment = (halfbit_mantissa & ~onebit_mantissa);
190 uint64_t adjusted = mantissa - adjustment;
191 T halfbit_adjusted = (adjusted >> (shift - 1)) & 1;
194 static_cast<T
>((sign << sign_offset) | (exponent << exponent_offset) |
195 ((mantissa >> shift) << mantissa_offset));
205 return result + halfbit_adjusted;
207 DCHECK_EQ(round_mode, FPRoundOdd);
210 uint64_t fractional_bits = mantissa & ((UINT64_C(1) << shift) - 1);
211 if (fractional_bits != 0) {
212 mantissa |= UINT64_C(1) << shift;
215 return static_cast<T
>((sign << sign_offset) |
216 (exponent << exponent_offset) |
217 ((mantissa >> shift) << mantissa_offset));
223 return static_cast<T
>((sign << sign_offset) |
224 (exponent << exponent_offset) |
225 ((mantissa << -shift) << mantissa_offset));
236 template <
typename T>
237 static T AddressUntag(T address) {
240 uint64_t bits = (uint64_t)address;
241 return (T)(bits & ~kAddressTagMask);
244 template <
typename T,
typename A>
245 static T Read(A address) {
247 address = AddressUntag(address);
248 DCHECK((
sizeof(value) == 1) || (
sizeof(value) == 2) ||
249 (
sizeof(value) == 4) || (
sizeof(value) == 8) ||
250 (
sizeof(value) == 16));
251 memcpy(&value, reinterpret_cast<const char*>(address),
sizeof(value));
255 template <
typename T,
typename A>
256 static void Write(A address, T value) {
257 address = AddressUntag(address);
258 DCHECK((
sizeof(value) == 1) || (
sizeof(value) == 2) ||
259 (
sizeof(value) == 4) || (
sizeof(value) == 8) ||
260 (
sizeof(value) == 16));
261 memcpy(reinterpret_cast<char*>(address), &value,
sizeof(value));
268 class SimSystemRegister {
272 SimSystemRegister() : value_(0), write_ignore_mask_(0xffffffff) { }
278 void SetRawValue(
uint32_t new_value) {
279 value_ = (value_ & write_ignore_mask_) | (new_value & ~write_ignore_mask_);
282 uint32_t Bits(
int msb,
int lsb)
const {
283 return unsigned_bitextract_32(msb, lsb, value_);
286 int32_t SignedBits(
int msb,
int lsb)
const {
287 return signed_bitextract_32(msb, lsb, value_);
290 void SetBits(
int msb,
int lsb,
uint32_t bits);
293 static SimSystemRegister DefaultValueFor(SystemRegister
id);
295 #define DEFINE_GETTER(Name, HighBit, LowBit, Func, Type) \ 296 Type Name() const { return static_cast<Type>(Func(HighBit, LowBit)); } \ 297 void Set##Name(Type bits) { \ 298 SetBits(HighBit, LowBit, static_cast<Type>(bits)); \ 300 #define DEFINE_WRITE_IGNORE_MASK(Name, Mask) \ 301 static const uint32_t Name##WriteIgnoreMask = ~static_cast<uint32_t>(Mask); 302 SYSTEM_REGISTER_FIELDS_LIST(DEFINE_GETTER, DEFINE_WRITE_IGNORE_MASK)
303 #undef DEFINE_ZERO_BITS 311 : value_(value), write_ignore_mask_(write_ignore_mask) { }
319 template <
int kSizeInBytes>
320 class SimRegisterBase {
323 void Set(T new_value) {
324 static_assert(
sizeof(new_value) <= kSizeInBytes,
325 "Size of new_value must be <= size of template type.");
326 if (
sizeof(new_value) < kSizeInBytes) {
328 memset(value_ +
sizeof(new_value), 0, kSizeInBytes -
sizeof(new_value));
330 memcpy(&value_, &new_value,
sizeof(T));
331 NotifyRegisterWrite();
338 template <
typename T>
339 void Insert(
int lane, T new_value) {
341 DCHECK_LE(
sizeof(new_value) + (lane *
sizeof(new_value)),
342 static_cast<unsigned>(kSizeInBytes));
343 memcpy(&value_[lane *
sizeof(new_value)], &new_value,
sizeof(new_value));
344 NotifyRegisterWrite();
347 template <
typename T>
348 T Get(
int lane = 0)
const {
351 DCHECK_LE(
sizeof(result) + (lane *
sizeof(result)),
352 static_cast<unsigned>(kSizeInBytes));
353 memcpy(&result, &value_[lane *
sizeof(result)],
sizeof(result));
360 bool WrittenSinceLastLog()
const {
return written_since_last_log_; }
362 void NotifyRegisterLogged() { written_since_last_log_ =
false; }
365 uint8_t value_[kSizeInBytes];
368 bool written_since_last_log_;
370 void NotifyRegisterWrite() { written_since_last_log_ =
true; }
373 typedef SimRegisterBase<kXRegSize> SimRegister;
374 typedef SimRegisterBase<kQRegSize> SimVRegister;
378 class LogicVRegister {
380 inline LogicVRegister(SimVRegister& other)
382 for (
unsigned i = 0;
i < arraysize(saturated_);
i++) {
383 saturated_[
i] = kNotSaturated;
385 for (
unsigned i = 0;
i < arraysize(round_);
i++) {
390 int64_t Int(VectorFormat vform,
int index)
const {
392 switch (LaneSizeInBitsFromFormat(vform)) {
394 element = register_.Get<int8_t>(index);
397 element = register_.Get<int16_t>(index);
400 element = register_.Get<int32_t>(index);
403 element = register_.Get<
int64_t>(index);
412 uint64_t Uint(VectorFormat vform,
int index)
const {
414 switch (LaneSizeInBitsFromFormat(vform)) {
416 element = register_.Get<uint8_t>(index);
419 element = register_.Get<uint16_t>(index);
422 element = register_.Get<
uint32_t>(index);
425 element = register_.Get<uint64_t>(index);
434 uint64_t UintLeftJustified(VectorFormat vform,
int index)
const {
435 return Uint(vform, index) << (64 - LaneSizeInBitsFromFormat(vform));
438 int64_t IntLeftJustified(VectorFormat vform,
int index)
const {
439 uint64_t value = UintLeftJustified(vform, index);
441 memcpy(&result, &value,
sizeof(result));
445 void SetInt(VectorFormat vform,
int index,
int64_t value)
const {
446 switch (LaneSizeInBitsFromFormat(vform)) {
448 register_.Insert(index, static_cast<int8_t>(value));
451 register_.Insert(index, static_cast<int16_t>(value));
454 register_.Insert(index, static_cast<int32_t>(value));
457 register_.Insert(index, static_cast<int64_t>(value));
465 void SetIntArray(VectorFormat vform,
const int64_t* src)
const {
466 ClearForWrite(vform);
467 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
468 SetInt(vform,
i, src[
i]);
472 void SetUint(VectorFormat vform,
int index, uint64_t value)
const {
473 switch (LaneSizeInBitsFromFormat(vform)) {
475 register_.Insert(index, static_cast<uint8_t>(value));
478 register_.Insert(index, static_cast<uint16_t>(value));
481 register_.Insert(index, static_cast<uint32_t>(value));
484 register_.Insert(index, static_cast<uint64_t>(value));
492 void SetUintArray(VectorFormat vform,
const uint64_t* src)
const {
493 ClearForWrite(vform);
494 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
495 SetUint(vform,
i, src[
i]);
499 void ReadUintFromMem(VectorFormat vform,
int index, uint64_t addr)
const;
501 void WriteUintToMem(VectorFormat vform,
int index, uint64_t addr)
const;
503 template <
typename T>
504 T Float(
int index)
const {
505 return register_.Get<T>(index);
508 template <
typename T>
509 void SetFloat(
int index, T value)
const {
510 register_.Insert(index, value);
515 void ClearForWrite(VectorFormat vform)
const {
516 unsigned size = RegisterSizeInBytesFromFormat(vform);
517 for (
unsigned i = size;
i < kQRegSize;
i++) {
518 SetUint(kFormat16B,
i, 0);
525 kSignedSatPositive = 1 << 0,
526 kSignedSatNegative = 1 << 1,
527 kSignedSatMask = kSignedSatPositive | kSignedSatNegative,
528 kSignedSatUndefined = kSignedSatMask,
529 kUnsignedSatPositive = 1 << 2,
530 kUnsignedSatNegative = 1 << 3,
531 kUnsignedSatMask = kUnsignedSatPositive | kUnsignedSatNegative,
532 kUnsignedSatUndefined = kUnsignedSatMask
536 Saturation GetSignedSaturation(
int index) {
537 return static_cast<Saturation
>(saturated_[index] & kSignedSatMask);
540 Saturation GetUnsignedSaturation(
int index) {
541 return static_cast<Saturation
>(saturated_[index] & kUnsignedSatMask);
545 void ClearSat(
int index) { saturated_[index] = kNotSaturated; }
547 void SetSignedSat(
int index,
bool positive) {
548 SetSatFlag(index, positive ? kSignedSatPositive : kSignedSatNegative);
551 void SetUnsignedSat(
int index,
bool positive) {
552 SetSatFlag(index, positive ? kUnsignedSatPositive : kUnsignedSatNegative);
555 void SetSatFlag(
int index, Saturation sat) {
556 saturated_[index] =
static_cast<Saturation
>(saturated_[index] | sat);
557 DCHECK_NE(sat & kUnsignedSatMask, kUnsignedSatUndefined);
558 DCHECK_NE(sat & kSignedSatMask, kSignedSatUndefined);
562 LogicVRegister& SignedSaturate(VectorFormat vform) {
563 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
564 Saturation sat = GetSignedSaturation(
i);
565 if (sat == kSignedSatPositive) {
566 SetInt(vform,
i, MaxIntFromFormat(vform));
567 }
else if (sat == kSignedSatNegative) {
568 SetInt(vform,
i, MinIntFromFormat(vform));
574 LogicVRegister& UnsignedSaturate(VectorFormat vform) {
575 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
576 Saturation sat = GetUnsignedSaturation(
i);
577 if (sat == kUnsignedSatPositive) {
578 SetUint(vform,
i, MaxUintFromFormat(vform));
579 }
else if (sat == kUnsignedSatNegative) {
580 SetUint(vform,
i, 0);
587 bool GetRounding(
int index) {
return round_[index]; }
590 void SetRounding(
int index,
bool round) { round_[index] = round; }
593 LogicVRegister& Round(VectorFormat vform) {
594 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
595 SetUint(vform,
i, Uint(vform,
i) + (GetRounding(
i) ? 1 : 0));
602 LogicVRegister& Uhalve(VectorFormat vform) {
603 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
604 uint64_t val = Uint(vform,
i);
605 SetRounding(
i, (val & 1) == 1);
607 if (GetUnsignedSaturation(
i) != kNotSaturated) {
610 val |= (MaxUintFromFormat(vform) >> 1) + 1;
612 SetInt(vform,
i, val);
618 LogicVRegister& Halve(VectorFormat vform) {
619 for (
int i = 0;
i < LaneCountFromFormat(vform);
i++) {
621 SetRounding(
i, (val & 1) == 1);
623 if (GetSignedSaturation(
i) != kNotSaturated) {
626 val ^= (MaxUintFromFormat(vform) >> 1) + 1;
628 SetInt(vform,
i, val);
634 SimVRegister& register_;
638 Saturation saturated_[kQRegSize];
641 bool round_[kQRegSize];
646 class Simulator :
public DecoderVisitor,
public SimulatorBase {
648 static void SetRedirectInstruction(Instruction* instruction);
649 static bool ICacheMatch(
void* one,
void* two) {
return false; }
650 static void FlushICache(base::CustomMatcherHashMap* i_cache,
void* start,
657 explicit Simulator(Decoder<DispatchingDecoderVisitor>* decoder,
658 Isolate* isolate =
nullptr, FILE* stream = stderr);
673 explicit CallArgument(T argument) {
675 DCHECK(
sizeof(argument) <=
sizeof(bits_));
676 memcpy(&bits_, &argument,
sizeof(argument));
680 explicit CallArgument(
double argument) {
681 DCHECK(
sizeof(argument) ==
sizeof(bits_));
682 memcpy(&bits_, &argument,
sizeof(argument));
686 explicit CallArgument(
float argument) {
692 DCHECK(
sizeof(kFP64SignallingNaN) ==
sizeof(bits_));
693 memcpy(&bits_, &kFP64SignallingNaN,
sizeof(kFP64SignallingNaN));
695 DCHECK(
sizeof(argument) <=
sizeof(bits_));
696 memcpy(&bits_, &argument,
sizeof(argument));
702 static CallArgument End() {
return CallArgument(); }
704 int64_t bits()
const {
return bits_; }
705 bool IsEnd()
const {
return type_ == NO_ARG; }
706 bool IsX()
const {
return type_ == X_ARG; }
707 bool IsD()
const {
return type_ == D_ARG; }
710 enum CallArgumentType { X_ARG, D_ARG, NO_ARG };
715 CallArgumentType type_;
717 CallArgument() { type_ = NO_ARG; }
721 template <
typename Return,
typename... Args>
722 Return Call(Address entry, Args... args) {
724 CallArgument call_args[] = {CallArgument(args)..., CallArgument::End()};
725 CallImpl(entry, call_args);
726 return ReadReturn<Return>();
732 bool GetValue(
const char* desc,
int64_t* value);
734 bool PrintValue(
const char* desc);
747 void DoRuntimeCall(Instruction* instr);
750 static const Instruction* kEndOfSimAddress;
751 void DecodeInstruction();
753 void RunFrom(Instruction* start);
756 template <
typename T>
757 void set_pc(T new_pc) {
758 DCHECK(
sizeof(T) ==
sizeof(pc_));
759 memcpy(&pc_, &new_pc,
sizeof(T));
762 Instruction* pc() {
return pc_; }
764 void increment_pc() {
766 pc_ = pc_->following();
769 pc_modified_ =
false;
772 virtual void Decode(Instruction* instr) {
773 decoder_->Decode(instr);
776 void ExecuteInstruction() {
777 DCHECK(IsAligned(reinterpret_cast<uintptr_t>(pc_), kInstrSize));
781 LogAllWrittenRegisters();
786 #define DECLARE(A) void Visit##A(Instruction* instr); 787 VISITOR_LIST(DECLARE)
790 bool IsZeroRegister(
unsigned code, Reg31Mode r31mode)
const {
791 return ((code == 31) && (r31mode == Reg31IsZeroRegister));
799 T reg(
unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister)
const {
800 DCHECK_LT(code, static_cast<unsigned>(kNumberOfRegisters));
801 if (IsZeroRegister(code, r31mode)) {
804 return registers_[code].Get<T>();
808 int32_t wreg(
unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister)
const {
809 return reg<int32_t>(code, r31mode);
812 int64_t xreg(
unsigned code, Reg31Mode r31mode = Reg31IsZeroRegister)
const {
813 return reg<int64_t>(code, r31mode);
816 enum RegLogMode { LogRegWrites, NoRegLog };
821 void set_reg(
unsigned code, T value,
822 Reg31Mode r31mode = Reg31IsZeroRegister) {
823 set_reg_no_log(code, value, r31mode);
824 LogRegister(code, r31mode);
828 void set_wreg(
unsigned code, int32_t value,
829 Reg31Mode r31mode = Reg31IsZeroRegister) {
830 set_reg(code, value, r31mode);
833 void set_xreg(
unsigned code,
int64_t value,
834 Reg31Mode r31mode = Reg31IsZeroRegister) {
835 set_reg(code, value, r31mode);
839 template <
typename T>
840 void set_reg_no_log(
unsigned code, T value,
841 Reg31Mode r31mode = Reg31IsZeroRegister) {
842 DCHECK_LT(code, static_cast<unsigned>(kNumberOfRegisters));
843 if (!IsZeroRegister(code, r31mode)) {
844 registers_[code].Set(value);
848 void set_wreg_no_log(
unsigned code, int32_t value,
849 Reg31Mode r31mode = Reg31IsZeroRegister) {
850 set_reg_no_log(code, value, r31mode);
853 void set_xreg_no_log(
unsigned code,
int64_t value,
854 Reg31Mode r31mode = Reg31IsZeroRegister) {
855 set_reg_no_log(code, value, r31mode);
860 void set_lr(T value) {
861 DCHECK_EQ(
sizeof(T), static_cast<unsigned>(kPointerSize));
862 set_reg(kLinkRegCode, value);
866 void set_sp(T value) {
867 DCHECK_EQ(
sizeof(T), static_cast<unsigned>(kPointerSize));
868 set_reg(31, value, Reg31IsStackPointer);
877 uint8_t val[kQRegSize];
881 template <
typename T>
882 T vreg(
unsigned code)
const {
883 static_assert((
sizeof(T) == kBRegSize) || (
sizeof(T) == kHRegSize) ||
884 (
sizeof(T) == kSRegSize) || (
sizeof(T) == kDRegSize) ||
885 (
sizeof(T) == kQRegSize),
886 "Template type must match size of register.");
887 DCHECK_LT(code, static_cast<unsigned>(kNumberOfVRegisters));
889 return vregisters_[code].Get<T>();
892 inline SimVRegister& vreg(
unsigned code) {
return vregisters_[code]; }
894 int64_t sp() {
return xreg(31, Reg31IsStackPointer); }
896 return xreg(kFramePointerRegCode, Reg31IsStackPointer);
898 Instruction* lr() {
return reg<Instruction*>(kLinkRegCode); }
900 Address get_sp()
const {
return reg<Address>(31, Reg31IsStackPointer); }
903 uint8_t breg(
unsigned code)
const {
return vreg<uint8_t>(code); }
905 float hreg(
unsigned code)
const {
return vreg<uint16_t>(code); }
907 float sreg(
unsigned code)
const {
return vreg<float>(code); }
909 uint32_t sreg_bits(
unsigned code)
const {
return vreg<uint32_t>(code); }
911 double dreg(
unsigned code)
const {
return vreg<double>(code); }
913 uint64_t dreg_bits(
unsigned code)
const {
return vreg<uint64_t>(code); }
915 qreg_t qreg(
unsigned code)
const {
return vreg<qreg_t>(code); }
919 template <
typename T>
920 T vreg(
unsigned size,
unsigned code)
const {
926 raw = vreg<uint32_t>(code);
929 raw = vreg<uint64_t>(code);
935 static_assert(
sizeof(result) <=
sizeof(raw),
936 "Template type must be <= 64 bits.");
938 memcpy(&result, &raw,
sizeof(result));
944 template <
typename T>
945 void set_vreg(
unsigned code, T value, RegLogMode log_mode = LogRegWrites) {
947 (
sizeof(value) == kBRegSize) || (
sizeof(value) == kHRegSize) ||
948 (
sizeof(value) == kSRegSize) || (
sizeof(value) == kDRegSize) ||
949 (
sizeof(value) == kQRegSize),
950 "Template type must match size of register.");
951 DCHECK_LT(code, static_cast<unsigned>(kNumberOfVRegisters));
952 vregisters_[code].Set(value);
954 if (log_mode == LogRegWrites) {
955 LogVRegister(code, GetPrintRegisterFormat(value));
960 void set_breg(
unsigned code, int8_t value,
961 RegLogMode log_mode = LogRegWrites) {
962 set_vreg(code, value, log_mode);
965 void set_hreg(
unsigned code, int16_t value,
966 RegLogMode log_mode = LogRegWrites) {
967 set_vreg(code, value, log_mode);
970 void set_sreg(
unsigned code,
float value,
971 RegLogMode log_mode = LogRegWrites) {
972 set_vreg(code, value, log_mode);
975 void set_sreg_bits(
unsigned code,
uint32_t value,
976 RegLogMode log_mode = LogRegWrites) {
977 set_vreg(code, value, log_mode);
980 void set_dreg(
unsigned code,
double value,
981 RegLogMode log_mode = LogRegWrites) {
982 set_vreg(code, value, log_mode);
985 void set_dreg_bits(
unsigned code, uint64_t value,
986 RegLogMode log_mode = LogRegWrites) {
987 set_vreg(code, value, log_mode);
990 void set_qreg(
unsigned code, qreg_t value,
991 RegLogMode log_mode = LogRegWrites) {
992 set_vreg(code, value, log_mode);
996 template <
typename T>
997 void set_vreg_no_log(
unsigned code, T value) {
998 STATIC_ASSERT((
sizeof(value) == kBRegSize) ||
999 (
sizeof(value) == kHRegSize) ||
1000 (
sizeof(value) == kSRegSize) ||
1001 (
sizeof(value) == kDRegSize) || (
sizeof(value) == kQRegSize));
1002 DCHECK_LT(code, static_cast<unsigned>(kNumberOfVRegisters));
1003 vregisters_[code].Set(value);
1006 void set_breg_no_log(
unsigned code, uint8_t value) {
1007 set_vreg_no_log(code, value);
1010 void set_hreg_no_log(
unsigned code, uint16_t value) {
1011 set_vreg_no_log(code, value);
1014 void set_sreg_no_log(
unsigned code,
float value) {
1015 set_vreg_no_log(code, value);
1018 void set_dreg_no_log(
unsigned code,
double value) {
1019 set_vreg_no_log(code, value);
1022 void set_qreg_no_log(
unsigned code, qreg_t value) {
1023 set_vreg_no_log(code, value);
1026 SimSystemRegister& nzcv() {
return nzcv_; }
1027 SimSystemRegister& fpcr() {
return fpcr_; }
1028 FPRounding RMode() {
return static_cast<FPRounding
>(fpcr_.RMode()); }
1029 bool DN() {
return fpcr_.DN() != 0; }
1035 Instruction* location;
1038 std::vector<Breakpoint> breakpoints_;
1039 void SetBreakpoint(Instruction* breakpoint);
1040 void ListBreakpoints();
1041 void CheckBreakpoints();
1046 bool break_on_next_;
1049 void CheckBreakNext();
1052 void PrintInstructionsAt(Instruction* pc, uint64_t count);
1055 void PrintRegisters();
1056 void PrintVRegisters();
1057 void PrintSystemRegisters();
1060 void PrintWrittenRegisters();
1061 void PrintWrittenVRegisters();
1064 void LogWrittenRegisters() {
1065 if (log_parameters() & LOG_REGS) PrintWrittenRegisters();
1067 void LogWrittenVRegisters() {
1068 if (log_parameters() & LOG_VREGS) PrintWrittenVRegisters();
1070 void LogAllWrittenRegisters() {
1071 LogWrittenRegisters();
1072 LogWrittenVRegisters();
1076 enum PrintRegisterFormat {
1078 kPrintRegLaneSizeB = 0 << 0,
1079 kPrintRegLaneSizeH = 1 << 0,
1080 kPrintRegLaneSizeS = 2 << 0,
1081 kPrintRegLaneSizeW = kPrintRegLaneSizeS,
1082 kPrintRegLaneSizeD = 3 << 0,
1083 kPrintRegLaneSizeX = kPrintRegLaneSizeD,
1084 kPrintRegLaneSizeQ = 4 << 0,
1086 kPrintRegLaneSizeOffset = 0,
1087 kPrintRegLaneSizeMask = 7 << 0,
1090 kPrintRegAsScalar = 0,
1091 kPrintRegAsDVector = 1 << 3,
1092 kPrintRegAsQVector = 2 << 3,
1094 kPrintRegAsVectorMask = 3 << 3,
1098 kPrintRegAsFP = 1 << 5,
1102 kPrintXReg = kPrintRegLaneSizeX | kPrintRegAsScalar,
1103 kPrintWReg = kPrintRegLaneSizeW | kPrintRegAsScalar,
1104 kPrintSReg = kPrintRegLaneSizeS | kPrintRegAsScalar | kPrintRegAsFP,
1105 kPrintDReg = kPrintRegLaneSizeD | kPrintRegAsScalar | kPrintRegAsFP,
1107 kPrintReg1B = kPrintRegLaneSizeB | kPrintRegAsScalar,
1108 kPrintReg8B = kPrintRegLaneSizeB | kPrintRegAsDVector,
1109 kPrintReg16B = kPrintRegLaneSizeB | kPrintRegAsQVector,
1110 kPrintReg1H = kPrintRegLaneSizeH | kPrintRegAsScalar,
1111 kPrintReg4H = kPrintRegLaneSizeH | kPrintRegAsDVector,
1112 kPrintReg8H = kPrintRegLaneSizeH | kPrintRegAsQVector,
1113 kPrintReg1S = kPrintRegLaneSizeS | kPrintRegAsScalar,
1114 kPrintReg2S = kPrintRegLaneSizeS | kPrintRegAsDVector,
1115 kPrintReg4S = kPrintRegLaneSizeS | kPrintRegAsQVector,
1116 kPrintReg1SFP = kPrintRegLaneSizeS | kPrintRegAsScalar | kPrintRegAsFP,
1117 kPrintReg2SFP = kPrintRegLaneSizeS | kPrintRegAsDVector | kPrintRegAsFP,
1118 kPrintReg4SFP = kPrintRegLaneSizeS | kPrintRegAsQVector | kPrintRegAsFP,
1119 kPrintReg1D = kPrintRegLaneSizeD | kPrintRegAsScalar,
1120 kPrintReg2D = kPrintRegLaneSizeD | kPrintRegAsQVector,
1121 kPrintReg1DFP = kPrintRegLaneSizeD | kPrintRegAsScalar | kPrintRegAsFP,
1122 kPrintReg2DFP = kPrintRegLaneSizeD | kPrintRegAsQVector | kPrintRegAsFP,
1123 kPrintReg1Q = kPrintRegLaneSizeQ | kPrintRegAsScalar
1126 unsigned GetPrintRegLaneSizeInBytesLog2(PrintRegisterFormat format) {
1127 return (format & kPrintRegLaneSizeMask) >> kPrintRegLaneSizeOffset;
1130 unsigned GetPrintRegLaneSizeInBytes(PrintRegisterFormat format) {
1131 return 1 << GetPrintRegLaneSizeInBytesLog2(format);
1134 unsigned GetPrintRegSizeInBytesLog2(PrintRegisterFormat format) {
1135 if (format & kPrintRegAsDVector)
return kDRegSizeLog2;
1136 if (format & kPrintRegAsQVector)
return kQRegSizeLog2;
1139 return GetPrintRegLaneSizeInBytesLog2(format);
1142 unsigned GetPrintRegSizeInBytes(PrintRegisterFormat format) {
1143 return 1 << GetPrintRegSizeInBytesLog2(format);
1146 unsigned GetPrintRegLaneCount(PrintRegisterFormat format) {
1147 unsigned reg_size_log2 = GetPrintRegSizeInBytesLog2(format);
1148 unsigned lane_size_log2 = GetPrintRegLaneSizeInBytesLog2(format);
1149 DCHECK_GE(reg_size_log2, lane_size_log2);
1150 return 1 << (reg_size_log2 - lane_size_log2);
1153 template <
typename T>
1154 PrintRegisterFormat GetPrintRegisterFormat(T value) {
1155 return GetPrintRegisterFormatForSize(
sizeof(value));
1158 PrintRegisterFormat GetPrintRegisterFormat(
double value) {
1159 static_assert(
sizeof(value) == kDRegSize,
1160 "D register must be size of double.");
1161 return GetPrintRegisterFormatForSizeFP(
sizeof(value));
1164 PrintRegisterFormat GetPrintRegisterFormat(
float value) {
1165 static_assert(
sizeof(value) == kSRegSize,
1166 "S register must be size of float.");
1167 return GetPrintRegisterFormatForSizeFP(
sizeof(value));
1170 PrintRegisterFormat GetPrintRegisterFormat(VectorFormat vform);
1171 PrintRegisterFormat GetPrintRegisterFormatFP(VectorFormat vform);
1173 PrintRegisterFormat GetPrintRegisterFormatForSize(
size_t reg_size,
1176 PrintRegisterFormat GetPrintRegisterFormatForSize(
size_t size) {
1177 return GetPrintRegisterFormatForSize(size, size);
1180 PrintRegisterFormat GetPrintRegisterFormatForSizeFP(
size_t size) {
1191 PrintRegisterFormat GetPrintRegisterFormatTryFP(PrintRegisterFormat format) {
1192 if ((GetPrintRegLaneSizeInBytes(format) == kSRegSize) ||
1193 (GetPrintRegLaneSizeInBytes(format) == kDRegSize)) {
1194 return static_cast<PrintRegisterFormat
>(format | kPrintRegAsFP);
1200 void PrintRegister(
unsigned code, Reg31Mode r31mode = Reg31IsStackPointer);
1201 void PrintVRegister(
unsigned code, PrintRegisterFormat sizes);
1202 void PrintSystemRegister(SystemRegister
id);
1205 void LogRegister(
unsigned code, Reg31Mode r31mode = Reg31IsStackPointer) {
1206 if (log_parameters() & LOG_REGS) PrintRegister(code, r31mode);
1208 void LogVRegister(
unsigned code, PrintRegisterFormat format) {
1209 if (log_parameters() & LOG_VREGS) PrintVRegister(code, format);
1211 void LogSystemRegister(SystemRegister
id) {
1212 if (log_parameters() & LOG_SYS_REGS) PrintSystemRegister(
id);
1216 void PrintRead(
uintptr_t address,
unsigned reg_code,
1217 PrintRegisterFormat format);
1218 void PrintWrite(
uintptr_t address,
unsigned reg_code,
1219 PrintRegisterFormat format);
1220 void PrintVRead(
uintptr_t address,
unsigned reg_code,
1221 PrintRegisterFormat format,
unsigned lane);
1222 void PrintVWrite(
uintptr_t address,
unsigned reg_code,
1223 PrintRegisterFormat format,
unsigned lane);
1226 void LogRead(
uintptr_t address,
unsigned reg_code,
1227 PrintRegisterFormat format) {
1228 if (log_parameters() & LOG_REGS) PrintRead(address, reg_code, format);
1230 void LogWrite(
uintptr_t address,
unsigned reg_code,
1231 PrintRegisterFormat format) {
1232 if (log_parameters() & LOG_WRITE) PrintWrite(address, reg_code, format);
1234 void LogVRead(
uintptr_t address,
unsigned reg_code,
1235 PrintRegisterFormat format,
unsigned lane = 0) {
1236 if (log_parameters() & LOG_VREGS) {
1237 PrintVRead(address, reg_code, format, lane);
1240 void LogVWrite(
uintptr_t address,
unsigned reg_code,
1241 PrintRegisterFormat format,
unsigned lane = 0) {
1242 if (log_parameters() & LOG_WRITE) {
1243 PrintVWrite(address, reg_code, format, lane);
1247 int log_parameters() {
return log_parameters_; }
1248 void set_log_parameters(
int new_parameters) {
1249 log_parameters_ = new_parameters;
1251 if (new_parameters & LOG_DISASM) {
1252 PrintF(
"Run --debug-sim to dynamically turn on disassembler\n");
1256 if (new_parameters & LOG_DISASM) {
1257 decoder_->InsertVisitorBefore(print_disasm_,
this);
1259 decoder_->RemoveVisitor(print_disasm_);
1264 void PrintRegisterRawHelper(
unsigned code, Reg31Mode r31mode,
1265 int size_in_bytes = kXRegSize);
1266 void PrintVRegisterRawHelper(
unsigned code,
int bytes = kQRegSize,
1268 void PrintVRegisterFPHelper(
unsigned code,
unsigned lane_size_in_bytes,
1269 int lane_count = 1,
int rightmost_lane = 0);
1271 static inline const char* WRegNameForCode(
unsigned code,
1272 Reg31Mode mode = Reg31IsZeroRegister);
1273 static inline const char* XRegNameForCode(
unsigned code,
1274 Reg31Mode mode = Reg31IsZeroRegister);
1275 static inline const char* SRegNameForCode(
unsigned code);
1276 static inline const char* DRegNameForCode(
unsigned code);
1277 static inline const char* VRegNameForCode(
unsigned code);
1278 static inline int CodeFromName(
const char* name);
1282 bool ConditionPassed(Condition cond) {
1283 SimSystemRegister& flags = nzcv();
1302 return flags.C() && !flags.Z();
1304 return !(flags.C() && !flags.Z());
1306 return flags.N() == flags.V();
1308 return flags.N() != flags.V();
1310 return !flags.Z() && (flags.N() == flags.V());
1312 return !(!flags.Z() && (flags.N() == flags.V()));
1321 bool ConditionFailed(Condition cond) {
1322 return !ConditionPassed(cond);
1325 template<
typename T>
1326 void AddSubHelper(Instruction* instr, T op2);
1327 template <
typename T>
1328 T AddWithCarry(
bool set_flags, T left, T right,
int carry_in = 0);
1329 template<
typename T>
1330 void AddSubWithCarry(Instruction* instr);
1331 template<
typename T>
1332 void LogicalHelper(Instruction* instr, T op2);
1333 template<
typename T>
1334 void ConditionalCompareHelper(Instruction* instr, T op2);
1335 void LoadStoreHelper(Instruction* instr,
1338 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode);
1341 void LoadStoreWriteBack(
unsigned addr_reg,
1344 void NEONLoadStoreMultiStructHelper(
const Instruction* instr,
1345 AddrMode addr_mode);
1346 void NEONLoadStoreSingleStructHelper(
const Instruction* instr,
1347 AddrMode addr_mode);
1351 template <
typename T,
typename A>
1352 T MemoryRead(A address) {
1354 STATIC_ASSERT((
sizeof(value) == 1) || (
sizeof(value) == 2) ||
1355 (
sizeof(value) == 4) || (
sizeof(value) == 8) ||
1356 (
sizeof(value) == 16));
1357 memcpy(&value, reinterpret_cast<const void*>(address),
sizeof(value));
1362 template <
typename T,
typename A>
1363 void MemoryWrite(A address, T value) {
1364 STATIC_ASSERT((
sizeof(value) == 1) || (
sizeof(value) == 2) ||
1365 (
sizeof(value) == 4) || (
sizeof(value) == 8) ||
1366 (
sizeof(value) == 16));
1367 memcpy(reinterpret_cast<void*>(address), &value,
sizeof(value));
1370 template <
typename T>
1371 T ShiftOperand(T value,
1374 template <
typename T>
1375 T ExtendValue(T value,
1377 unsigned left_shift = 0);
1378 template <
typename T>
1379 void Extract(Instruction* instr);
1380 template <
typename T>
1381 void DataProcessing2Source(Instruction* instr);
1382 template <
typename T>
1383 void BitfieldHelper(Instruction* instr);
1384 uint16_t PolynomialMult(uint8_t op1, uint8_t op2);
1386 void ld1(VectorFormat vform, LogicVRegister dst, uint64_t addr);
1387 void ld1(VectorFormat vform, LogicVRegister dst,
int index, uint64_t addr);
1388 void ld1r(VectorFormat vform, LogicVRegister dst, uint64_t addr);
1389 void ld2(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1391 void ld2(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1392 int index, uint64_t addr);
1393 void ld2r(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1395 void ld3(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1396 LogicVRegister dst3, uint64_t addr);
1397 void ld3(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1398 LogicVRegister dst3,
int index, uint64_t addr);
1399 void ld3r(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1400 LogicVRegister dst3, uint64_t addr);
1401 void ld4(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1402 LogicVRegister dst3, LogicVRegister dst4, uint64_t addr);
1403 void ld4(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1404 LogicVRegister dst3, LogicVRegister dst4,
int index, uint64_t addr);
1405 void ld4r(VectorFormat vform, LogicVRegister dst1, LogicVRegister dst2,
1406 LogicVRegister dst3, LogicVRegister dst4, uint64_t addr);
1407 void st1(VectorFormat vform, LogicVRegister src, uint64_t addr);
1408 void st1(VectorFormat vform, LogicVRegister src,
int index, uint64_t addr);
1409 void st2(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1411 void st2(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1412 int index, uint64_t addr);
1413 void st3(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1414 LogicVRegister src3, uint64_t addr);
1415 void st3(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1416 LogicVRegister src3,
int index, uint64_t addr);
1417 void st4(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1418 LogicVRegister src3, LogicVRegister src4, uint64_t addr);
1419 void st4(VectorFormat vform, LogicVRegister src, LogicVRegister src2,
1420 LogicVRegister src3, LogicVRegister src4,
int index, uint64_t addr);
1421 LogicVRegister cmp(VectorFormat vform, LogicVRegister dst,
1422 const LogicVRegister& src1,
const LogicVRegister& src2,
1424 LogicVRegister cmp(VectorFormat vform, LogicVRegister dst,
1425 const LogicVRegister& src1,
int imm, Condition cond);
1426 LogicVRegister cmptst(VectorFormat vform, LogicVRegister dst,
1427 const LogicVRegister& src1,
const LogicVRegister& src2);
1428 LogicVRegister add(VectorFormat vform, LogicVRegister dst,
1429 const LogicVRegister& src1,
const LogicVRegister& src2);
1430 LogicVRegister addp(VectorFormat vform, LogicVRegister dst,
1431 const LogicVRegister& src1,
const LogicVRegister& src2);
1432 LogicVRegister mla(VectorFormat vform, LogicVRegister dst,
1433 const LogicVRegister& src1,
const LogicVRegister& src2);
1434 LogicVRegister mls(VectorFormat vform, LogicVRegister dst,
1435 const LogicVRegister& src1,
const LogicVRegister& src2);
1436 LogicVRegister mul(VectorFormat vform, LogicVRegister dst,
1437 const LogicVRegister& src1,
const LogicVRegister& src2);
1438 LogicVRegister mul(VectorFormat vform, LogicVRegister dst,
1439 const LogicVRegister& src1,
const LogicVRegister& src2,
1441 LogicVRegister mla(VectorFormat vform, LogicVRegister dst,
1442 const LogicVRegister& src1,
const LogicVRegister& src2,
1444 LogicVRegister mls(VectorFormat vform, LogicVRegister dst,
1445 const LogicVRegister& src1,
const LogicVRegister& src2,
1447 LogicVRegister pmul(VectorFormat vform, LogicVRegister dst,
1448 const LogicVRegister& src1,
const LogicVRegister& src2);
1450 typedef LogicVRegister (Simulator::*ByElementOp)(VectorFormat vform,
1452 const LogicVRegister& src1,
1453 const LogicVRegister& src2,
1455 LogicVRegister fmul(VectorFormat vform, LogicVRegister dst,
1456 const LogicVRegister& src1,
const LogicVRegister& src2,
1458 LogicVRegister fmla(VectorFormat vform, LogicVRegister dst,
1459 const LogicVRegister& src1,
const LogicVRegister& src2,
1461 LogicVRegister fmls(VectorFormat vform, LogicVRegister dst,
1462 const LogicVRegister& src1,
const LogicVRegister& src2,
1464 LogicVRegister fmulx(VectorFormat vform, LogicVRegister dst,
1465 const LogicVRegister& src1,
const LogicVRegister& src2,
1467 LogicVRegister smull(VectorFormat vform, LogicVRegister dst,
1468 const LogicVRegister& src1,
const LogicVRegister& src2,
1470 LogicVRegister smull2(VectorFormat vform, LogicVRegister dst,
1471 const LogicVRegister& src1,
const LogicVRegister& src2,
1473 LogicVRegister umull(VectorFormat vform, LogicVRegister dst,
1474 const LogicVRegister& src1,
const LogicVRegister& src2,
1476 LogicVRegister umull2(VectorFormat vform, LogicVRegister dst,
1477 const LogicVRegister& src1,
const LogicVRegister& src2,
1479 LogicVRegister smlal(VectorFormat vform, LogicVRegister dst,
1480 const LogicVRegister& src1,
const LogicVRegister& src2,
1482 LogicVRegister smlal2(VectorFormat vform, LogicVRegister dst,
1483 const LogicVRegister& src1,
const LogicVRegister& src2,
1485 LogicVRegister umlal(VectorFormat vform, LogicVRegister dst,
1486 const LogicVRegister& src1,
const LogicVRegister& src2,
1488 LogicVRegister umlal2(VectorFormat vform, LogicVRegister dst,
1489 const LogicVRegister& src1,
const LogicVRegister& src2,
1491 LogicVRegister smlsl(VectorFormat vform, LogicVRegister dst,
1492 const LogicVRegister& src1,
const LogicVRegister& src2,
1494 LogicVRegister smlsl2(VectorFormat vform, LogicVRegister dst,
1495 const LogicVRegister& src1,
const LogicVRegister& src2,
1497 LogicVRegister umlsl(VectorFormat vform, LogicVRegister dst,
1498 const LogicVRegister& src1,
const LogicVRegister& src2,
1500 LogicVRegister umlsl2(VectorFormat vform, LogicVRegister dst,
1501 const LogicVRegister& src1,
const LogicVRegister& src2,
1503 LogicVRegister sqdmull(VectorFormat vform, LogicVRegister dst,
1504 const LogicVRegister& src1,
const LogicVRegister& src2,
1506 LogicVRegister sqdmull2(VectorFormat vform, LogicVRegister dst,
1507 const LogicVRegister& src1,
1508 const LogicVRegister& src2,
int index);
1509 LogicVRegister sqdmlal(VectorFormat vform, LogicVRegister dst,
1510 const LogicVRegister& src1,
const LogicVRegister& src2,
1512 LogicVRegister sqdmlal2(VectorFormat vform, LogicVRegister dst,
1513 const LogicVRegister& src1,
1514 const LogicVRegister& src2,
int index);
1515 LogicVRegister sqdmlsl(VectorFormat vform, LogicVRegister dst,
1516 const LogicVRegister& src1,
const LogicVRegister& src2,
1518 LogicVRegister sqdmlsl2(VectorFormat vform, LogicVRegister dst,
1519 const LogicVRegister& src1,
1520 const LogicVRegister& src2,
int index);
1521 LogicVRegister sqdmulh(VectorFormat vform, LogicVRegister dst,
1522 const LogicVRegister& src1,
const LogicVRegister& src2,
1524 LogicVRegister sqrdmulh(VectorFormat vform, LogicVRegister dst,
1525 const LogicVRegister& src1,
1526 const LogicVRegister& src2,
int index);
1527 LogicVRegister sub(VectorFormat vform, LogicVRegister dst,
1528 const LogicVRegister& src1,
const LogicVRegister& src2);
1529 LogicVRegister and_(VectorFormat vform, LogicVRegister dst,
1530 const LogicVRegister& src1,
const LogicVRegister& src2);
1531 LogicVRegister orr(VectorFormat vform, LogicVRegister dst,
1532 const LogicVRegister& src1,
const LogicVRegister& src2);
1533 LogicVRegister orn(VectorFormat vform, LogicVRegister dst,
1534 const LogicVRegister& src1,
const LogicVRegister& src2);
1535 LogicVRegister eor(VectorFormat vform, LogicVRegister dst,
1536 const LogicVRegister& src1,
const LogicVRegister& src2);
1537 LogicVRegister bic(VectorFormat vform, LogicVRegister dst,
1538 const LogicVRegister& src1,
const LogicVRegister& src2);
1539 LogicVRegister bic(VectorFormat vform, LogicVRegister dst,
1540 const LogicVRegister& src, uint64_t imm);
1541 LogicVRegister bif(VectorFormat vform, LogicVRegister dst,
1542 const LogicVRegister& src1,
const LogicVRegister& src2);
1543 LogicVRegister bit(VectorFormat vform, LogicVRegister dst,
1544 const LogicVRegister& src1,
const LogicVRegister& src2);
1545 LogicVRegister bsl(VectorFormat vform, LogicVRegister dst,
1546 const LogicVRegister& src1,
const LogicVRegister& src2);
1547 LogicVRegister cls(VectorFormat vform, LogicVRegister dst,
1548 const LogicVRegister& src);
1549 LogicVRegister clz(VectorFormat vform, LogicVRegister dst,
1550 const LogicVRegister& src);
1551 LogicVRegister cnt(VectorFormat vform, LogicVRegister dst,
1552 const LogicVRegister& src);
1553 LogicVRegister not_(VectorFormat vform, LogicVRegister dst,
1554 const LogicVRegister& src);
1555 LogicVRegister rbit(VectorFormat vform, LogicVRegister dst,
1556 const LogicVRegister& src);
1557 LogicVRegister rev(VectorFormat vform, LogicVRegister dst,
1558 const LogicVRegister& src,
int revSize);
1559 LogicVRegister rev16(VectorFormat vform, LogicVRegister dst,
1560 const LogicVRegister& src);
1561 LogicVRegister rev32(VectorFormat vform, LogicVRegister dst,
1562 const LogicVRegister& src);
1563 LogicVRegister rev64(VectorFormat vform, LogicVRegister dst,
1564 const LogicVRegister& src);
1565 LogicVRegister addlp(VectorFormat vform, LogicVRegister dst,
1566 const LogicVRegister& src,
bool is_signed,
1567 bool do_accumulate);
1568 LogicVRegister saddlp(VectorFormat vform, LogicVRegister dst,
1569 const LogicVRegister& src);
1570 LogicVRegister uaddlp(VectorFormat vform, LogicVRegister dst,
1571 const LogicVRegister& src);
1572 LogicVRegister sadalp(VectorFormat vform, LogicVRegister dst,
1573 const LogicVRegister& src);
1574 LogicVRegister uadalp(VectorFormat vform, LogicVRegister dst,
1575 const LogicVRegister& src);
1576 LogicVRegister ext(VectorFormat vform, LogicVRegister dst,
1577 const LogicVRegister& src1,
const LogicVRegister& src2,
1579 LogicVRegister ins_element(VectorFormat vform, LogicVRegister dst,
1580 int dst_index,
const LogicVRegister& src,
1582 LogicVRegister ins_immediate(VectorFormat vform, LogicVRegister dst,
1583 int dst_index, uint64_t imm);
1584 LogicVRegister dup_element(VectorFormat vform, LogicVRegister dst,
1585 const LogicVRegister& src,
int src_index);
1586 LogicVRegister dup_immediate(VectorFormat vform, LogicVRegister dst,
1588 LogicVRegister movi(VectorFormat vform, LogicVRegister dst, uint64_t imm);
1589 LogicVRegister mvni(VectorFormat vform, LogicVRegister dst, uint64_t imm);
1590 LogicVRegister orr(VectorFormat vform, LogicVRegister dst,
1591 const LogicVRegister& src, uint64_t imm);
1592 LogicVRegister sshl(VectorFormat vform, LogicVRegister dst,
1593 const LogicVRegister& src1,
const LogicVRegister& src2);
1594 LogicVRegister ushl(VectorFormat vform, LogicVRegister dst,
1595 const LogicVRegister& src1,
const LogicVRegister& src2);
1596 LogicVRegister SMinMax(VectorFormat vform, LogicVRegister dst,
1597 const LogicVRegister& src1,
const LogicVRegister& src2,
1599 LogicVRegister smax(VectorFormat vform, LogicVRegister dst,
1600 const LogicVRegister& src1,
const LogicVRegister& src2);
1601 LogicVRegister smin(VectorFormat vform, LogicVRegister dst,
1602 const LogicVRegister& src1,
const LogicVRegister& src2);
1603 LogicVRegister SMinMaxP(VectorFormat vform, LogicVRegister dst,
1604 const LogicVRegister& src1,
1605 const LogicVRegister& src2,
bool max);
1606 LogicVRegister smaxp(VectorFormat vform, LogicVRegister dst,
1607 const LogicVRegister& src1,
const LogicVRegister& src2);
1608 LogicVRegister sminp(VectorFormat vform, LogicVRegister dst,
1609 const LogicVRegister& src1,
const LogicVRegister& src2);
1610 LogicVRegister addp(VectorFormat vform, LogicVRegister dst,
1611 const LogicVRegister& src);
1612 LogicVRegister addv(VectorFormat vform, LogicVRegister dst,
1613 const LogicVRegister& src);
1614 LogicVRegister uaddlv(VectorFormat vform, LogicVRegister dst,
1615 const LogicVRegister& src);
1616 LogicVRegister saddlv(VectorFormat vform, LogicVRegister dst,
1617 const LogicVRegister& src);
1618 LogicVRegister SMinMaxV(VectorFormat vform, LogicVRegister dst,
1619 const LogicVRegister& src,
bool max);
1620 LogicVRegister smaxv(VectorFormat vform, LogicVRegister dst,
1621 const LogicVRegister& src);
1622 LogicVRegister sminv(VectorFormat vform, LogicVRegister dst,
1623 const LogicVRegister& src);
1624 LogicVRegister uxtl(VectorFormat vform, LogicVRegister dst,
1625 const LogicVRegister& src);
1626 LogicVRegister uxtl2(VectorFormat vform, LogicVRegister dst,
1627 const LogicVRegister& src);
1628 LogicVRegister sxtl(VectorFormat vform, LogicVRegister dst,
1629 const LogicVRegister& src);
1630 LogicVRegister sxtl2(VectorFormat vform, LogicVRegister dst,
1631 const LogicVRegister& src);
1632 LogicVRegister Table(VectorFormat vform, LogicVRegister dst,
1633 const LogicVRegister& ind,
bool zero_out_of_bounds,
1634 const LogicVRegister* tab1,
1635 const LogicVRegister* tab2 =
nullptr,
1636 const LogicVRegister* tab3 =
nullptr,
1637 const LogicVRegister* tab4 =
nullptr);
1638 LogicVRegister tbl(VectorFormat vform, LogicVRegister dst,
1639 const LogicVRegister& tab,
const LogicVRegister& ind);
1640 LogicVRegister tbl(VectorFormat vform, LogicVRegister dst,
1641 const LogicVRegister& tab,
const LogicVRegister& tab2,
1642 const LogicVRegister& ind);
1643 LogicVRegister tbl(VectorFormat vform, LogicVRegister dst,
1644 const LogicVRegister& tab,
const LogicVRegister& tab2,
1645 const LogicVRegister& tab3,
const LogicVRegister& ind);
1646 LogicVRegister tbl(VectorFormat vform, LogicVRegister dst,
1647 const LogicVRegister& tab,
const LogicVRegister& tab2,
1648 const LogicVRegister& tab3,
const LogicVRegister& tab4,
1649 const LogicVRegister& ind);
1650 LogicVRegister tbx(VectorFormat vform, LogicVRegister dst,
1651 const LogicVRegister& tab,
const LogicVRegister& ind);
1652 LogicVRegister tbx(VectorFormat vform, LogicVRegister dst,
1653 const LogicVRegister& tab,
const LogicVRegister& tab2,
1654 const LogicVRegister& ind);
1655 LogicVRegister tbx(VectorFormat vform, LogicVRegister dst,
1656 const LogicVRegister& tab,
const LogicVRegister& tab2,
1657 const LogicVRegister& tab3,
const LogicVRegister& ind);
1658 LogicVRegister tbx(VectorFormat vform, LogicVRegister dst,
1659 const LogicVRegister& tab,
const LogicVRegister& tab2,
1660 const LogicVRegister& tab3,
const LogicVRegister& tab4,
1661 const LogicVRegister& ind);
1662 LogicVRegister uaddl(VectorFormat vform, LogicVRegister dst,
1663 const LogicVRegister& src1,
const LogicVRegister& src2);
1664 LogicVRegister uaddl2(VectorFormat vform, LogicVRegister dst,
1665 const LogicVRegister& src1,
const LogicVRegister& src2);
1666 LogicVRegister uaddw(VectorFormat vform, LogicVRegister dst,
1667 const LogicVRegister& src1,
const LogicVRegister& src2);
1668 LogicVRegister uaddw2(VectorFormat vform, LogicVRegister dst,
1669 const LogicVRegister& src1,
const LogicVRegister& src2);
1670 LogicVRegister saddl(VectorFormat vform, LogicVRegister dst,
1671 const LogicVRegister& src1,
const LogicVRegister& src2);
1672 LogicVRegister saddl2(VectorFormat vform, LogicVRegister dst,
1673 const LogicVRegister& src1,
const LogicVRegister& src2);
1674 LogicVRegister saddw(VectorFormat vform, LogicVRegister dst,
1675 const LogicVRegister& src1,
const LogicVRegister& src2);
1676 LogicVRegister saddw2(VectorFormat vform, LogicVRegister dst,
1677 const LogicVRegister& src1,
const LogicVRegister& src2);
1678 LogicVRegister usubl(VectorFormat vform, LogicVRegister dst,
1679 const LogicVRegister& src1,
const LogicVRegister& src2);
1680 LogicVRegister usubl2(VectorFormat vform, LogicVRegister dst,
1681 const LogicVRegister& src1,
const LogicVRegister& src2);
1682 LogicVRegister usubw(VectorFormat vform, LogicVRegister dst,
1683 const LogicVRegister& src1,
const LogicVRegister& src2);
1684 LogicVRegister usubw2(VectorFormat vform, LogicVRegister dst,
1685 const LogicVRegister& src1,
const LogicVRegister& src2);
1686 LogicVRegister ssubl(VectorFormat vform, LogicVRegister dst,
1687 const LogicVRegister& src1,
const LogicVRegister& src2);
1688 LogicVRegister ssubl2(VectorFormat vform, LogicVRegister dst,
1689 const LogicVRegister& src1,
const LogicVRegister& src2);
1690 LogicVRegister ssubw(VectorFormat vform, LogicVRegister dst,
1691 const LogicVRegister& src1,
const LogicVRegister& src2);
1692 LogicVRegister ssubw2(VectorFormat vform, LogicVRegister dst,
1693 const LogicVRegister& src1,
const LogicVRegister& src2);
1694 LogicVRegister UMinMax(VectorFormat vform, LogicVRegister dst,
1695 const LogicVRegister& src1,
const LogicVRegister& src2,
1697 LogicVRegister umax(VectorFormat vform, LogicVRegister dst,
1698 const LogicVRegister& src1,
const LogicVRegister& src2);
1699 LogicVRegister umin(VectorFormat vform, LogicVRegister dst,
1700 const LogicVRegister& src1,
const LogicVRegister& src2);
1701 LogicVRegister UMinMaxP(VectorFormat vform, LogicVRegister dst,
1702 const LogicVRegister& src1,
1703 const LogicVRegister& src2,
bool max);
1704 LogicVRegister umaxp(VectorFormat vform, LogicVRegister dst,
1705 const LogicVRegister& src1,
const LogicVRegister& src2);
1706 LogicVRegister uminp(VectorFormat vform, LogicVRegister dst,
1707 const LogicVRegister& src1,
const LogicVRegister& src2);
1708 LogicVRegister UMinMaxV(VectorFormat vform, LogicVRegister dst,
1709 const LogicVRegister& src,
bool max);
1710 LogicVRegister umaxv(VectorFormat vform, LogicVRegister dst,
1711 const LogicVRegister& src);
1712 LogicVRegister uminv(VectorFormat vform, LogicVRegister dst,
1713 const LogicVRegister& src);
1714 LogicVRegister trn1(VectorFormat vform, LogicVRegister dst,
1715 const LogicVRegister& src1,
const LogicVRegister& src2);
1716 LogicVRegister trn2(VectorFormat vform, LogicVRegister dst,
1717 const LogicVRegister& src1,
const LogicVRegister& src2);
1718 LogicVRegister zip1(VectorFormat vform, LogicVRegister dst,
1719 const LogicVRegister& src1,
const LogicVRegister& src2);
1720 LogicVRegister zip2(VectorFormat vform, LogicVRegister dst,
1721 const LogicVRegister& src1,
const LogicVRegister& src2);
1722 LogicVRegister uzp1(VectorFormat vform, LogicVRegister dst,
1723 const LogicVRegister& src1,
const LogicVRegister& src2);
1724 LogicVRegister uzp2(VectorFormat vform, LogicVRegister dst,
1725 const LogicVRegister& src1,
const LogicVRegister& src2);
1726 LogicVRegister shl(VectorFormat vform, LogicVRegister dst,
1727 const LogicVRegister& src,
int shift);
1728 LogicVRegister scvtf(VectorFormat vform, LogicVRegister dst,
1729 const LogicVRegister& src,
int fbits,
1730 FPRounding rounding_mode);
1731 LogicVRegister ucvtf(VectorFormat vform, LogicVRegister dst,
1732 const LogicVRegister& src,
int fbits,
1733 FPRounding rounding_mode);
1734 LogicVRegister sshll(VectorFormat vform, LogicVRegister dst,
1735 const LogicVRegister& src,
int shift);
1736 LogicVRegister sshll2(VectorFormat vform, LogicVRegister dst,
1737 const LogicVRegister& src,
int shift);
1738 LogicVRegister shll(VectorFormat vform, LogicVRegister dst,
1739 const LogicVRegister& src);
1740 LogicVRegister shll2(VectorFormat vform, LogicVRegister dst,
1741 const LogicVRegister& src);
1742 LogicVRegister ushll(VectorFormat vform, LogicVRegister dst,
1743 const LogicVRegister& src,
int shift);
1744 LogicVRegister ushll2(VectorFormat vform, LogicVRegister dst,
1745 const LogicVRegister& src,
int shift);
1746 LogicVRegister sli(VectorFormat vform, LogicVRegister dst,
1747 const LogicVRegister& src,
int shift);
1748 LogicVRegister sri(VectorFormat vform, LogicVRegister dst,
1749 const LogicVRegister& src,
int shift);
1750 LogicVRegister sshr(VectorFormat vform, LogicVRegister dst,
1751 const LogicVRegister& src,
int shift);
1752 LogicVRegister ushr(VectorFormat vform, LogicVRegister dst,
1753 const LogicVRegister& src,
int shift);
1754 LogicVRegister ssra(VectorFormat vform, LogicVRegister dst,
1755 const LogicVRegister& src,
int shift);
1756 LogicVRegister usra(VectorFormat vform, LogicVRegister dst,
1757 const LogicVRegister& src,
int shift);
1758 LogicVRegister srsra(VectorFormat vform, LogicVRegister dst,
1759 const LogicVRegister& src,
int shift);
1760 LogicVRegister ursra(VectorFormat vform, LogicVRegister dst,
1761 const LogicVRegister& src,
int shift);
1762 LogicVRegister suqadd(VectorFormat vform, LogicVRegister dst,
1763 const LogicVRegister& src);
1764 LogicVRegister usqadd(VectorFormat vform, LogicVRegister dst,
1765 const LogicVRegister& src);
1766 LogicVRegister sqshl(VectorFormat vform, LogicVRegister dst,
1767 const LogicVRegister& src,
int shift);
1768 LogicVRegister uqshl(VectorFormat vform, LogicVRegister dst,
1769 const LogicVRegister& src,
int shift);
1770 LogicVRegister sqshlu(VectorFormat vform, LogicVRegister dst,
1771 const LogicVRegister& src,
int shift);
1772 LogicVRegister abs(VectorFormat vform, LogicVRegister dst,
1773 const LogicVRegister& src);
1774 LogicVRegister neg(VectorFormat vform, LogicVRegister dst,
1775 const LogicVRegister& src);
1776 LogicVRegister ExtractNarrow(VectorFormat vform, LogicVRegister dst,
1777 bool dstIsSigned,
const LogicVRegister& src,
1779 LogicVRegister xtn(VectorFormat vform, LogicVRegister dst,
1780 const LogicVRegister& src);
1781 LogicVRegister sqxtn(VectorFormat vform, LogicVRegister dst,
1782 const LogicVRegister& src);
1783 LogicVRegister uqxtn(VectorFormat vform, LogicVRegister dst,
1784 const LogicVRegister& src);
1785 LogicVRegister sqxtun(VectorFormat vform, LogicVRegister dst,
1786 const LogicVRegister& src);
1787 LogicVRegister AbsDiff(VectorFormat vform, LogicVRegister dst,
1788 const LogicVRegister& src1,
const LogicVRegister& src2,
1790 LogicVRegister saba(VectorFormat vform, LogicVRegister dst,
1791 const LogicVRegister& src1,
const LogicVRegister& src2);
1792 LogicVRegister uaba(VectorFormat vform, LogicVRegister dst,
1793 const LogicVRegister& src1,
const LogicVRegister& src2);
1794 LogicVRegister shrn(VectorFormat vform, LogicVRegister dst,
1795 const LogicVRegister& src,
int shift);
1796 LogicVRegister shrn2(VectorFormat vform, LogicVRegister dst,
1797 const LogicVRegister& src,
int shift);
1798 LogicVRegister rshrn(VectorFormat vform, LogicVRegister dst,
1799 const LogicVRegister& src,
int shift);
1800 LogicVRegister rshrn2(VectorFormat vform, LogicVRegister dst,
1801 const LogicVRegister& src,
int shift);
1802 LogicVRegister uqshrn(VectorFormat vform, LogicVRegister dst,
1803 const LogicVRegister& src,
int shift);
1804 LogicVRegister uqshrn2(VectorFormat vform, LogicVRegister dst,
1805 const LogicVRegister& src,
int shift);
1806 LogicVRegister uqrshrn(VectorFormat vform, LogicVRegister dst,
1807 const LogicVRegister& src,
int shift);
1808 LogicVRegister uqrshrn2(VectorFormat vform, LogicVRegister dst,
1809 const LogicVRegister& src,
int shift);
1810 LogicVRegister sqshrn(VectorFormat vform, LogicVRegister dst,
1811 const LogicVRegister& src,
int shift);
1812 LogicVRegister sqshrn2(VectorFormat vform, LogicVRegister dst,
1813 const LogicVRegister& src,
int shift);
1814 LogicVRegister sqrshrn(VectorFormat vform, LogicVRegister dst,
1815 const LogicVRegister& src,
int shift);
1816 LogicVRegister sqrshrn2(VectorFormat vform, LogicVRegister dst,
1817 const LogicVRegister& src,
int shift);
1818 LogicVRegister sqshrun(VectorFormat vform, LogicVRegister dst,
1819 const LogicVRegister& src,
int shift);
1820 LogicVRegister sqshrun2(VectorFormat vform, LogicVRegister dst,
1821 const LogicVRegister& src,
int shift);
1822 LogicVRegister sqrshrun(VectorFormat vform, LogicVRegister dst,
1823 const LogicVRegister& src,
int shift);
1824 LogicVRegister sqrshrun2(VectorFormat vform, LogicVRegister dst,
1825 const LogicVRegister& src,
int shift);
1826 LogicVRegister sqrdmulh(VectorFormat vform, LogicVRegister dst,
1827 const LogicVRegister& src1,
1828 const LogicVRegister& src2,
bool round =
true);
1829 LogicVRegister sqdmulh(VectorFormat vform, LogicVRegister dst,
1830 const LogicVRegister& src1,
1831 const LogicVRegister& src2);
1832 #define NEON_3VREG_LOGIC_LIST(V) \ 1870 #define DEFINE_LOGIC_FUNC(FXN) \ 1871 LogicVRegister FXN(VectorFormat vform, LogicVRegister dst, \ 1872 const LogicVRegister& src1, const LogicVRegister& src2); 1873 NEON_3VREG_LOGIC_LIST(DEFINE_LOGIC_FUNC)
1874 #undef DEFINE_LOGIC_FUNC 1876 #define NEON_FP3SAME_LIST(V) \ 1877 V(fadd, FPAdd, false) \ 1878 V(fsub, FPSub, true) \ 1879 V(fmul, FPMul, true) \ 1880 V(fmulx, FPMulx, true) \ 1881 V(fdiv, FPDiv, true) \ 1882 V(fmax, FPMax, false) \ 1883 V(fmin, FPMin, false) \ 1884 V(fmaxnm, FPMaxNM, false) \ 1885 V(fminnm, FPMinNM, false) 1887 #define DECLARE_NEON_FP_VECTOR_OP(FN, OP, PROCNAN) \ 1888 template <typename T> \ 1889 LogicVRegister FN(VectorFormat vform, LogicVRegister dst, \ 1890 const LogicVRegister& src1, const LogicVRegister& src2); \ 1891 LogicVRegister FN(VectorFormat vform, LogicVRegister dst, \ 1892 const LogicVRegister& src1, const LogicVRegister& src2); 1893 NEON_FP3SAME_LIST(DECLARE_NEON_FP_VECTOR_OP)
1894 #undef DECLARE_NEON_FP_VECTOR_OP 1896 #define NEON_FPPAIRWISE_LIST(V) \ 1897 V(faddp, fadd, FPAdd) \ 1898 V(fmaxp, fmax, FPMax) \ 1899 V(fmaxnmp, fmaxnm, FPMaxNM) \ 1900 V(fminp, fmin, FPMin) \ 1901 V(fminnmp, fminnm, FPMinNM) 1903 #define DECLARE_NEON_FP_PAIR_OP(FNP, FN, OP) \ 1904 LogicVRegister FNP(VectorFormat vform, LogicVRegister dst, \ 1905 const LogicVRegister& src1, const LogicVRegister& src2); \ 1906 LogicVRegister FNP(VectorFormat vform, LogicVRegister dst, \ 1907 const LogicVRegister& src); 1908 NEON_FPPAIRWISE_LIST(DECLARE_NEON_FP_PAIR_OP)
1909 #undef DECLARE_NEON_FP_PAIR_OP 1911 template <
typename T>
1912 LogicVRegister frecps(VectorFormat vform, LogicVRegister dst,
1913 const LogicVRegister& src1,
const LogicVRegister& src2);
1914 LogicVRegister frecps(VectorFormat vform, LogicVRegister dst,
1915 const LogicVRegister& src1,
const LogicVRegister& src2);
1916 template <
typename T>
1917 LogicVRegister frsqrts(VectorFormat vform, LogicVRegister dst,
1918 const LogicVRegister& src1,
1919 const LogicVRegister& src2);
1920 LogicVRegister frsqrts(VectorFormat vform, LogicVRegister dst,
1921 const LogicVRegister& src1,
1922 const LogicVRegister& src2);
1923 template <
typename T>
1924 LogicVRegister fmla(VectorFormat vform, LogicVRegister dst,
1925 const LogicVRegister& src1,
const LogicVRegister& src2);
1926 LogicVRegister fmla(VectorFormat vform, LogicVRegister dst,
1927 const LogicVRegister& src1,
const LogicVRegister& src2);
1928 template <
typename T>
1929 LogicVRegister fmls(VectorFormat vform, LogicVRegister dst,
1930 const LogicVRegister& src1,
const LogicVRegister& src2);
1931 LogicVRegister fmls(VectorFormat vform, LogicVRegister dst,
1932 const LogicVRegister& src1,
const LogicVRegister& src2);
1933 LogicVRegister fnmul(VectorFormat vform, LogicVRegister dst,
1934 const LogicVRegister& src1,
const LogicVRegister& src2);
1936 template <
typename T>
1937 LogicVRegister fcmp(VectorFormat vform, LogicVRegister dst,
1938 const LogicVRegister& src1,
const LogicVRegister& src2,
1940 LogicVRegister fcmp(VectorFormat vform, LogicVRegister dst,
1941 const LogicVRegister& src1,
const LogicVRegister& src2,
1943 LogicVRegister fabscmp(VectorFormat vform, LogicVRegister dst,
1944 const LogicVRegister& src1,
const LogicVRegister& src2,
1946 LogicVRegister fcmp_zero(VectorFormat vform, LogicVRegister dst,
1947 const LogicVRegister& src, Condition cond);
1949 template <
typename T>
1950 LogicVRegister fneg(VectorFormat vform, LogicVRegister dst,
1951 const LogicVRegister& src);
1952 LogicVRegister fneg(VectorFormat vform, LogicVRegister dst,
1953 const LogicVRegister& src);
1954 template <
typename T>
1955 LogicVRegister frecpx(VectorFormat vform, LogicVRegister dst,
1956 const LogicVRegister& src);
1957 LogicVRegister frecpx(VectorFormat vform, LogicVRegister dst,
1958 const LogicVRegister& src);
1959 template <
typename T>
1960 LogicVRegister fabs_(VectorFormat vform, LogicVRegister dst,
1961 const LogicVRegister& src);
1962 LogicVRegister fabs_(VectorFormat vform, LogicVRegister dst,
1963 const LogicVRegister& src);
1964 LogicVRegister fabd(VectorFormat vform, LogicVRegister dst,
1965 const LogicVRegister& src1,
const LogicVRegister& src2);
1966 LogicVRegister frint(VectorFormat vform, LogicVRegister dst,
1967 const LogicVRegister& src, FPRounding rounding_mode,
1968 bool inexact_exception =
false);
1969 LogicVRegister fcvts(VectorFormat vform, LogicVRegister dst,
1970 const LogicVRegister& src, FPRounding rounding_mode,
1972 LogicVRegister fcvtu(VectorFormat vform, LogicVRegister dst,
1973 const LogicVRegister& src, FPRounding rounding_mode,
1975 LogicVRegister fcvtl(VectorFormat vform, LogicVRegister dst,
1976 const LogicVRegister& src);
1977 LogicVRegister fcvtl2(VectorFormat vform, LogicVRegister dst,
1978 const LogicVRegister& src);
1979 LogicVRegister fcvtn(VectorFormat vform, LogicVRegister dst,
1980 const LogicVRegister& src);
1981 LogicVRegister fcvtn2(VectorFormat vform, LogicVRegister dst,
1982 const LogicVRegister& src);
1983 LogicVRegister fcvtxn(VectorFormat vform, LogicVRegister dst,
1984 const LogicVRegister& src);
1985 LogicVRegister fcvtxn2(VectorFormat vform, LogicVRegister dst,
1986 const LogicVRegister& src);
1987 LogicVRegister fsqrt(VectorFormat vform, LogicVRegister dst,
1988 const LogicVRegister& src);
1989 LogicVRegister frsqrte(VectorFormat vform, LogicVRegister dst,
1990 const LogicVRegister& src);
1991 LogicVRegister frecpe(VectorFormat vform, LogicVRegister dst,
1992 const LogicVRegister& src, FPRounding rounding);
1993 LogicVRegister ursqrte(VectorFormat vform, LogicVRegister dst,
1994 const LogicVRegister& src);
1995 LogicVRegister urecpe(VectorFormat vform, LogicVRegister dst,
1996 const LogicVRegister& src);
1998 typedef float (Simulator::*FPMinMaxOp)(
float a,
float b);
2000 LogicVRegister FMinMaxV(VectorFormat vform, LogicVRegister dst,
2001 const LogicVRegister& src, FPMinMaxOp Op);
2003 LogicVRegister fminv(VectorFormat vform, LogicVRegister dst,
2004 const LogicVRegister& src);
2005 LogicVRegister fmaxv(VectorFormat vform, LogicVRegister dst,
2006 const LogicVRegister& src);
2007 LogicVRegister fminnmv(VectorFormat vform, LogicVRegister dst,
2008 const LogicVRegister& src);
2009 LogicVRegister fmaxnmv(VectorFormat vform, LogicVRegister dst,
2010 const LogicVRegister& src);
2012 template <
typename T>
2013 T FPRecipSqrtEstimate(T op);
2014 template <
typename T>
2015 T FPRecipEstimate(T op, FPRounding rounding);
2016 template <
typename T,
typename R>
2017 R FPToFixed(T op,
int fbits,
bool is_signed, FPRounding rounding);
2019 void FPCompare(
double val0,
double val1);
2020 double FPRoundInt(
double value, FPRounding round_mode);
2021 double FPToDouble(
float value);
2022 float FPToFloat(
double value, FPRounding round_mode);
2023 float FPToFloat(float16 value);
2024 float16 FPToFloat16(
float value, FPRounding round_mode);
2025 float16 FPToFloat16(
double value, FPRounding round_mode);
2026 double recip_sqrt_estimate(
double a);
2027 double recip_estimate(
double a);
2028 double FPRecipSqrtEstimate(
double a);
2029 double FPRecipEstimate(
double a);
2030 double FixedToDouble(
int64_t src,
int fbits, FPRounding round_mode);
2031 double UFixedToDouble(uint64_t src,
int fbits, FPRounding round_mode);
2032 float FixedToFloat(
int64_t src,
int fbits, FPRounding round_mode);
2033 float UFixedToFloat(uint64_t src,
int fbits, FPRounding round_mode);
2034 int32_t FPToInt32(
double value, FPRounding rmode);
2035 int64_t FPToInt64(
double value, FPRounding rmode);
2036 uint32_t FPToUInt32(
double value, FPRounding rmode);
2037 uint64_t FPToUInt64(
double value, FPRounding rmode);
2039 template <
typename T>
2040 T FPAdd(T op1, T op2);
2042 template <
typename T>
2043 T FPDiv(T op1, T op2);
2045 template <
typename T>
2048 template <
typename T>
2049 T FPMaxNM(T a, T b);
2051 template <
typename T>
2054 template <
typename T>
2055 T FPMinNM(T a, T b);
2057 template <
typename T>
2058 T FPMul(T op1, T op2);
2060 template <
typename T>
2061 T FPMulx(T op1, T op2);
2063 template <
typename T>
2064 T FPMulAdd(T a, T op1, T op2);
2066 template <
typename T>
2069 template <
typename T>
2070 T FPSub(T op1, T op2);
2072 template <
typename T>
2073 T FPRecipStepFused(T op1, T op2);
2075 template <
typename T>
2076 T FPRSqrtStepFused(T op1, T op2);
2080 void FPProcessException() {}
2083 bool FPProcessNaNs(Instruction* instr);
2085 void CheckStackAlignment();
2087 inline void CheckPCSComplianceAndRun();
2092 static const uint64_t kCallerSavedRegisterCorruptionValue =
2093 0xca11edc0de000000UL;
2095 static const uint64_t kCallerSavedVRegisterCorruptionValue =
2096 0x7ff000007f801000UL;
2098 static const uint64_t kDefaultCPURegisterCorruptionValue =
2099 0x7ffbad007f8bad00UL;
2101 void CorruptRegisters(CPURegList* list,
2102 uint64_t value = kDefaultCPURegisterCorruptionValue);
2103 void CorruptAllCallerSavedCPURegisters();
2107 void DoPrintf(Instruction* instr);
2113 PrintDisassembler* print_disasm_;
2114 void PRINTF_FORMAT(2, 3) TraceSim(const
char* format, ...);
2117 Instrument* instrument_;
2120 SimRegister registers_[kNumberOfRegisters];
2123 SimVRegister vregisters_[kNumberOfVRegisters];
2128 SimSystemRegister nzcv_;
2131 SimSystemRegister fpcr_;
2140 void AssertSupportedFPCR() {
2141 DCHECK_EQ(fpcr().FZ(), 0);
2142 DCHECK(fpcr().RMode() == FPTieEven);
2148 template <
typename T>
2149 static int CalcNFlag(T result) {
2150 return (result >> (
sizeof(T) * 8 - 1)) & 1;
2153 static int CalcZFlag(uint64_t result) {
2157 static const uint32_t kConditionFlagsMask = 0xf0000000;
2161 static const size_t stack_protection_size_ = KB;
2165 Decoder<DispatchingDecoderVisitor>* decoder_;
2166 Decoder<DispatchingDecoderVisitor>* disassembler_decoder_;
2173 static const char* xreg_names[];
2174 static const char* wreg_names[];
2175 static const char* sreg_names[];
2176 static const char* dreg_names[];
2177 static const char* vreg_names[];
2180 void set_last_debugger_input(
char* input) {
2181 DeleteArray(last_debugger_input_);
2182 last_debugger_input_ = input;
2184 char* last_debugger_input() {
return last_debugger_input_; }
2185 char* last_debugger_input_;
2189 enum class MonitorAccess {
2194 enum class TransactionSize {
2202 TransactionSize get_transaction_size(
unsigned size);
2206 static const uintptr_t kExclusiveTaggedAddrMask = ~((1 << 11) - 1);
2208 class LocalMonitor {
2217 void NotifyLoadExcl(
uintptr_t addr, TransactionSize size);
2219 bool NotifyStoreExcl(
uintptr_t addr, TransactionSize size);
2224 MonitorAccess access_state_;
2226 TransactionSize size_;
2229 class GlobalMonitor {
2238 friend class GlobalMonitor;
2241 void Clear_Locked();
2242 void NotifyLoadExcl_Locked(
uintptr_t addr);
2243 void NotifyStore_Locked(
bool is_requesting_processor);
2244 bool NotifyStoreExcl_Locked(
uintptr_t addr,
bool is_requesting_processor);
2246 MonitorAccess access_state_;
2254 static const int kMaxFailureCounter = 5;
2255 int failure_counter_;
2261 void NotifyLoadExcl_Locked(
uintptr_t addr, Processor* processor);
2262 void NotifyStore_Locked(Processor* processor);
2263 bool NotifyStoreExcl_Locked(
uintptr_t addr, Processor* processor);
2266 void RemoveProcessor(Processor* processor);
2269 bool IsProcessorInLinkedList_Locked(Processor* processor)
const;
2270 void PrependProcessor_Locked(Processor* processor);
2275 LocalMonitor local_monitor_;
2276 GlobalMonitor::Processor global_monitor_processor_;
2277 static base::LazyInstance<GlobalMonitor>::type global_monitor_;
2280 void Init(FILE* stream);
2282 V8_EXPORT_PRIVATE
void CallImpl(Address entry, CallArgument* args);
2285 template <
typename T>
2286 typename std::enable_if<std::is_floating_point<T>::value, T>::type
2288 return static_cast<T
>(dreg(0));
2291 template <
typename T>
2292 typename std::enable_if<!std::is_floating_point<T>::value, T>::type
2294 return ConvertReturn<T>(xreg(0));
2297 template <
typename T>
2298 static T FPDefaultNaN();
2300 template <
typename T>
2301 T FPProcessNaN(T op) {
2302 DCHECK(std::isnan(op));
2303 return fpcr().DN() ? FPDefaultNaN<T>() : ToQuietNaN(op);
2306 template <
typename T>
2307 T FPProcessNaNs(T op1, T op2) {
2308 if (IsSignallingNaN(op1)) {
2309 return FPProcessNaN(op1);
2310 }
else if (IsSignallingNaN(op2)) {
2311 return FPProcessNaN(op2);
2312 }
else if (std::isnan(op1)) {
2313 DCHECK(IsQuietNaN(op1));
2314 return FPProcessNaN(op1);
2315 }
else if (std::isnan(op2)) {
2316 DCHECK(IsQuietNaN(op2));
2317 return FPProcessNaN(op2);
2323 template <
typename T>
2324 T FPProcessNaNs3(T op1, T op2, T op3) {
2325 if (IsSignallingNaN(op1)) {
2326 return FPProcessNaN(op1);
2327 }
else if (IsSignallingNaN(op2)) {
2328 return FPProcessNaN(op2);
2329 }
else if (IsSignallingNaN(op3)) {
2330 return FPProcessNaN(op3);
2331 }
else if (std::isnan(op1)) {
2332 DCHECK(IsQuietNaN(op1));
2333 return FPProcessNaN(op1);
2334 }
else if (std::isnan(op2)) {
2335 DCHECK(IsQuietNaN(op2));
2336 return FPProcessNaN(op2);
2337 }
else if (std::isnan(op3)) {
2338 DCHECK(IsQuietNaN(op3));
2339 return FPProcessNaN(op3);
2345 int log_parameters_;
2350 inline double Simulator::FPDefaultNaN<double>() {
2351 return kFP64DefaultNaN;
2355 inline float Simulator::FPDefaultNaN<float>() {
2356 return kFP32DefaultNaN;
2359 #endif // defined(USE_SIMULATOR) 2364 #endif // V8_ARM64_SIMULATOR_ARM64_H_