37 #ifndef V8_IA32_ASSEMBLER_IA32_H_ 38 #define V8_IA32_ASSEMBLER_IA32_H_ 42 #include "src/assembler.h" 43 #include "src/ia32/constants-ia32.h" 44 #include "src/ia32/sse-instr.h" 45 #include "src/isolate.h" 46 #include "src/label.h" 47 #include "src/objects/smi.h" 48 #include "src/utils.h" 53 #define GENERAL_REGISTERS(V) \ 63 #define ALLOCATABLE_GENERAL_REGISTERS(V) \ 70 #define DOUBLE_REGISTERS(V) \ 80 #define FLOAT_REGISTERS DOUBLE_REGISTERS 81 #define SIMD128_REGISTERS DOUBLE_REGISTERS 83 #define ALLOCATABLE_DOUBLE_REGISTERS(V) \ 93 #define REGISTER_CODE(R) kRegCode_##R, 94 GENERAL_REGISTERS(REGISTER_CODE)
99 class Register :
public RegisterBase<Register, kRegAfterLast> {
101 bool is_byte_register()
const {
return reg_code_ <= 3; }
104 friend class RegisterBase<Register, kRegAfterLast>;
105 explicit constexpr Register(
int code) : RegisterBase(code) {}
108 ASSERT_TRIVIALLY_COPYABLE(Register);
109 static_assert(
sizeof(Register) ==
sizeof(
int),
110 "Register can efficiently be passed by value");
112 #define DEFINE_REGISTER(R) \ 113 constexpr Register R = Register::from_code<kRegCode_##R>(); 114 GENERAL_REGISTERS(DEFINE_REGISTER)
115 #undef DEFINE_REGISTER 116 constexpr Register no_reg = Register::no_reg();
118 constexpr
bool kPadArguments =
false;
119 constexpr
bool kSimpleFPAliasing =
true;
120 constexpr
bool kSimdMaskRegisters =
false;
123 #define REGISTER_CODE(R) kDoubleCode_##R, 124 DOUBLE_REGISTERS(REGISTER_CODE)
140 #define DEFINE_REGISTER(R) \ 141 constexpr DoubleRegister R = DoubleRegister::from_code<kDoubleCode_##R>(); 142 DOUBLE_REGISTERS(DEFINE_REGISTER)
143 #undef DEFINE_REGISTER 147 constexpr
int kNumRegs = 8;
150 constexpr
RegList kJSCallerSaved =
151 Register::ListOf<eax, ecx, edx,
156 constexpr
int kNumJSCallerSaved = 5;
159 constexpr
int kNumSafepointRegisters = 8;
184 not_carry = above_equal,
186 not_zero = not_equal,
196 inline Condition NegateCondition(Condition cc) {
197 return static_cast<Condition
>(cc ^ 1);
202 kRoundToNearest = 0x0,
214 inline explicit Immediate(
int x, RelocInfo::Mode rmode = RelocInfo::NONE) {
215 value_.immediate = x;
218 inline explicit Immediate(
const ExternalReference& ext)
219 : Immediate(ext.address(), RelocInfo::EXTERNAL_REFERENCE) {}
220 inline explicit Immediate(Handle<HeapObject> handle)
221 : Immediate(handle.address(), RelocInfo::EMBEDDED_OBJECT) {}
222 inline explicit Immediate(Smi value)
223 : Immediate(static_cast<intptr_t>(value.ptr())) {}
225 static Immediate EmbeddedNumber(
double number);
226 static Immediate EmbeddedCode(CodeStub* code);
227 static Immediate EmbeddedStringConstant(
const StringConstantBase* str);
229 static Immediate CodeRelativeOffset(Label* label) {
230 return Immediate(label);
233 bool is_heap_object_request()
const {
234 DCHECK_IMPLIES(is_heap_object_request_,
235 rmode_ == RelocInfo::EMBEDDED_OBJECT ||
236 rmode_ == RelocInfo::CODE_TARGET);
237 return is_heap_object_request_;
240 HeapObjectRequest heap_object_request()
const {
241 DCHECK(is_heap_object_request());
242 return value_.heap_object_request;
245 int immediate()
const {
246 DCHECK(!is_heap_object_request());
247 return value_.immediate;
250 bool is_embedded_object()
const {
251 return !is_heap_object_request() && rmode() == RelocInfo::EMBEDDED_OBJECT;
254 Handle<HeapObject> embedded_object()
const {
255 return Handle<HeapObject>(
reinterpret_cast<Address*
>(immediate()));
258 bool is_external_reference()
const {
259 return rmode() == RelocInfo::EXTERNAL_REFERENCE;
262 ExternalReference external_reference()
const {
263 DCHECK(is_external_reference());
264 return bit_cast<ExternalReference>(immediate());
267 bool is_zero()
const {
return RelocInfo::IsNone(rmode_) && immediate() == 0; }
268 bool is_int8()
const {
269 return RelocInfo::IsNone(rmode_) && i::is_int8(immediate());
271 bool is_uint8()
const {
272 return RelocInfo::IsNone(rmode_) && i::is_uint8(immediate());
274 bool is_int16()
const {
275 return RelocInfo::IsNone(rmode_) && i::is_int16(immediate());
278 bool is_uint16()
const {
279 return RelocInfo::IsNone(rmode_) && i::is_uint16(immediate());
282 RelocInfo::Mode rmode()
const {
return rmode_; }
285 inline explicit Immediate(Label* value) {
286 value_.immediate =
reinterpret_cast<int32_t
>(value);
287 rmode_ = RelocInfo::INTERNAL_REFERENCE;
292 HeapObjectRequest heap_object_request;
295 bool is_heap_object_request_ =
false;
296 RelocInfo::Mode rmode_;
298 friend class Operand;
299 friend class Assembler;
300 friend class MacroAssembler;
312 times_int_size = times_4,
313 times_half_pointer_size = times_2,
314 times_pointer_size = times_4,
315 times_twice_pointer_size = times_8
318 class V8_EXPORT_PRIVATE Operand {
321 V8_INLINE
explicit Operand(Register reg) { set_modrm(3, reg); }
324 V8_INLINE
explicit Operand(XMMRegister xmm_reg) {
325 Register reg = Register::from_code(xmm_reg.code());
330 V8_INLINE
explicit Operand(int32_t disp, RelocInfo::Mode rmode) {
332 set_dispr(disp, rmode);
336 V8_INLINE
explicit Operand(Immediate imm) {
338 set_dispr(imm.immediate(), imm.rmode_);
342 explicit Operand(Register base, int32_t disp,
343 RelocInfo::Mode rmode = RelocInfo::NONE);
346 explicit Operand(Register base, Register index, ScaleFactor scale,
347 int32_t disp, RelocInfo::Mode rmode = RelocInfo::NONE);
350 explicit Operand(Register index, ScaleFactor scale, int32_t disp,
351 RelocInfo::Mode rmode = RelocInfo::NONE);
353 static Operand JumpTable(Register index, ScaleFactor scale, Label* table) {
354 return Operand(index, scale, reinterpret_cast<int32_t>(table),
355 RelocInfo::INTERNAL_REFERENCE);
358 static Operand ForRegisterPlusImmediate(Register base, Immediate imm) {
359 return Operand(base, imm.value_.immediate, imm.rmode_);
363 bool is_reg(Register reg)
const {
return is_reg(reg.code()); }
364 bool is_reg(XMMRegister reg)
const {
return is_reg(reg.code()); }
367 bool is_reg_only()
const;
371 Register reg()
const;
376 inline void set_modrm(
int mod, Register rm) {
377 DCHECK_EQ(mod & -4, 0);
378 buf_[0] = mod << 6 | rm.code();
382 inline void set_sib(ScaleFactor scale, Register index, Register base);
383 inline void set_disp8(int8_t disp);
384 inline void set_dispr(int32_t disp, RelocInfo::Mode rmode) {
385 DCHECK(len_ == 1 || len_ == 2);
386 int32_t* p =
reinterpret_cast<int32_t*
>(&buf_[len_]);
388 len_ +=
sizeof(int32_t);
392 inline bool is_reg(
int reg_code)
const {
393 return ((buf_[0] & 0xF8) == 0xC0)
394 && ((buf_[0] & 0x07) == reg_code);
401 RelocInfo::Mode rmode_ = RelocInfo::NONE;
404 friend class Assembler;
406 ASSERT_TRIVIALLY_COPYABLE(Operand);
407 static_assert(
sizeof(Operand) <= 2 * kPointerSize,
408 "Operand must be small enough to pass it by value");
431 enum Type { UNCONDITIONAL_JUMP, CODE_RELATIVE, OTHER, CODE_ABSOLUTE };
433 int data()
const {
return data_; }
434 Type
type()
const {
return TypeField::decode(data_); }
435 void next(
Label* L)
const {
436 int n = NextField::decode(data_);
437 n > 0 ? L->link_to(n) : L->Unuse();
439 void link_to(
Label* L) { init(L,
type()); }
446 PrintF(
"%s (%x) ", (
type() == UNCONDITIONAL_JUMP ?
"jmp" :
"[other]"),
447 NextField::decode(data_));
453 class TypeField:
public BitField<Type, 0, 2> {};
454 class NextField:
public BitField<int, 2, 32-2> {};
470 static constexpr
int kGap = 32;
493 void GetCode(Isolate* isolate, CodeDesc* desc);
497 inline static Address target_address_at(Address pc, Address constant_pool);
498 inline static void set_target_address_at(
499 Address pc, Address constant_pool, Address target,
500 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
504 inline static Address target_address_from_return_address(Address pc);
508 inline static void deserialization_set_special_target_at(
509 Address instruction_payload, Code code, Address target);
512 inline static int deserialization_special_target_size(
513 Address instruction_payload);
516 inline static void deserialization_set_target_internal_reference_at(
517 Address pc, Address target,
518 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
520 static constexpr
int kSpecialTargetSize = kPointerSize;
524 static constexpr
int kCallTargetAddressOffset = kPointerSize;
527 static constexpr byte kTestAlByte = 0xA8;
529 static constexpr byte kNopByte = 0x90;
532 static constexpr byte kJmpShortOpcode = 0xEB;
534 static constexpr byte kJccShortPrefix = 0x70;
535 static constexpr byte kJncShortOpcode = kJccShortPrefix | not_carry;
536 static constexpr byte kJcShortOpcode = kJccShortPrefix | carry;
537 static constexpr byte kJnzShortOpcode = kJccShortPrefix | not_zero;
538 static constexpr byte kJzShortOpcode = kJccShortPrefix | zero;
566 void DataAlign(
int m);
567 void Nop(
int bytes = 1);
569 void CodeTargetAlign();
578 void push(
const Immediate& x);
579 void push_imm32(int32_t imm32);
580 void push(Register src);
581 void push(Operand src);
583 void pop(Register dst);
584 void pop(Operand dst);
586 void enter(
const Immediate& size);
590 void mov_b(Register dst, Register src) { mov_b(dst, Operand(src)); }
591 void mov_b(Register dst, Operand src);
592 void mov_b(Register dst, int8_t imm8) { mov_b(Operand(dst), imm8); }
593 void mov_b(Operand dst, int8_t src) { mov_b(dst, Immediate(src)); }
594 void mov_b(Operand dst,
const Immediate& src);
595 void mov_b(Operand dst, Register src);
597 void mov_w(Register dst, Operand src);
598 void mov_w(Operand dst, int16_t src) { mov_w(dst, Immediate(src)); }
599 void mov_w(Operand dst,
const Immediate& src);
600 void mov_w(Operand dst, Register src);
602 void mov(Register dst, int32_t imm32);
603 void mov(Register dst,
const Immediate& x);
604 void mov(Register dst, Handle<HeapObject> handle);
605 void mov(Register dst, Operand src);
606 void mov(Register dst, Register src);
607 void mov(Operand dst,
const Immediate& x);
608 void mov(Operand dst, Handle<HeapObject> handle);
609 void mov(Operand dst, Register src);
610 void mov(Operand dst, Address src, RelocInfo::Mode);
612 void movsx_b(Register dst, Register src) { movsx_b(dst, Operand(src)); }
613 void movsx_b(Register dst, Operand src);
615 void movsx_w(Register dst, Register src) { movsx_w(dst, Operand(src)); }
616 void movsx_w(Register dst, Operand src);
618 void movzx_b(Register dst, Register src) { movzx_b(dst, Operand(src)); }
619 void movzx_b(Register dst, Operand src);
621 void movzx_w(Register dst, Register src) { movzx_w(dst, Operand(src)); }
622 void movzx_w(Register dst, Operand src);
624 void movq(XMMRegister dst, Operand src);
626 void cmov(Condition cc, Register dst, Register src) {
627 cmov(cc, dst, Operand(src));
629 void cmov(Condition cc, Register dst, Operand src);
640 void xchg(Register dst, Register src);
641 void xchg(Register dst, Operand src);
642 void xchg_b(Register reg, Operand op);
643 void xchg_w(Register reg, Operand op);
649 void cmpxchg(Operand dst, Register src);
650 void cmpxchg_b(Operand dst, Register src);
651 void cmpxchg_w(Operand dst, Register src);
652 void cmpxchg8b(Operand dst);
660 void adc(Register dst, int32_t imm32);
661 void adc(Register dst, Register src) { adc(dst, Operand(src)); }
662 void adc(Register dst, Operand src);
664 void add(Register dst, Register src) { add(dst, Operand(src)); }
665 void add(Register dst, Operand src);
666 void add(Operand dst, Register src);
667 void add(Register dst,
const Immediate& imm) { add(Operand(dst), imm); }
668 void add(Operand dst,
const Immediate& x);
670 void and_(Register dst, int32_t imm32);
671 void and_(Register dst,
const Immediate& x);
672 void and_(Register dst, Register src) { and_(dst, Operand(src)); }
673 void and_(Register dst, Operand src);
674 void and_(Operand dst, Register src);
675 void and_(Operand dst,
const Immediate& x);
677 void cmpb(Register reg, Immediate imm8) {
678 DCHECK(reg.is_byte_register());
679 cmpb(Operand(reg), imm8);
681 void cmpb(Operand op, Immediate imm8);
682 void cmpb(Register reg, Operand op);
683 void cmpb(Operand op, Register reg);
684 void cmpb(Register dst, Register src) { cmpb(Operand(dst), src); }
685 void cmpb_al(Operand op);
686 void cmpw_ax(Operand op);
687 void cmpw(Operand dst, Immediate src);
688 void cmpw(Register dst, Immediate src) { cmpw(Operand(dst), src); }
689 void cmpw(Register dst, Operand src);
690 void cmpw(Register dst, Register src) { cmpw(Operand(dst), src); }
691 void cmpw(Operand dst, Register src);
692 void cmp(Register reg, int32_t imm32);
693 void cmp(Register reg, Handle<HeapObject> handle);
694 void cmp(Register reg0, Register reg1) { cmp(reg0, Operand(reg1)); }
695 void cmp(Register reg, Operand op);
696 void cmp(Register reg,
const Immediate& imm) { cmp(Operand(reg), imm); }
697 void cmp(Operand op, Register reg);
698 void cmp(Operand op,
const Immediate& imm);
699 void cmp(Operand op, Handle<HeapObject> handle);
701 void dec_b(Register dst);
702 void dec_b(Operand dst);
704 void dec(Register dst);
705 void dec(Operand dst);
709 void idiv(Register src) { idiv(Operand(src)); }
710 void idiv(Operand src);
711 void div(Register src) { div(Operand(src)); }
712 void div(Operand src);
715 void imul(Register src);
716 void imul(Register dst, Register src) { imul(dst, Operand(src)); }
717 void imul(Register dst, Operand src);
718 void imul(Register dst, Register src, int32_t imm32);
719 void imul(Register dst, Operand src, int32_t imm32);
721 void inc(Register dst);
722 void inc(Operand dst);
724 void lea(Register dst, Operand src);
727 void mul(Register src);
729 void neg(Register dst);
730 void neg(Operand dst);
732 void not_(Register dst);
733 void not_(Operand dst);
735 void or_(Register dst, int32_t imm32);
736 void or_(Register dst, Register src) { or_(dst, Operand(src)); }
737 void or_(Register dst, Operand src);
738 void or_(Operand dst, Register src);
739 void or_(Register dst,
const Immediate& imm) { or_(Operand(dst), imm); }
740 void or_(Operand dst,
const Immediate& x);
742 void rcl(Register dst, uint8_t imm8);
743 void rcr(Register dst, uint8_t imm8);
745 void ror(Register dst, uint8_t imm8) { ror(Operand(dst), imm8); }
746 void ror(Operand dst, uint8_t imm8);
747 void ror_cl(Register dst) { ror_cl(Operand(dst)); }
748 void ror_cl(Operand dst);
750 void sar(Register dst, uint8_t imm8) { sar(Operand(dst), imm8); }
751 void sar(Operand dst, uint8_t imm8);
752 void sar_cl(Register dst) { sar_cl(Operand(dst)); }
753 void sar_cl(Operand dst);
755 void sbb(Register dst, Register src) { sbb(dst, Operand(src)); }
756 void sbb(Register dst, Operand src);
758 void shl(Register dst, uint8_t imm8) { shl(Operand(dst), imm8); }
759 void shl(Operand dst, uint8_t imm8);
760 void shl_cl(Register dst) { shl_cl(Operand(dst)); }
761 void shl_cl(Operand dst);
762 void shld(Register dst, Register src, uint8_t shift);
763 void shld_cl(Register dst, Register src);
765 void shr(Register dst, uint8_t imm8) { shr(Operand(dst), imm8); }
766 void shr(Operand dst, uint8_t imm8);
767 void shr_cl(Register dst) { shr_cl(Operand(dst)); }
768 void shr_cl(Operand dst);
769 void shrd(Register dst, Register src, uint8_t shift);
770 void shrd_cl(Register dst, Register src) { shrd_cl(Operand(dst), src); }
771 void shrd_cl(Operand dst, Register src);
773 void sub(Register dst,
const Immediate& imm) { sub(Operand(dst), imm); }
774 void sub(Operand dst,
const Immediate& x);
775 void sub(Register dst, Register src) { sub(dst, Operand(src)); }
776 void sub(Register dst, Operand src);
777 void sub(Operand dst, Register src);
780 void test(Register reg,
const Immediate& imm);
781 void test(Register reg0, Register reg1) { test(reg0, Operand(reg1)); }
782 void test(Register reg, Operand op);
783 void test(Operand op,
const Immediate& imm);
784 void test(Operand op, Register reg) { test(reg, op); }
785 void test_b(Register reg, Operand op);
786 void test_b(Register reg, Immediate imm8);
787 void test_b(Operand op, Immediate imm8);
788 void test_b(Operand op, Register reg) { test_b(reg, op); }
789 void test_b(Register dst, Register src) { test_b(dst, Operand(src)); }
790 void test_w(Register reg, Operand op);
791 void test_w(Register reg, Immediate imm16);
792 void test_w(Operand op, Immediate imm16);
793 void test_w(Operand op, Register reg) { test_w(reg, op); }
794 void test_w(Register dst, Register src) { test_w(dst, Operand(src)); }
796 void xor_(Register dst, int32_t imm32);
797 void xor_(Register dst, Register src) { xor_(dst, Operand(src)); }
798 void xor_(Register dst, Operand src);
799 void xor_(Operand dst, Register src);
800 void xor_(Register dst,
const Immediate& imm) { xor_(Operand(dst), imm); }
801 void xor_(Operand dst,
const Immediate& x);
804 void bswap(Register dst);
805 void bt(Operand dst, Register src);
806 void bts(Register dst, Register src) { bts(Operand(dst), src); }
807 void bts(Operand dst, Register src);
808 void bsr(Register dst, Register src) { bsr(dst, Operand(src)); }
809 void bsr(Register dst, Operand src);
810 void bsf(Register dst, Register src) { bsf(dst, Operand(src)); }
811 void bsf(Register dst, Operand src);
839 void call(Address entry, RelocInfo::Mode rmode);
840 void call(Register reg) { call(Operand(reg)); }
841 void call(Operand adr);
842 void call(Handle<Code> code, RelocInfo::Mode rmode);
843 void call(CodeStub* stub);
844 void wasm_call(Address address, RelocInfo::Mode rmode);
848 void jmp(Label* L, Label::Distance distance = Label::kFar);
849 void jmp(Address entry, RelocInfo::Mode rmode);
850 void jmp(Register reg) { jmp(Operand(reg)); }
851 void jmp(Operand adr);
852 void jmp(Handle<Code> code, RelocInfo::Mode rmode);
855 void jmp_rel(
int offset);
860 Label::Distance distance = Label::kFar);
861 void j(Condition cc, byte* entry, RelocInfo::Mode rmode);
862 void j(Condition cc, Handle<Code> code,
863 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET);
874 void fld_s(Operand adr);
875 void fld_d(Operand adr);
877 void fstp_s(Operand adr);
878 void fst_s(Operand adr);
879 void fstp_d(Operand adr);
880 void fst_d(Operand adr);
882 void fild_s(Operand adr);
883 void fild_d(Operand adr);
885 void fist_s(Operand adr);
887 void fistp_s(Operand adr);
888 void fistp_d(Operand adr);
891 void fisttp_s(Operand adr);
892 void fisttp_d(Operand adr);
913 void fisub_s(Operand adr);
915 void faddp(
int i = 1);
916 void fsubp(
int i = 1);
917 void fsubrp(
int i = 1);
918 void fmulp(
int i = 1);
919 void fdivp(
int i = 1);
923 void fxch(
int i = 1);
925 void ffree(
int i = 0);
940 void setcc(Condition cc, Register reg);
945 void addss(XMMRegister dst, XMMRegister src) { addss(dst, Operand(src)); }
946 void addss(XMMRegister dst, Operand src);
947 void subss(XMMRegister dst, XMMRegister src) { subss(dst, Operand(src)); }
948 void subss(XMMRegister dst, Operand src);
949 void mulss(XMMRegister dst, XMMRegister src) { mulss(dst, Operand(src)); }
950 void mulss(XMMRegister dst, Operand src);
951 void divss(XMMRegister dst, XMMRegister src) { divss(dst, Operand(src)); }
952 void divss(XMMRegister dst, Operand src);
953 void sqrtss(XMMRegister dst, XMMRegister src) { sqrtss(dst, Operand(src)); }
954 void sqrtss(XMMRegister dst, Operand src);
956 void ucomiss(XMMRegister dst, XMMRegister src) { ucomiss(dst, Operand(src)); }
957 void ucomiss(XMMRegister dst, Operand src);
958 void movaps(XMMRegister dst, XMMRegister src);
959 void movups(XMMRegister dst, XMMRegister src);
960 void movups(XMMRegister dst, Operand src);
961 void movups(Operand dst, XMMRegister src);
962 void shufps(XMMRegister dst, XMMRegister src, byte imm8);
964 void maxss(XMMRegister dst, XMMRegister src) { maxss(dst, Operand(src)); }
965 void maxss(XMMRegister dst, Operand src);
966 void minss(XMMRegister dst, XMMRegister src) { minss(dst, Operand(src)); }
967 void minss(XMMRegister dst, Operand src);
969 void andps(XMMRegister dst, Operand src);
970 void andps(XMMRegister dst, XMMRegister src) { andps(dst, Operand(src)); }
971 void xorps(XMMRegister dst, Operand src);
972 void xorps(XMMRegister dst, XMMRegister src) { xorps(dst, Operand(src)); }
973 void orps(XMMRegister dst, Operand src);
974 void orps(XMMRegister dst, XMMRegister src) { orps(dst, Operand(src)); }
976 void addps(XMMRegister dst, Operand src);
977 void addps(XMMRegister dst, XMMRegister src) { addps(dst, Operand(src)); }
978 void subps(XMMRegister dst, Operand src);
979 void subps(XMMRegister dst, XMMRegister src) { subps(dst, Operand(src)); }
980 void mulps(XMMRegister dst, Operand src);
981 void mulps(XMMRegister dst, XMMRegister src) { mulps(dst, Operand(src)); }
982 void divps(XMMRegister dst, Operand src);
983 void divps(XMMRegister dst, XMMRegister src) { divps(dst, Operand(src)); }
984 void rcpps(XMMRegister dst, Operand src);
985 void rcpps(XMMRegister dst, XMMRegister src) { rcpps(dst, Operand(src)); }
986 void rsqrtps(XMMRegister dst, Operand src);
987 void rsqrtps(XMMRegister dst, XMMRegister src) { rsqrtps(dst, Operand(src)); }
988 void haddps(XMMRegister dst, Operand src);
989 void haddps(XMMRegister dst, XMMRegister src) { haddps(dst, Operand(src)); }
991 void minps(XMMRegister dst, Operand src);
992 void minps(XMMRegister dst, XMMRegister src) { minps(dst, Operand(src)); }
993 void maxps(XMMRegister dst, Operand src);
994 void maxps(XMMRegister dst, XMMRegister src) { maxps(dst, Operand(src)); }
996 void cmpps(XMMRegister dst, Operand src, uint8_t cmp);
997 #define SSE_CMP_P(instr, imm8) \ 998 void instr##ps(XMMRegister dst, XMMRegister src) { \ 999 cmpps(dst, Operand(src), imm8); \ 1001 void instr##ps(XMMRegister dst, Operand src) { cmpps(dst, src, imm8); } 1003 SSE_CMP_P(cmpeq, 0x0);
1004 SSE_CMP_P(cmplt, 0x1);
1005 SSE_CMP_P(cmple, 0x2);
1006 SSE_CMP_P(cmpneq, 0x4);
1011 void cvttss2si(Register dst, Operand src);
1012 void cvttss2si(Register dst, XMMRegister src) {
1013 cvttss2si(dst, Operand(src));
1015 void cvttsd2si(Register dst, Operand src);
1016 void cvttsd2si(Register dst, XMMRegister src) {
1017 cvttsd2si(dst, Operand(src));
1019 void cvtsd2si(Register dst, XMMRegister src);
1021 void cvtsi2ss(XMMRegister dst, Register src) { cvtsi2ss(dst, Operand(src)); }
1022 void cvtsi2ss(XMMRegister dst, Operand src);
1023 void cvtsi2sd(XMMRegister dst, Register src) { cvtsi2sd(dst, Operand(src)); }
1024 void cvtsi2sd(XMMRegister dst, Operand src);
1025 void cvtss2sd(XMMRegister dst, Operand src);
1026 void cvtss2sd(XMMRegister dst, XMMRegister src) {
1027 cvtss2sd(dst, Operand(src));
1029 void cvtsd2ss(XMMRegister dst, Operand src);
1030 void cvtsd2ss(XMMRegister dst, XMMRegister src) {
1031 cvtsd2ss(dst, Operand(src));
1033 void cvtdq2ps(XMMRegister dst, XMMRegister src) {
1034 cvtdq2ps(dst, Operand(src));
1036 void cvtdq2ps(XMMRegister dst, Operand src);
1037 void cvttps2dq(XMMRegister dst, XMMRegister src) {
1038 cvttps2dq(dst, Operand(src));
1040 void cvttps2dq(XMMRegister dst, Operand src);
1042 void addsd(XMMRegister dst, XMMRegister src) { addsd(dst, Operand(src)); }
1043 void addsd(XMMRegister dst, Operand src);
1044 void subsd(XMMRegister dst, XMMRegister src) { subsd(dst, Operand(src)); }
1045 void subsd(XMMRegister dst, Operand src);
1046 void mulsd(XMMRegister dst, XMMRegister src) { mulsd(dst, Operand(src)); }
1047 void mulsd(XMMRegister dst, Operand src);
1048 void divsd(XMMRegister dst, XMMRegister src) { divsd(dst, Operand(src)); }
1049 void divsd(XMMRegister dst, Operand src);
1050 void xorpd(XMMRegister dst, XMMRegister src) { xorpd(dst, Operand(src)); }
1051 void xorpd(XMMRegister dst, Operand src);
1052 void sqrtsd(XMMRegister dst, XMMRegister src) { sqrtsd(dst, Operand(src)); }
1053 void sqrtsd(XMMRegister dst, Operand src);
1055 void andpd(XMMRegister dst, XMMRegister src) { andpd(dst, Operand(src)); }
1056 void andpd(XMMRegister dst, Operand src);
1057 void orpd(XMMRegister dst, XMMRegister src) { orpd(dst, Operand(src)); }
1058 void orpd(XMMRegister dst, Operand src);
1060 void ucomisd(XMMRegister dst, XMMRegister src) { ucomisd(dst, Operand(src)); }
1061 void ucomisd(XMMRegister dst, Operand src);
1063 void roundss(XMMRegister dst, XMMRegister src, RoundingMode mode);
1064 void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode);
1066 void movmskpd(Register dst, XMMRegister src);
1067 void movmskps(Register dst, XMMRegister src);
1069 void cmpltsd(XMMRegister dst, XMMRegister src);
1071 void maxsd(XMMRegister dst, XMMRegister src) { maxsd(dst, Operand(src)); }
1072 void maxsd(XMMRegister dst, Operand src);
1073 void minsd(XMMRegister dst, XMMRegister src) { minsd(dst, Operand(src)); }
1074 void minsd(XMMRegister dst, Operand src);
1076 void movdqa(XMMRegister dst, Operand src);
1077 void movdqa(Operand dst, XMMRegister src);
1078 void movdqu(XMMRegister dst, Operand src);
1079 void movdqu(Operand dst, XMMRegister src);
1080 void movdq(
bool aligned, XMMRegister dst, Operand src) {
1088 void movd(XMMRegister dst, Register src) { movd(dst, Operand(src)); }
1089 void movd(XMMRegister dst, Operand src);
1090 void movd(Register dst, XMMRegister src) { movd(Operand(dst), src); }
1091 void movd(Operand dst, XMMRegister src);
1092 void movsd(XMMRegister dst, XMMRegister src) { movsd(dst, Operand(src)); }
1093 void movsd(XMMRegister dst, Operand src);
1094 void movsd(Operand dst, XMMRegister src);
1096 void movss(XMMRegister dst, Operand src);
1097 void movss(Operand dst, XMMRegister src);
1098 void movss(XMMRegister dst, XMMRegister src) { movss(dst, Operand(src)); }
1099 void extractps(Register dst, XMMRegister src, byte imm8);
1101 void psllw(XMMRegister reg, uint8_t shift);
1102 void pslld(XMMRegister reg, uint8_t shift);
1103 void psrlw(XMMRegister reg, uint8_t shift);
1104 void psrld(XMMRegister reg, uint8_t shift);
1105 void psraw(XMMRegister reg, uint8_t shift);
1106 void psrad(XMMRegister reg, uint8_t shift);
1107 void psllq(XMMRegister reg, uint8_t shift);
1108 void psllq(XMMRegister dst, XMMRegister src);
1109 void psrlq(XMMRegister reg, uint8_t shift);
1110 void psrlq(XMMRegister dst, XMMRegister src);
1112 void pshufhw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1113 pshufhw(dst, Operand(src), shuffle);
1115 void pshufhw(XMMRegister dst, Operand src, uint8_t shuffle);
1116 void pshuflw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1117 pshuflw(dst, Operand(src), shuffle);
1119 void pshuflw(XMMRegister dst, Operand src, uint8_t shuffle);
1120 void pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1121 pshufd(dst, Operand(src), shuffle);
1123 void pshufd(XMMRegister dst, Operand src, uint8_t shuffle);
1125 void pblendw(XMMRegister dst, XMMRegister src, uint8_t mask) {
1126 pblendw(dst, Operand(src), mask);
1128 void pblendw(XMMRegister dst, Operand src, uint8_t mask);
1130 void palignr(XMMRegister dst, XMMRegister src, uint8_t mask) {
1131 palignr(dst, Operand(src), mask);
1133 void palignr(XMMRegister dst, Operand src, uint8_t mask);
1135 void pextrb(Register dst, XMMRegister src, uint8_t offset) {
1136 pextrb(Operand(dst), src, offset);
1138 void pextrb(Operand dst, XMMRegister src, uint8_t offset);
1140 void pextrw(Register dst, XMMRegister src, uint8_t offset) {
1141 pextrw(Operand(dst), src, offset);
1143 void pextrw(Operand dst, XMMRegister src, uint8_t offset);
1144 void pextrd(Register dst, XMMRegister src, uint8_t offset) {
1145 pextrd(Operand(dst), src, offset);
1147 void pextrd(Operand dst, XMMRegister src, uint8_t offset);
1149 void insertps(XMMRegister dst, XMMRegister src, uint8_t offset) {
1150 insertps(dst, Operand(src), offset);
1152 void insertps(XMMRegister dst, Operand src, uint8_t offset);
1153 void pinsrb(XMMRegister dst, Register src, uint8_t offset) {
1154 pinsrb(dst, Operand(src), offset);
1156 void pinsrb(XMMRegister dst, Operand src, uint8_t offset);
1157 void pinsrw(XMMRegister dst, Register src, uint8_t offset) {
1158 pinsrw(dst, Operand(src), offset);
1160 void pinsrw(XMMRegister dst, Operand src, uint8_t offset);
1161 void pinsrd(XMMRegister dst, Register src, uint8_t offset) {
1162 pinsrd(dst, Operand(src), offset);
1164 void pinsrd(XMMRegister dst, Operand src, uint8_t offset);
1167 void vfmadd132sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1168 vfmadd132sd(dst, src1, Operand(src2));
1170 void vfmadd213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1171 vfmadd213sd(dst, src1, Operand(src2));
1173 void vfmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1174 vfmadd231sd(dst, src1, Operand(src2));
1176 void vfmadd132sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1177 vfmasd(0x99, dst, src1, src2);
1179 void vfmadd213sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1180 vfmasd(0xa9, dst, src1, src2);
1182 void vfmadd231sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1183 vfmasd(0xb9, dst, src1, src2);
1185 void vfmsub132sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1186 vfmsub132sd(dst, src1, Operand(src2));
1188 void vfmsub213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1189 vfmsub213sd(dst, src1, Operand(src2));
1191 void vfmsub231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1192 vfmsub231sd(dst, src1, Operand(src2));
1194 void vfmsub132sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1195 vfmasd(0x9b, dst, src1, src2);
1197 void vfmsub213sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1198 vfmasd(0xab, dst, src1, src2);
1200 void vfmsub231sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1201 vfmasd(0xbb, dst, src1, src2);
1203 void vfnmadd132sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1204 vfnmadd132sd(dst, src1, Operand(src2));
1206 void vfnmadd213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1207 vfnmadd213sd(dst, src1, Operand(src2));
1209 void vfnmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1210 vfnmadd231sd(dst, src1, Operand(src2));
1212 void vfnmadd132sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1213 vfmasd(0x9d, dst, src1, src2);
1215 void vfnmadd213sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1216 vfmasd(0xad, dst, src1, src2);
1218 void vfnmadd231sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1219 vfmasd(0xbd, dst, src1, src2);
1221 void vfnmsub132sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1222 vfnmsub132sd(dst, src1, Operand(src2));
1224 void vfnmsub213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1225 vfnmsub213sd(dst, src1, Operand(src2));
1227 void vfnmsub231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1228 vfnmsub231sd(dst, src1, Operand(src2));
1230 void vfnmsub132sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1231 vfmasd(0x9f, dst, src1, src2);
1233 void vfnmsub213sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1234 vfmasd(0xaf, dst, src1, src2);
1236 void vfnmsub231sd(XMMRegister dst, XMMRegister src1, Operand src2) {
1237 vfmasd(0xbf, dst, src1, src2);
1239 void vfmasd(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1241 void vfmadd132ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1242 vfmadd132ss(dst, src1, Operand(src2));
1244 void vfmadd213ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1245 vfmadd213ss(dst, src1, Operand(src2));
1247 void vfmadd231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1248 vfmadd231ss(dst, src1, Operand(src2));
1250 void vfmadd132ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1251 vfmass(0x99, dst, src1, src2);
1253 void vfmadd213ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1254 vfmass(0xa9, dst, src1, src2);
1256 void vfmadd231ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1257 vfmass(0xb9, dst, src1, src2);
1259 void vfmsub132ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1260 vfmsub132ss(dst, src1, Operand(src2));
1262 void vfmsub213ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1263 vfmsub213ss(dst, src1, Operand(src2));
1265 void vfmsub231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1266 vfmsub231ss(dst, src1, Operand(src2));
1268 void vfmsub132ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1269 vfmass(0x9b, dst, src1, src2);
1271 void vfmsub213ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1272 vfmass(0xab, dst, src1, src2);
1274 void vfmsub231ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1275 vfmass(0xbb, dst, src1, src2);
1277 void vfnmadd132ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1278 vfnmadd132ss(dst, src1, Operand(src2));
1280 void vfnmadd213ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1281 vfnmadd213ss(dst, src1, Operand(src2));
1283 void vfnmadd231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1284 vfnmadd231ss(dst, src1, Operand(src2));
1286 void vfnmadd132ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1287 vfmass(0x9d, dst, src1, src2);
1289 void vfnmadd213ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1290 vfmass(0xad, dst, src1, src2);
1292 void vfnmadd231ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1293 vfmass(0xbd, dst, src1, src2);
1295 void vfnmsub132ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1296 vfnmsub132ss(dst, src1, Operand(src2));
1298 void vfnmsub213ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1299 vfnmsub213ss(dst, src1, Operand(src2));
1301 void vfnmsub231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1302 vfnmsub231ss(dst, src1, Operand(src2));
1304 void vfnmsub132ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1305 vfmass(0x9f, dst, src1, src2);
1307 void vfnmsub213ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1308 vfmass(0xaf, dst, src1, src2);
1310 void vfnmsub231ss(XMMRegister dst, XMMRegister src1, Operand src2) {
1311 vfmass(0xbf, dst, src1, src2);
1313 void vfmass(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1315 void vaddsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1316 vaddsd(dst, src1, Operand(src2));
1318 void vaddsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1319 vsd(0x58, dst, src1, src2);
1321 void vsubsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1322 vsubsd(dst, src1, Operand(src2));
1324 void vsubsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1325 vsd(0x5c, dst, src1, src2);
1327 void vmulsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1328 vmulsd(dst, src1, Operand(src2));
1330 void vmulsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1331 vsd(0x59, dst, src1, src2);
1333 void vdivsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1334 vdivsd(dst, src1, Operand(src2));
1336 void vdivsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1337 vsd(0x5e, dst, src1, src2);
1339 void vmaxsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1340 vmaxsd(dst, src1, Operand(src2));
1342 void vmaxsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1343 vsd(0x5f, dst, src1, src2);
1345 void vminsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1346 vminsd(dst, src1, Operand(src2));
1348 void vminsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1349 vsd(0x5d, dst, src1, src2);
1351 void vsqrtsd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1352 vsqrtsd(dst, src1, Operand(src2));
1354 void vsqrtsd(XMMRegister dst, XMMRegister src1, Operand src2) {
1355 vsd(0x51, dst, src1, src2);
1357 void vsd(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1359 void vaddss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1360 vaddss(dst, src1, Operand(src2));
1362 void vaddss(XMMRegister dst, XMMRegister src1, Operand src2) {
1363 vss(0x58, dst, src1, src2);
1365 void vsubss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1366 vsubss(dst, src1, Operand(src2));
1368 void vsubss(XMMRegister dst, XMMRegister src1, Operand src2) {
1369 vss(0x5c, dst, src1, src2);
1371 void vmulss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1372 vmulss(dst, src1, Operand(src2));
1374 void vmulss(XMMRegister dst, XMMRegister src1, Operand src2) {
1375 vss(0x59, dst, src1, src2);
1377 void vdivss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1378 vdivss(dst, src1, Operand(src2));
1380 void vdivss(XMMRegister dst, XMMRegister src1, Operand src2) {
1381 vss(0x5e, dst, src1, src2);
1383 void vmaxss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1384 vmaxss(dst, src1, Operand(src2));
1386 void vmaxss(XMMRegister dst, XMMRegister src1, Operand src2) {
1387 vss(0x5f, dst, src1, src2);
1389 void vminss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1390 vminss(dst, src1, Operand(src2));
1392 void vminss(XMMRegister dst, XMMRegister src1, Operand src2) {
1393 vss(0x5d, dst, src1, src2);
1395 void vsqrtss(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1396 vsqrtss(dst, src1, Operand(src2));
1398 void vsqrtss(XMMRegister dst, XMMRegister src1, Operand src2) {
1399 vss(0x51, dst, src1, src2);
1401 void vss(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1403 void vrcpps(XMMRegister dst, XMMRegister src) { vrcpps(dst, Operand(src)); }
1404 void vrcpps(XMMRegister dst, Operand src) {
1405 vinstr(0x53, dst, xmm0, src, kNone, k0F, kWIG);
1407 void vrsqrtps(XMMRegister dst, XMMRegister src) {
1408 vrsqrtps(dst, Operand(src));
1410 void vrsqrtps(XMMRegister dst, Operand src) {
1411 vinstr(0x52, dst, xmm0, src, kNone, k0F, kWIG);
1413 void vhaddps(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
1414 vhaddps(dst, src1, Operand(src2));
1416 void vhaddps(XMMRegister dst, XMMRegister src1, Operand src2) {
1417 vinstr(0x7C, dst, src1, src2, kF2, k0F, kWIG);
1419 void vmovaps(XMMRegister dst, XMMRegister src) {
1420 vps(0x28, dst, xmm0, Operand(src));
1422 void vshufps(XMMRegister dst, XMMRegister src1, XMMRegister src2, byte imm8) {
1423 vshufps(dst, src1, Operand(src2), imm8);
1425 void vshufps(XMMRegister dst, XMMRegister src1, Operand src2, byte imm8);
1427 void vpsllw(XMMRegister dst, XMMRegister src, uint8_t imm8);
1428 void vpslld(XMMRegister dst, XMMRegister src, uint8_t imm8);
1429 void vpsrlw(XMMRegister dst, XMMRegister src, uint8_t imm8);
1430 void vpsrld(XMMRegister dst, XMMRegister src, uint8_t imm8);
1431 void vpsraw(XMMRegister dst, XMMRegister src, uint8_t imm8);
1432 void vpsrad(XMMRegister dst, XMMRegister src, uint8_t imm8);
1434 void vpshufhw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1435 vpshufhw(dst, Operand(src), shuffle);
1437 void vpshufhw(XMMRegister dst, Operand src, uint8_t shuffle);
1438 void vpshuflw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1439 vpshuflw(dst, Operand(src), shuffle);
1441 void vpshuflw(XMMRegister dst, Operand src, uint8_t shuffle);
1442 void vpshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
1443 vpshufd(dst, Operand(src), shuffle);
1445 void vpshufd(XMMRegister dst, Operand src, uint8_t shuffle);
1447 void vpblendw(XMMRegister dst, XMMRegister src1, XMMRegister src2,
1449 vpblendw(dst, src1, Operand(src2), mask);
1451 void vpblendw(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t mask);
1453 void vpalignr(XMMRegister dst, XMMRegister src1, XMMRegister src2,
1455 vpalignr(dst, src1, Operand(src2), mask);
1457 void vpalignr(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t mask);
1459 void vpextrb(Register dst, XMMRegister src, uint8_t offset) {
1460 vpextrb(Operand(dst), src, offset);
1462 void vpextrb(Operand dst, XMMRegister src, uint8_t offset);
1463 void vpextrw(Register dst, XMMRegister src, uint8_t offset) {
1464 vpextrw(Operand(dst), src, offset);
1466 void vpextrw(Operand dst, XMMRegister src, uint8_t offset);
1467 void vpextrd(Register dst, XMMRegister src, uint8_t offset) {
1468 vpextrd(Operand(dst), src, offset);
1470 void vpextrd(Operand dst, XMMRegister src, uint8_t offset);
1472 void vinsertps(XMMRegister dst, XMMRegister src1, XMMRegister src2,
1474 vinsertps(dst, src1, Operand(src2), offset);
1476 void vinsertps(XMMRegister dst, XMMRegister src1, Operand src2,
1478 void vpinsrb(XMMRegister dst, XMMRegister src1, Register src2,
1480 vpinsrb(dst, src1, Operand(src2), offset);
1482 void vpinsrb(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t offset);
1483 void vpinsrw(XMMRegister dst, XMMRegister src1, Register src2,
1485 vpinsrw(dst, src1, Operand(src2), offset);
1487 void vpinsrw(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t offset);
1488 void vpinsrd(XMMRegister dst, XMMRegister src1, Register src2,
1490 vpinsrd(dst, src1, Operand(src2), offset);
1492 void vpinsrd(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t offset);
1494 void vcvtdq2ps(XMMRegister dst, XMMRegister src) {
1495 vcvtdq2ps(dst, Operand(src));
1497 void vcvtdq2ps(XMMRegister dst, Operand src) {
1498 vinstr(0x5B, dst, xmm0, src, kNone, k0F, kWIG);
1500 void vcvttps2dq(XMMRegister dst, XMMRegister src) {
1501 vcvttps2dq(dst, Operand(src));
1503 void vcvttps2dq(XMMRegister dst, Operand src) {
1504 vinstr(0x5B, dst, xmm0, src, kF3, k0F, kWIG);
1507 void vmovdqu(XMMRegister dst, Operand src) {
1508 vinstr(0x6F, dst, xmm0, src, kF3, k0F, kWIG);
1510 void vmovdqu(Operand dst, XMMRegister src) {
1511 vinstr(0x7F, src, xmm0, dst, kF3, k0F, kWIG);
1513 void vmovd(XMMRegister dst, Register src) { vmovd(dst, Operand(src)); }
1514 void vmovd(XMMRegister dst, Operand src) {
1515 vinstr(0x6E, dst, xmm0, src, k66, k0F, kWIG);
1517 void vmovd(Register dst, XMMRegister src) { movd(Operand(dst), src); }
1518 void vmovd(Operand dst, XMMRegister src) {
1519 vinstr(0x7E, src, xmm0, dst, k66, k0F, kWIG);
1523 void andn(Register dst, Register src1, Register src2) {
1524 andn(dst, src1, Operand(src2));
1526 void andn(Register dst, Register src1, Operand src2) {
1527 bmi1(0xf2, dst, src1, src2);
1529 void bextr(Register dst, Register src1, Register src2) {
1530 bextr(dst, Operand(src1), src2);
1532 void bextr(Register dst, Operand src1, Register src2) {
1533 bmi1(0xf7, dst, src2, src1);
1535 void blsi(Register dst, Register src) { blsi(dst, Operand(src)); }
1536 void blsi(Register dst, Operand src) { bmi1(0xf3, ebx, dst, src); }
1537 void blsmsk(Register dst, Register src) { blsmsk(dst, Operand(src)); }
1538 void blsmsk(Register dst, Operand src) { bmi1(0xf3, edx, dst, src); }
1539 void blsr(Register dst, Register src) { blsr(dst, Operand(src)); }
1540 void blsr(Register dst, Operand src) { bmi1(0xf3, ecx, dst, src); }
1541 void tzcnt(Register dst, Register src) { tzcnt(dst, Operand(src)); }
1542 void tzcnt(Register dst, Operand src);
1544 void lzcnt(Register dst, Register src) { lzcnt(dst, Operand(src)); }
1545 void lzcnt(Register dst, Operand src);
1547 void popcnt(Register dst, Register src) { popcnt(dst, Operand(src)); }
1548 void popcnt(Register dst, Operand src);
1550 void bzhi(Register dst, Register src1, Register src2) {
1551 bzhi(dst, Operand(src1), src2);
1553 void bzhi(Register dst, Operand src1, Register src2) {
1554 bmi2(kNone, 0xf5, dst, src2, src1);
1556 void mulx(Register dst1, Register dst2, Register src) {
1557 mulx(dst1, dst2, Operand(src));
1559 void mulx(Register dst1, Register dst2, Operand src) {
1560 bmi2(kF2, 0xf6, dst1, dst2, src);
1562 void pdep(Register dst, Register src1, Register src2) {
1563 pdep(dst, src1, Operand(src2));
1565 void pdep(Register dst, Register src1, Operand src2) {
1566 bmi2(kF2, 0xf5, dst, src1, src2);
1568 void pext(Register dst, Register src1, Register src2) {
1569 pext(dst, src1, Operand(src2));
1571 void pext(Register dst, Register src1, Operand src2) {
1572 bmi2(kF3, 0xf5, dst, src1, src2);
1574 void sarx(Register dst, Register src1, Register src2) {
1575 sarx(dst, Operand(src1), src2);
1577 void sarx(Register dst, Operand src1, Register src2) {
1578 bmi2(kF3, 0xf7, dst, src2, src1);
1580 void shlx(Register dst, Register src1, Register src2) {
1581 shlx(dst, Operand(src1), src2);
1583 void shlx(Register dst, Operand src1, Register src2) {
1584 bmi2(k66, 0xf7, dst, src2, src1);
1586 void shrx(Register dst, Register src1, Register src2) {
1587 shrx(dst, Operand(src1), src2);
1589 void shrx(Register dst, Operand src1, Register src2) {
1590 bmi2(kF2, 0xf7, dst, src2, src1);
1592 void rorx(Register dst, Register src, byte imm8) {
1593 rorx(dst, Operand(src), imm8);
1595 void rorx(Register dst, Operand src, byte imm8);
1597 #define PACKED_OP_LIST(V) \ 1607 #define AVX_PACKED_OP_DECLARE(name, opcode) \ 1608 void v##name##ps(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \ 1609 vps(opcode, dst, src1, Operand(src2)); \ 1611 void v##name##ps(XMMRegister dst, XMMRegister src1, Operand src2) { \ 1612 vps(opcode, dst, src1, src2); \ 1614 void v##name##pd(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \ 1615 vpd(opcode, dst, src1, Operand(src2)); \ 1617 void v##name##pd(XMMRegister dst, XMMRegister src1, Operand src2) { \ 1618 vpd(opcode, dst, src1, src2); \ 1621 PACKED_OP_LIST(AVX_PACKED_OP_DECLARE);
1622 void vps(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1623 void vpd(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
1625 void vcmpps(XMMRegister dst, XMMRegister src1, Operand src2, uint8_t cmp);
1626 #define AVX_CMP_P(instr, imm8) \ 1627 void instr##ps(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \ 1628 vcmpps(dst, src1, Operand(src2), imm8); \ 1630 void instr##ps(XMMRegister dst, XMMRegister src1, Operand src2) { \ 1631 vcmpps(dst, src1, src2, imm8); \ 1634 AVX_CMP_P(vcmpeq, 0x0);
1635 AVX_CMP_P(vcmplt, 0x1);
1636 AVX_CMP_P(vcmple, 0x2);
1637 AVX_CMP_P(vcmpneq, 0x4);
1642 #define DECLARE_SSE2_INSTRUCTION(instruction, prefix, escape, opcode) \ 1643 void instruction(XMMRegister dst, XMMRegister src) { \ 1644 instruction(dst, Operand(src)); \ 1646 void instruction(XMMRegister dst, Operand src) { \ 1647 sse2_instr(dst, src, 0x##prefix, 0x##escape, 0x##opcode); \ 1650 SSE2_INSTRUCTION_LIST(DECLARE_SSE2_INSTRUCTION)
1651 #undef DECLARE_SSE2_INSTRUCTION 1653 #define DECLARE_SSE2_AVX_INSTRUCTION(instruction, prefix, escape, opcode) \ 1654 void v##instruction(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \ 1655 v##instruction(dst, src1, Operand(src2)); \ 1657 void v##instruction(XMMRegister dst, XMMRegister src1, Operand src2) { \ 1658 vinstr(0x##opcode, dst, src1, src2, k##prefix, k##escape, kW0); \ 1661 SSE2_INSTRUCTION_LIST(DECLARE_SSE2_AVX_INSTRUCTION)
1662 #undef DECLARE_SSE2_AVX_INSTRUCTION 1664 #define DECLARE_SSSE3_INSTRUCTION(instruction, prefix, escape1, escape2, \ 1666 void instruction(XMMRegister dst, XMMRegister src) { \ 1667 instruction(dst, Operand(src)); \ 1669 void instruction(XMMRegister dst, Operand src) { \ 1670 ssse3_instr(dst, src, 0x##prefix, 0x##escape1, 0x##escape2, 0x##opcode); \ 1673 SSSE3_INSTRUCTION_LIST(DECLARE_SSSE3_INSTRUCTION)
1674 #undef DECLARE_SSSE3_INSTRUCTION 1676 #define DECLARE_SSE4_INSTRUCTION(instruction, prefix, escape1, escape2, \ 1678 void instruction(XMMRegister dst, XMMRegister src) { \ 1679 instruction(dst, Operand(src)); \ 1681 void instruction(XMMRegister dst, Operand src) { \ 1682 sse4_instr(dst, src, 0x##prefix, 0x##escape1, 0x##escape2, 0x##opcode); \ 1685 SSE4_INSTRUCTION_LIST(DECLARE_SSE4_INSTRUCTION)
1686 SSE4_RM_INSTRUCTION_LIST(DECLARE_SSE4_INSTRUCTION)
1687 #undef DECLARE_SSE4_INSTRUCTION 1689 #define DECLARE_SSE34_AVX_INSTRUCTION(instruction, prefix, escape1, escape2, \ 1691 void v##instruction(XMMRegister dst, XMMRegister src1, XMMRegister src2) { \ 1692 v##instruction(dst, src1, Operand(src2)); \ 1694 void v##instruction(XMMRegister dst, XMMRegister src1, Operand src2) { \ 1695 vinstr(0x##opcode, dst, src1, src2, k##prefix, k##escape1##escape2, kW0); \ 1698 SSSE3_INSTRUCTION_LIST(DECLARE_SSE34_AVX_INSTRUCTION)
1699 SSE4_INSTRUCTION_LIST(DECLARE_SSE34_AVX_INSTRUCTION)
1700 #undef DECLARE_SSE34_AVX_INSTRUCTION 1702 #define DECLARE_SSE4_AVX_RM_INSTRUCTION(instruction, prefix, escape1, escape2, \ 1704 void v##instruction(XMMRegister dst, XMMRegister src) { \ 1705 v##instruction(dst, Operand(src)); \ 1707 void v##instruction(XMMRegister dst, Operand src) { \ 1708 vinstr(0x##opcode, dst, xmm0, src, k##prefix, k##escape1##escape2, kW0); \ 1711 SSE4_RM_INSTRUCTION_LIST(DECLARE_SSE4_AVX_RM_INSTRUCTION)
1712 #undef DECLARE_SSE4_AVX_RM_INSTRUCTION 1717 void prefetch(Operand src,
int level);
1721 int SizeOfCodeGeneratedSince(Label* label) {
1722 return pc_offset() - label->pos();
1726 void RecordComment(
const char* msg);
1730 void RecordDeoptReason(DeoptimizeReason reason, SourcePosition position,
1735 void db(uint8_t data);
1737 void dq(uint64_t data);
1739 void dd(Label* label);
1744 inline bool buffer_overflow()
const {
1745 return pc_ >= reloc_info_writer.pos() - kGap;
1749 inline int available_space()
const {
return reloc_info_writer.pos() - pc_; }
1751 static bool IsNop(Address addr);
1753 int relocation_writer_size() {
1754 return (buffer_ + buffer_size_) - reloc_info_writer.pos();
1758 static constexpr
int kMaximalBufferSize = 512 * MB;
1760 byte byte_at(
int pos) {
return buffer_[pos]; }
1761 void set_byte_at(
int pos, byte value) { buffer_[pos] = value; }
1764 void emit_sse_operand(XMMRegister reg, Operand adr);
1765 void emit_sse_operand(XMMRegister dst, XMMRegister src);
1766 void emit_sse_operand(Register dst, XMMRegister src);
1767 void emit_sse_operand(XMMRegister dst, Register src);
1769 byte* addr_at(
int pos) {
return buffer_ + pos; }
1773 return *
reinterpret_cast<uint32_t*
>(addr_at(pos));
1775 void long_at_put(
int pos,
uint32_t x) {
1776 *
reinterpret_cast<uint32_t*
>(addr_at(pos)) = x;
1782 inline void emit(Handle<HeapObject> handle);
1783 inline void emit(
uint32_t x, RelocInfo::Mode rmode);
1784 inline void emit(Handle<Code> code, RelocInfo::Mode rmode);
1785 inline void emit(
const Immediate& x);
1786 inline void emit_b(Immediate x);
1787 inline void emit_w(
const Immediate& x);
1788 inline void emit_q(uint64_t x);
1791 inline void emit_code_relative_offset(Label* label);
1794 void emit_arith_b(
int op1,
int op2, Register dst,
int imm8);
1800 void emit_arith(
int sel, Operand dst,
const Immediate& x);
1802 void emit_operand(
int code, Operand adr);
1803 void emit_operand(Register reg, Operand adr);
1804 void emit_operand(XMMRegister reg, Operand adr);
1806 void emit_label(Label* label);
1808 void emit_farith(
int b1,
int b2,
int i);
1811 enum SIMDPrefix {
kNone = 0x0, k66 = 0x1, kF3 = 0x2, kF2 = 0x3 };
1812 enum VectorLength { kL128 = 0x0, kL256 = 0x4, kLIG = kL128, kLZ = kL128 };
1813 enum VexW { kW0 = 0x0, kW1 = 0x80, kWIG = kW0 };
1814 enum LeadingOpcode { k0F = 0x1, k0F38 = 0x2, k0F3A = 0x3 };
1815 inline void emit_vex_prefix(XMMRegister v, VectorLength l, SIMDPrefix pp,
1816 LeadingOpcode m, VexW w);
1817 inline void emit_vex_prefix(Register v, VectorLength l, SIMDPrefix pp,
1818 LeadingOpcode m, VexW w);
1821 void print(
const Label* L);
1822 void bind_to(Label* L,
int pos);
1825 inline Displacement disp_at(Label* L);
1826 inline void disp_at_put(Label* L, Displacement disp);
1827 inline void emit_disp(Label* L, Displacement::Type type);
1828 inline void emit_near_disp(Label* L);
1830 void sse2_instr(XMMRegister dst, Operand src, byte prefix, byte escape,
1832 void ssse3_instr(XMMRegister dst, Operand src, byte prefix, byte escape1,
1833 byte escape2, byte opcode);
1834 void sse4_instr(XMMRegister dst, Operand src, byte prefix, byte escape1,
1835 byte escape2, byte opcode);
1836 void vinstr(byte op, XMMRegister dst, XMMRegister src1, Operand src2,
1837 SIMDPrefix pp, LeadingOpcode m, VexW w);
1839 void bmi1(byte op, Register reg, Register vreg, Operand rm);
1840 void bmi2(SIMDPrefix pp, byte op, Register reg, Register vreg, Operand rm);
1843 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
1846 void record_farjmp_position(Label* L,
int pos);
1848 bool is_optimizable_farjmp(
int idx);
1850 void AllocateAndInstallRequestedHeapObjects(Isolate* isolate);
1852 friend class EnsureSpace;
1857 std::deque<int> internal_reference_positions_;
1860 RelocInfoWriter reloc_info_writer;
1863 int farjmp_num_ = 0;
1864 std::deque<int> farjmp_positions_;
1865 std::map<Label*, std::vector<int>> label_farjmp_maps_;
1875 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) {
1876 if (assembler_->buffer_overflow()) assembler_->GrowBuffer();
1878 space_before_ = assembler_->available_space();
1884 int bytes_generated = space_before_ - assembler_->available_space();
1885 DCHECK(bytes_generated < assembler_->kGap);
1890 Assembler* assembler_;
1897 DEFINE_REGISTER_NAMES(Register, GENERAL_REGISTERS)
1898 DEFINE_REGISTER_NAMES(XMMRegister, DOUBLE_REGISTERS)
1903 #endif // V8_IA32_ASSEMBLER_IA32_H_