Lines Matching refs:p

91    debug_printf( "\n%4x %14s ", p->csr - p->store, foo );             \
139 static void do_realloc( struct x86_function *p ) in do_realloc() argument
141 if (p->store == p->error_overflow) { in do_realloc()
142 p->csr = p->store; in do_realloc()
144 else if (p->size == 0) { in do_realloc()
145 p->size = 1024; in do_realloc()
146 p->store = rtasm_exec_malloc(p->size); in do_realloc()
147 p->csr = p->store; in do_realloc()
150 uintptr_t used = pointer_to_uintptr( p->csr ) - pointer_to_uintptr( p->store ); in do_realloc()
151 unsigned char *tmp = p->store; in do_realloc()
152 p->size *= 2; in do_realloc()
153 p->store = rtasm_exec_malloc(p->size); in do_realloc()
155 if (p->store) { in do_realloc()
156 memcpy(p->store, tmp, used); in do_realloc()
157 p->csr = p->store + used; in do_realloc()
160 p->csr = p->store; in do_realloc()
166 if (p->store == NULL) { in do_realloc()
167 p->store = p->csr = p->error_overflow; in do_realloc()
168 p->size = sizeof(p->error_overflow); in do_realloc()
174 static unsigned char *reserve( struct x86_function *p, int bytes ) in reserve() argument
176 if (p->csr + bytes - p->store > (int) p->size) in reserve()
177 do_realloc(p); in reserve()
180 unsigned char *csr = p->csr; in reserve()
181 p->csr += bytes; in reserve()
188 static void emit_1b( struct x86_function *p, char b0 ) in emit_1b() argument
190 char *csr = (char *)reserve(p, 1); in emit_1b()
194 static void emit_1i( struct x86_function *p, int i0 ) in emit_1i() argument
196 int *icsr = (int *)reserve(p, sizeof(i0)); in emit_1i()
200 static void emit_1ub( struct x86_function *p, unsigned char b0 ) in emit_1ub() argument
202 unsigned char *csr = reserve(p, 1); in emit_1ub()
206 static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) in emit_2ub() argument
208 unsigned char *csr = reserve(p, 2); in emit_2ub()
213 static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) in emit_3ub() argument
215 unsigned char *csr = reserve(p, 3); in emit_3ub()
227 static void emit_modrm( struct x86_function *p, in emit_modrm() argument
243 emit_1ub(p, val); in emit_modrm()
250 emit_1ub(p, 0x24); /* simplistic! */ in emit_modrm()
258 emit_1b(p, (char) regmem.disp); in emit_modrm()
261 emit_1i(p, regmem.disp); in emit_modrm()
271 static void emit_modrm_noreg( struct x86_function *p, in emit_modrm_noreg() argument
276 emit_modrm(p, dummy, regmem); in emit_modrm_noreg()
284 static void emit_op_modrm( struct x86_function *p, in emit_op_modrm() argument
292 emit_1ub(p, op_dst_is_reg); in emit_op_modrm()
293 emit_modrm(p, dst, src); in emit_op_modrm()
299 emit_1ub(p, op_dst_is_mem); in emit_op_modrm()
300 emit_modrm(p, src, dst); in emit_op_modrm()
359 int x86_get_label( struct x86_function *p ) in x86_get_label() argument
361 return p->csr - p->store; in x86_get_label()
371 void x64_rexw(struct x86_function *p) in x64_rexw() argument
373 if(x86_target(p) != X86_32) in x64_rexw()
374 emit_1ub(p, 0x48); in x64_rexw()
377 void x86_jcc( struct x86_function *p, in x86_jcc() argument
381 int offset = label - (x86_get_label(p) + 2); in x86_jcc()
386 if (p->csr - p->store <= -offset) { in x86_jcc()
393 emit_1ub(p, 0x70 + cc); in x86_jcc()
394 emit_1b(p, (char) offset); in x86_jcc()
397 offset = label - (x86_get_label(p) + 6); in x86_jcc()
398 emit_2ub(p, 0x0f, 0x80 + cc); in x86_jcc()
399 emit_1i(p, offset); in x86_jcc()
405 int x86_jcc_forward( struct x86_function *p, in x86_jcc_forward() argument
409 emit_2ub(p, 0x0f, 0x80 + cc); in x86_jcc_forward()
410 emit_1i(p, 0); in x86_jcc_forward()
411 return x86_get_label(p); in x86_jcc_forward()
414 int x86_jmp_forward( struct x86_function *p) in x86_jmp_forward() argument
417 emit_1ub(p, 0xe9); in x86_jmp_forward()
418 emit_1i(p, 0); in x86_jmp_forward()
419 return x86_get_label(p); in x86_jmp_forward()
422 int x86_call_forward( struct x86_function *p) in x86_call_forward() argument
426 emit_1ub(p, 0xe8); in x86_call_forward()
427 emit_1i(p, 0); in x86_call_forward()
428 return x86_get_label(p); in x86_call_forward()
433 void x86_fixup_fwd_jump( struct x86_function *p, in x86_fixup_fwd_jump() argument
436 *(int *)(p->store + fixup - 4) = x86_get_label(p) - fixup; in x86_fixup_fwd_jump()
439 void x86_jmp( struct x86_function *p, int label) in x86_jmp() argument
442 emit_1ub(p, 0xe9); in x86_jmp()
443 emit_1i(p, label - x86_get_label(p) - 4); in x86_jmp()
446 void x86_call( struct x86_function *p, struct x86_reg reg) in x86_call() argument
449 emit_1ub(p, 0xff); in x86_call()
450 emit_modrm_noreg(p, 2, reg); in x86_call()
454 void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_mov_reg_imm() argument
459 emit_1ub(p, 0xb8 + dst.idx); in x86_mov_reg_imm()
460 emit_1i(p, imm); in x86_mov_reg_imm()
463 void x86_mov_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_mov_imm() argument
467 x86_mov_reg_imm(p, dst, imm); in x86_mov_imm()
470 emit_1ub(p, 0xc7); in x86_mov_imm()
471 emit_modrm_noreg(p, 0, dst); in x86_mov_imm()
472 emit_1i(p, imm); in x86_mov_imm()
476 void x86_mov16_imm( struct x86_function *p, struct x86_reg dst, uint16_t imm ) in x86_mov16_imm() argument
479 emit_1ub(p, 0x66); in x86_mov16_imm()
482 emit_1ub(p, 0xb8 + dst.idx); in x86_mov16_imm()
483 emit_2ub(p, imm & 0xff, imm >> 8); in x86_mov16_imm()
487 emit_1ub(p, 0xc7); in x86_mov16_imm()
488 emit_modrm_noreg(p, 0, dst); in x86_mov16_imm()
489 emit_2ub(p, imm & 0xff, imm >> 8); in x86_mov16_imm()
493 void x86_mov8_imm( struct x86_function *p, struct x86_reg dst, uint8_t imm ) in x86_mov8_imm() argument
498 emit_1ub(p, 0xb0 + dst.idx); in x86_mov8_imm()
499 emit_1ub(p, imm); in x86_mov8_imm()
503 emit_1ub(p, 0xc6); in x86_mov8_imm()
504 emit_modrm_noreg(p, 0, dst); in x86_mov8_imm()
505 emit_1ub(p, imm); in x86_mov8_imm()
513 x86_group1_imm( struct x86_function *p, in x86_group1_imm() argument
519 emit_1ub(p, 0x83); in x86_group1_imm()
520 emit_modrm_noreg(p, op, dst); in x86_group1_imm()
521 emit_1b(p, (char)imm); in x86_group1_imm()
524 emit_1ub(p, 0x81); in x86_group1_imm()
525 emit_modrm_noreg(p, op, dst); in x86_group1_imm()
526 emit_1i(p, imm); in x86_group1_imm()
530 void x86_add_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_add_imm() argument
533 x86_group1_imm(p, 0, dst, imm); in x86_add_imm()
536 void x86_or_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_or_imm() argument
539 x86_group1_imm(p, 1, dst, imm); in x86_or_imm()
542 void x86_and_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_and_imm() argument
545 x86_group1_imm(p, 4, dst, imm); in x86_and_imm()
548 void x86_sub_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_sub_imm() argument
551 x86_group1_imm(p, 5, dst, imm); in x86_sub_imm()
554 void x86_xor_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_xor_imm() argument
557 x86_group1_imm(p, 6, dst, imm); in x86_xor_imm()
560 void x86_cmp_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_cmp_imm() argument
563 x86_group1_imm(p, 7, dst, imm); in x86_cmp_imm()
567 void x86_push( struct x86_function *p, in x86_push() argument
572 emit_1ub(p, 0x50 + reg.idx); in x86_push()
575 emit_1ub(p, 0xff); in x86_push()
576 emit_modrm_noreg(p, 6, reg); in x86_push()
580 p->stack_offset += sizeof(void*); in x86_push()
583 void x86_push_imm32( struct x86_function *p, in x86_push_imm32() argument
587 emit_1ub(p, 0x68); in x86_push_imm32()
588 emit_1i(p, imm32); in x86_push_imm32()
590 p->stack_offset += sizeof(void*); in x86_push_imm32()
594 void x86_pop( struct x86_function *p, in x86_pop() argument
599 emit_1ub(p, 0x58 + reg.idx); in x86_pop()
600 p->stack_offset -= sizeof(void*); in x86_pop()
603 void x86_inc( struct x86_function *p, in x86_inc() argument
607 if(x86_target(p) == X86_32 && reg.mod == mod_REG) in x86_inc()
609 emit_1ub(p, 0x40 + reg.idx); in x86_inc()
612 emit_1ub(p, 0xff); in x86_inc()
613 emit_modrm_noreg(p, 0, reg); in x86_inc()
616 void x86_dec( struct x86_function *p, in x86_dec() argument
620 if(x86_target(p) == X86_32 && reg.mod == mod_REG) in x86_dec()
622 emit_1ub(p, 0x48 + reg.idx); in x86_dec()
625 emit_1ub(p, 0xff); in x86_dec()
626 emit_modrm_noreg(p, 1, reg); in x86_dec()
629 void x86_ret( struct x86_function *p ) in x86_ret() argument
632 assert(p->stack_offset == 0); in x86_ret()
633 emit_1ub(p, 0xc3); in x86_ret()
636 void x86_retw( struct x86_function *p, unsigned short imm ) in x86_retw() argument
639 emit_3ub(p, 0xc2, imm & 0xff, (imm >> 8) & 0xff); in x86_retw()
642 void x86_sahf( struct x86_function *p ) in x86_sahf() argument
645 emit_1ub(p, 0x9e); in x86_sahf()
648 void x86_mov( struct x86_function *p, in x86_mov() argument
667 emit_1ub(p, rex); in x86_mov()
669 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x86_mov()
672 void x86_mov16( struct x86_function *p, in x86_mov16() argument
677 emit_1ub(p, 0x66); in x86_mov16()
678 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x86_mov16()
681 void x86_mov8( struct x86_function *p, in x86_mov8() argument
686 emit_op_modrm( p, 0x8a, 0x88, dst, src ); in x86_mov8()
689 void x64_mov64( struct x86_function *p, in x64_mov64() argument
695 assert(x86_target(p) != X86_32); in x64_mov64()
711 emit_1ub(p, rex); in x64_mov64()
712 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x64_mov64()
715 void x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x86_movzx8() argument
718 emit_2ub(p, 0x0f, 0xb6); in x86_movzx8()
719 emit_modrm(p, dst, src); in x86_movzx8()
722 void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x86_movzx16() argument
725 emit_2ub(p, 0x0f, 0xb7); in x86_movzx16()
726 emit_modrm(p, dst, src); in x86_movzx16()
729 void x86_cmovcc( struct x86_function *p, in x86_cmovcc() argument
735 emit_2ub( p, 0x0f, 0x40 + cc ); in x86_cmovcc()
736 emit_modrm( p, dst, src ); in x86_cmovcc()
739 void x86_xor( struct x86_function *p, in x86_xor() argument
744 emit_op_modrm( p, 0x33, 0x31, dst, src ); in x86_xor()
747 void x86_cmp( struct x86_function *p, in x86_cmp() argument
752 emit_op_modrm( p, 0x3b, 0x39, dst, src ); in x86_cmp()
755 void x86_lea( struct x86_function *p, in x86_lea() argument
760 emit_1ub(p, 0x8d); in x86_lea()
761 emit_modrm( p, dst, src ); in x86_lea()
764 void x86_test( struct x86_function *p, in x86_test() argument
769 emit_1ub(p, 0x85); in x86_test()
770 emit_modrm( p, dst, src ); in x86_test()
773 void x86_add( struct x86_function *p, in x86_add() argument
778 emit_op_modrm(p, 0x03, 0x01, dst, src ); in x86_add()
783 void x86_mul( struct x86_function *p, in x86_mul() argument
787 emit_1ub(p, 0xf7); in x86_mul()
788 emit_modrm_noreg(p, 4, src ); in x86_mul()
792 void x86_imul( struct x86_function *p, in x86_imul() argument
797 emit_2ub(p, X86_TWOB, 0xAF); in x86_imul()
798 emit_modrm(p, dst, src); in x86_imul()
802 void x86_sub( struct x86_function *p, in x86_sub() argument
807 emit_op_modrm(p, 0x2b, 0x29, dst, src ); in x86_sub()
810 void x86_or( struct x86_function *p, in x86_or() argument
815 emit_op_modrm( p, 0x0b, 0x09, dst, src ); in x86_or()
818 void x86_and( struct x86_function *p, in x86_and() argument
823 emit_op_modrm( p, 0x23, 0x21, dst, src ); in x86_and()
826 void x86_div( struct x86_function *p, in x86_div() argument
830 emit_op_modrm(p, 0xf7, 0, x86_make_reg(file_REG32, 6), src); in x86_div()
833 void x86_bswap( struct x86_function *p, struct x86_reg reg ) in x86_bswap() argument
838 emit_2ub(p, 0x0f, 0xc8 + reg.idx); in x86_bswap()
841 void x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_shr_imm() argument
846 emit_1ub(p, 0xd1); in x86_shr_imm()
847 emit_modrm_noreg(p, 5, reg); in x86_shr_imm()
851 emit_1ub(p, 0xc1); in x86_shr_imm()
852 emit_modrm_noreg(p, 5, reg); in x86_shr_imm()
853 emit_1ub(p, imm); in x86_shr_imm()
857 void x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_sar_imm() argument
862 emit_1ub(p, 0xd1); in x86_sar_imm()
863 emit_modrm_noreg(p, 7, reg); in x86_sar_imm()
867 emit_1ub(p, 0xc1); in x86_sar_imm()
868 emit_modrm_noreg(p, 7, reg); in x86_sar_imm()
869 emit_1ub(p, imm); in x86_sar_imm()
873 void x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_shl_imm() argument
878 emit_1ub(p, 0xd1); in x86_shl_imm()
879 emit_modrm_noreg(p, 4, reg); in x86_shl_imm()
883 emit_1ub(p, 0xc1); in x86_shl_imm()
884 emit_modrm_noreg(p, 4, reg); in x86_shl_imm()
885 emit_1ub(p, imm); in x86_shl_imm()
894 void sse_prefetchnta( struct x86_function *p, struct x86_reg ptr) in sse_prefetchnta() argument
898 emit_2ub(p, 0x0f, 0x18); in sse_prefetchnta()
899 emit_modrm_noreg(p, 0, ptr); in sse_prefetchnta()
902 void sse_prefetch0( struct x86_function *p, struct x86_reg ptr) in sse_prefetch0() argument
906 emit_2ub(p, 0x0f, 0x18); in sse_prefetch0()
907 emit_modrm_noreg(p, 1, ptr); in sse_prefetch0()
910 void sse_prefetch1( struct x86_function *p, struct x86_reg ptr) in sse_prefetch1() argument
914 emit_2ub(p, 0x0f, 0x18); in sse_prefetch1()
915 emit_modrm_noreg(p, 2, ptr); in sse_prefetch1()
918 void sse_movntps( struct x86_function *p, in sse_movntps() argument
926 emit_2ub(p, 0x0f, 0x2b); in sse_movntps()
927 emit_modrm(p, src, dst); in sse_movntps()
933 void sse_movss( struct x86_function *p, in sse_movss() argument
938 emit_2ub(p, 0xF3, X86_TWOB); in sse_movss()
939 emit_op_modrm( p, 0x10, 0x11, dst, src ); in sse_movss()
942 void sse_movaps( struct x86_function *p, in sse_movaps() argument
947 emit_1ub(p, X86_TWOB); in sse_movaps()
948 emit_op_modrm( p, 0x28, 0x29, dst, src ); in sse_movaps()
951 void sse_movups( struct x86_function *p, in sse_movups() argument
956 emit_1ub(p, X86_TWOB); in sse_movups()
957 emit_op_modrm( p, 0x10, 0x11, dst, src ); in sse_movups()
960 void sse_movhps( struct x86_function *p, in sse_movhps() argument
966 emit_1ub(p, X86_TWOB); in sse_movhps()
967 emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */ in sse_movhps()
970 void sse_movlps( struct x86_function *p, in sse_movlps() argument
976 emit_1ub(p, X86_TWOB); in sse_movlps()
977 emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */ in sse_movlps()
980 void sse_maxps( struct x86_function *p, in sse_maxps() argument
985 emit_2ub(p, X86_TWOB, 0x5F); in sse_maxps()
986 emit_modrm( p, dst, src ); in sse_maxps()
989 void sse_maxss( struct x86_function *p, in sse_maxss() argument
994 emit_3ub(p, 0xF3, X86_TWOB, 0x5F); in sse_maxss()
995 emit_modrm( p, dst, src ); in sse_maxss()
998 void sse_divss( struct x86_function *p, in sse_divss() argument
1003 emit_3ub(p, 0xF3, X86_TWOB, 0x5E); in sse_divss()
1004 emit_modrm( p, dst, src ); in sse_divss()
1007 void sse_minps( struct x86_function *p, in sse_minps() argument
1012 emit_2ub(p, X86_TWOB, 0x5D); in sse_minps()
1013 emit_modrm( p, dst, src ); in sse_minps()
1016 void sse_subps( struct x86_function *p, in sse_subps() argument
1021 emit_2ub(p, X86_TWOB, 0x5C); in sse_subps()
1022 emit_modrm( p, dst, src ); in sse_subps()
1025 void sse_mulps( struct x86_function *p, in sse_mulps() argument
1030 emit_2ub(p, X86_TWOB, 0x59); in sse_mulps()
1031 emit_modrm( p, dst, src ); in sse_mulps()
1034 void sse_mulss( struct x86_function *p, in sse_mulss() argument
1039 emit_3ub(p, 0xF3, X86_TWOB, 0x59); in sse_mulss()
1040 emit_modrm( p, dst, src ); in sse_mulss()
1043 void sse_addps( struct x86_function *p, in sse_addps() argument
1048 emit_2ub(p, X86_TWOB, 0x58); in sse_addps()
1049 emit_modrm( p, dst, src ); in sse_addps()
1052 void sse_addss( struct x86_function *p, in sse_addss() argument
1057 emit_3ub(p, 0xF3, X86_TWOB, 0x58); in sse_addss()
1058 emit_modrm( p, dst, src ); in sse_addss()
1061 void sse_andnps( struct x86_function *p, in sse_andnps() argument
1066 emit_2ub(p, X86_TWOB, 0x55); in sse_andnps()
1067 emit_modrm( p, dst, src ); in sse_andnps()
1070 void sse_andps( struct x86_function *p, in sse_andps() argument
1075 emit_2ub(p, X86_TWOB, 0x54); in sse_andps()
1076 emit_modrm( p, dst, src ); in sse_andps()
1079 void sse_rsqrtps( struct x86_function *p, in sse_rsqrtps() argument
1084 emit_2ub(p, X86_TWOB, 0x52); in sse_rsqrtps()
1085 emit_modrm( p, dst, src ); in sse_rsqrtps()
1088 void sse_rsqrtss( struct x86_function *p, in sse_rsqrtss() argument
1093 emit_3ub(p, 0xF3, X86_TWOB, 0x52); in sse_rsqrtss()
1094 emit_modrm( p, dst, src ); in sse_rsqrtss()
1098 void sse_movhlps( struct x86_function *p, in sse_movhlps() argument
1104 emit_2ub(p, X86_TWOB, 0x12); in sse_movhlps()
1105 emit_modrm( p, dst, src ); in sse_movhlps()
1108 void sse_movlhps( struct x86_function *p, in sse_movlhps() argument
1114 emit_2ub(p, X86_TWOB, 0x16); in sse_movlhps()
1115 emit_modrm( p, dst, src ); in sse_movlhps()
1118 void sse_orps( struct x86_function *p, in sse_orps() argument
1123 emit_2ub(p, X86_TWOB, 0x56); in sse_orps()
1124 emit_modrm( p, dst, src ); in sse_orps()
1127 void sse_xorps( struct x86_function *p, in sse_xorps() argument
1132 emit_2ub(p, X86_TWOB, 0x57); in sse_xorps()
1133 emit_modrm( p, dst, src ); in sse_xorps()
1136 void sse_cvtps2pi( struct x86_function *p, in sse_cvtps2pi() argument
1144 p->need_emms = 1; in sse_cvtps2pi()
1146 emit_2ub(p, X86_TWOB, 0x2d); in sse_cvtps2pi()
1147 emit_modrm( p, dst, src ); in sse_cvtps2pi()
1150 void sse2_cvtdq2ps( struct x86_function *p, in sse2_cvtdq2ps() argument
1155 emit_2ub(p, X86_TWOB, 0x5b); in sse2_cvtdq2ps()
1156 emit_modrm( p, dst, src ); in sse2_cvtdq2ps()
1163 void sse_shufps( struct x86_function *p, in sse_shufps() argument
1169 emit_2ub(p, X86_TWOB, 0xC6); in sse_shufps()
1170 emit_modrm(p, dst, src); in sse_shufps()
1171 emit_1ub(p, shuf); in sse_shufps()
1174 void sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse_unpckhps() argument
1177 emit_2ub( p, X86_TWOB, 0x15 ); in sse_unpckhps()
1178 emit_modrm( p, dst, src ); in sse_unpckhps()
1181 void sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse_unpcklps() argument
1184 emit_2ub( p, X86_TWOB, 0x14 ); in sse_unpcklps()
1185 emit_modrm( p, dst, src ); in sse_unpcklps()
1188 void sse_cmpps( struct x86_function *p, in sse_cmpps() argument
1194 emit_2ub(p, X86_TWOB, 0xC2); in sse_cmpps()
1195 emit_modrm(p, dst, src); in sse_cmpps()
1196 emit_1ub(p, cc); in sse_cmpps()
1199 void sse_pmovmskb( struct x86_function *p, in sse_pmovmskb() argument
1204 emit_3ub(p, 0x66, X86_TWOB, 0xD7); in sse_pmovmskb()
1205 emit_modrm(p, dst, src); in sse_pmovmskb()
1208 void sse_movmskps( struct x86_function *p, in sse_movmskps() argument
1213 emit_2ub(p, X86_TWOB, 0x50); in sse_movmskps()
1214 emit_modrm(p, dst, src); in sse_movmskps()
1221 void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movd() argument
1224 emit_2ub(p, 0x66, 0x0f); in sse2_movd()
1227 emit_1ub(p, 0x7e); in sse2_movd()
1228 emit_modrm(p, src, dst); in sse2_movd()
1232 emit_op_modrm(p, 0x6e, 0x7e, dst, src); in sse2_movd()
1236 void sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movq() argument
1241 emit_3ub(p, 0xf3, 0x0f, 0x7e); in sse2_movq()
1242 emit_modrm(p, dst, src); in sse2_movq()
1248 emit_3ub(p, 0x66, 0x0f, 0xd6); in sse2_movq()
1249 emit_modrm(p, src, dst); in sse2_movq()
1257 void sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movdqu() argument
1260 emit_2ub(p, 0xf3, 0x0f); in sse2_movdqu()
1261 emit_op_modrm(p, 0x6f, 0x7f, dst, src); in sse2_movdqu()
1264 void sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movdqa() argument
1267 emit_2ub(p, 0x66, 0x0f); in sse2_movdqa()
1268 emit_op_modrm(p, 0x6f, 0x7f, dst, src); in sse2_movdqa()
1271 void sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movsd() argument
1274 emit_2ub(p, 0xf2, 0x0f); in sse2_movsd()
1275 emit_op_modrm(p, 0x10, 0x11, dst, src); in sse2_movsd()
1278 void sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movupd() argument
1281 emit_2ub(p, 0x66, 0x0f); in sse2_movupd()
1282 emit_op_modrm(p, 0x10, 0x11, dst, src); in sse2_movupd()
1285 void sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movapd() argument
1288 emit_2ub(p, 0x66, 0x0f); in sse2_movapd()
1289 emit_op_modrm(p, 0x28, 0x29, dst, src); in sse2_movapd()
1295 void sse2_pshufd( struct x86_function *p, in sse2_pshufd() argument
1301 emit_3ub(p, 0x66, X86_TWOB, 0x70); in sse2_pshufd()
1302 emit_modrm(p, dst, src); in sse2_pshufd()
1303 emit_1ub(p, shuf); in sse2_pshufd()
1306 void sse2_pshuflw( struct x86_function *p, in sse2_pshuflw() argument
1312 emit_3ub(p, 0xf2, X86_TWOB, 0x70); in sse2_pshuflw()
1313 emit_modrm(p, dst, src); in sse2_pshuflw()
1314 emit_1ub(p, shuf); in sse2_pshuflw()
1317 void sse2_pshufhw( struct x86_function *p, in sse2_pshufhw() argument
1323 emit_3ub(p, 0xf3, X86_TWOB, 0x70); in sse2_pshufhw()
1324 emit_modrm(p, dst, src); in sse2_pshufhw()
1325 emit_1ub(p, shuf); in sse2_pshufhw()
1328 void sse2_cvttps2dq( struct x86_function *p, in sse2_cvttps2dq() argument
1333 emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); in sse2_cvttps2dq()
1334 emit_modrm( p, dst, src ); in sse2_cvttps2dq()
1337 void sse2_cvtps2dq( struct x86_function *p, in sse2_cvtps2dq() argument
1342 emit_3ub(p, 0x66, X86_TWOB, 0x5B); in sse2_cvtps2dq()
1343 emit_modrm( p, dst, src ); in sse2_cvtps2dq()
1346 void sse2_cvtsd2ss( struct x86_function *p, in sse2_cvtsd2ss() argument
1351 emit_3ub(p, 0xf2, 0x0f, 0x5a); in sse2_cvtsd2ss()
1352 emit_modrm( p, dst, src ); in sse2_cvtsd2ss()
1355 void sse2_cvtpd2ps( struct x86_function *p, in sse2_cvtpd2ps() argument
1360 emit_3ub(p, 0x66, 0x0f, 0x5a); in sse2_cvtpd2ps()
1361 emit_modrm( p, dst, src ); in sse2_cvtpd2ps()
1364 void sse2_packssdw( struct x86_function *p, in sse2_packssdw() argument
1369 emit_3ub(p, 0x66, X86_TWOB, 0x6B); in sse2_packssdw()
1370 emit_modrm( p, dst, src ); in sse2_packssdw()
1373 void sse2_packsswb( struct x86_function *p, in sse2_packsswb() argument
1378 emit_3ub(p, 0x66, X86_TWOB, 0x63); in sse2_packsswb()
1379 emit_modrm( p, dst, src ); in sse2_packsswb()
1382 void sse2_packuswb( struct x86_function *p, in sse2_packuswb() argument
1387 emit_3ub(p, 0x66, X86_TWOB, 0x67); in sse2_packuswb()
1388 emit_modrm( p, dst, src ); in sse2_packuswb()
1391 void sse2_punpcklbw( struct x86_function *p, in sse2_punpcklbw() argument
1396 emit_3ub(p, 0x66, X86_TWOB, 0x60); in sse2_punpcklbw()
1397 emit_modrm( p, dst, src ); in sse2_punpcklbw()
1400 void sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpcklwd() argument
1403 emit_3ub(p, 0x66, 0x0f, 0x61); in sse2_punpcklwd()
1404 emit_modrm( p, dst, src ); in sse2_punpcklwd()
1407 void sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpckldq() argument
1410 emit_3ub(p, 0x66, 0x0f, 0x62); in sse2_punpckldq()
1411 emit_modrm( p, dst, src ); in sse2_punpckldq()
1414 void sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpcklqdq() argument
1417 emit_3ub(p, 0x66, 0x0f, 0x6c); in sse2_punpcklqdq()
1418 emit_modrm( p, dst, src ); in sse2_punpcklqdq()
1421 void sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psllw_imm() argument
1424 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psllw_imm()
1425 emit_modrm_noreg(p, 6, dst); in sse2_psllw_imm()
1426 emit_1ub(p, imm); in sse2_psllw_imm()
1429 void sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_pslld_imm() argument
1432 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_pslld_imm()
1433 emit_modrm_noreg(p, 6, dst); in sse2_pslld_imm()
1434 emit_1ub(p, imm); in sse2_pslld_imm()
1437 void sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psllq_imm() argument
1440 emit_3ub(p, 0x66, 0x0f, 0x73); in sse2_psllq_imm()
1441 emit_modrm_noreg(p, 6, dst); in sse2_psllq_imm()
1442 emit_1ub(p, imm); in sse2_psllq_imm()
1445 void sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrlw_imm() argument
1448 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psrlw_imm()
1449 emit_modrm_noreg(p, 2, dst); in sse2_psrlw_imm()
1450 emit_1ub(p, imm); in sse2_psrlw_imm()
1453 void sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrld_imm() argument
1456 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_psrld_imm()
1457 emit_modrm_noreg(p, 2, dst); in sse2_psrld_imm()
1458 emit_1ub(p, imm); in sse2_psrld_imm()
1461 void sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrlq_imm() argument
1464 emit_3ub(p, 0x66, 0x0f, 0x73); in sse2_psrlq_imm()
1465 emit_modrm_noreg(p, 2, dst); in sse2_psrlq_imm()
1466 emit_1ub(p, imm); in sse2_psrlq_imm()
1469 void sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psraw_imm() argument
1472 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psraw_imm()
1473 emit_modrm_noreg(p, 4, dst); in sse2_psraw_imm()
1474 emit_1ub(p, imm); in sse2_psraw_imm()
1477 void sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrad_imm() argument
1480 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_psrad_imm()
1481 emit_modrm_noreg(p, 4, dst); in sse2_psrad_imm()
1482 emit_1ub(p, imm); in sse2_psrad_imm()
1485 void sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_por() argument
1488 emit_3ub(p, 0x66, 0x0f, 0xeb); in sse2_por()
1489 emit_modrm(p, dst, src); in sse2_por()
1492 void sse2_rcpps( struct x86_function *p, in sse2_rcpps() argument
1497 emit_2ub(p, X86_TWOB, 0x53); in sse2_rcpps()
1498 emit_modrm( p, dst, src ); in sse2_rcpps()
1501 void sse2_rcpss( struct x86_function *p, in sse2_rcpss() argument
1506 emit_3ub(p, 0xF3, X86_TWOB, 0x53); in sse2_rcpss()
1507 emit_modrm( p, dst, src ); in sse2_rcpss()
1513 static void note_x87_pop( struct x86_function *p ) in note_x87_pop() argument
1515 p->x87_stack--; in note_x87_pop()
1516 assert(p->x87_stack >= 0); in note_x87_pop()
1519 static void note_x87_push( struct x86_function *p ) in note_x87_push() argument
1521 p->x87_stack++; in note_x87_push()
1522 assert(p->x87_stack <= 7); in note_x87_push()
1525 void x87_assert_stack_empty( struct x86_function *p ) in x87_assert_stack_empty() argument
1527 assert (p->x87_stack == 0); in x87_assert_stack_empty()
1531 void x87_fist( struct x86_function *p, struct x86_reg dst ) in x87_fist() argument
1534 emit_1ub(p, 0xdb); in x87_fist()
1535 emit_modrm_noreg(p, 2, dst); in x87_fist()
1538 void x87_fistp( struct x86_function *p, struct x86_reg dst ) in x87_fistp() argument
1541 emit_1ub(p, 0xdb); in x87_fistp()
1542 emit_modrm_noreg(p, 3, dst); in x87_fistp()
1543 note_x87_pop(p); in x87_fistp()
1546 void x87_fild( struct x86_function *p, struct x86_reg arg ) in x87_fild() argument
1549 emit_1ub(p, 0xdf); in x87_fild()
1550 emit_modrm_noreg(p, 0, arg); in x87_fild()
1551 note_x87_push(p); in x87_fild()
1554 void x87_fldz( struct x86_function *p ) in x87_fldz() argument
1557 emit_2ub(p, 0xd9, 0xee); in x87_fldz()
1558 note_x87_push(p); in x87_fldz()
1562 void x87_fldcw( struct x86_function *p, struct x86_reg arg ) in x87_fldcw() argument
1567 emit_1ub(p, 0xd9); in x87_fldcw()
1568 emit_modrm_noreg(p, 5, arg); in x87_fldcw()
1571 void x87_fld1( struct x86_function *p ) in x87_fld1() argument
1574 emit_2ub(p, 0xd9, 0xe8); in x87_fld1()
1575 note_x87_push(p); in x87_fld1()
1578 void x87_fldl2e( struct x86_function *p ) in x87_fldl2e() argument
1581 emit_2ub(p, 0xd9, 0xea); in x87_fldl2e()
1582 note_x87_push(p); in x87_fldl2e()
1585 void x87_fldln2( struct x86_function *p ) in x87_fldln2() argument
1588 emit_2ub(p, 0xd9, 0xed); in x87_fldln2()
1589 note_x87_push(p); in x87_fldln2()
1592 void x87_fwait( struct x86_function *p ) in x87_fwait() argument
1595 emit_1ub(p, 0x9b); in x87_fwait()
1598 void x87_fnclex( struct x86_function *p ) in x87_fnclex() argument
1601 emit_2ub(p, 0xdb, 0xe2); in x87_fnclex()
1604 void x87_fclex( struct x86_function *p ) in x87_fclex() argument
1606 x87_fwait(p); in x87_fclex()
1607 x87_fnclex(p); in x87_fclex()
1610 void x87_fcmovb( struct x86_function *p, struct x86_reg arg ) in x87_fcmovb() argument
1614 emit_2ub(p, 0xda, 0xc0+arg.idx); in x87_fcmovb()
1617 void x87_fcmove( struct x86_function *p, struct x86_reg arg ) in x87_fcmove() argument
1621 emit_2ub(p, 0xda, 0xc8+arg.idx); in x87_fcmove()
1624 void x87_fcmovbe( struct x86_function *p, struct x86_reg arg ) in x87_fcmovbe() argument
1628 emit_2ub(p, 0xda, 0xd0+arg.idx); in x87_fcmovbe()
1631 void x87_fcmovnb( struct x86_function *p, struct x86_reg arg ) in x87_fcmovnb() argument
1635 emit_2ub(p, 0xdb, 0xc0+arg.idx); in x87_fcmovnb()
1638 void x87_fcmovne( struct x86_function *p, struct x86_reg arg ) in x87_fcmovne() argument
1642 emit_2ub(p, 0xdb, 0xc8+arg.idx); in x87_fcmovne()
1645 void x87_fcmovnbe( struct x86_function *p, struct x86_reg arg ) in x87_fcmovnbe() argument
1649 emit_2ub(p, 0xdb, 0xd0+arg.idx); in x87_fcmovnbe()
1654 static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, in x87_arith_op() argument
1665 emit_2ub(p, dst0ub0, dst0ub1+arg.idx); in x87_arith_op()
1667 emit_2ub(p, arg0ub0, arg0ub1+arg.idx); in x87_arith_op()
1673 emit_1ub(p, 0xd8); in x87_arith_op()
1674 emit_modrm_noreg(p, argmem_noreg, arg); in x87_arith_op()
1680 void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fmul() argument
1683 x87_arith_op(p, dst, src, in x87_fmul()
1689 void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fsub() argument
1692 x87_arith_op(p, dst, src, in x87_fsub()
1698 void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fsubr() argument
1701 x87_arith_op(p, dst, src, in x87_fsubr()
1707 void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fadd() argument
1710 x87_arith_op(p, dst, src, in x87_fadd()
1716 void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fdiv() argument
1719 x87_arith_op(p, dst, src, in x87_fdiv()
1725 void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fdivr() argument
1728 x87_arith_op(p, dst, src, in x87_fdivr()
1734 void x87_fmulp( struct x86_function *p, struct x86_reg dst ) in x87_fmulp() argument
1739 emit_2ub(p, 0xde, 0xc8+dst.idx); in x87_fmulp()
1740 note_x87_pop(p); in x87_fmulp()
1743 void x87_fsubp( struct x86_function *p, struct x86_reg dst ) in x87_fsubp() argument
1748 emit_2ub(p, 0xde, 0xe8+dst.idx); in x87_fsubp()
1749 note_x87_pop(p); in x87_fsubp()
1752 void x87_fsubrp( struct x86_function *p, struct x86_reg dst ) in x87_fsubrp() argument
1757 emit_2ub(p, 0xde, 0xe0+dst.idx); in x87_fsubrp()
1758 note_x87_pop(p); in x87_fsubrp()
1761 void x87_faddp( struct x86_function *p, struct x86_reg dst ) in x87_faddp() argument
1766 emit_2ub(p, 0xde, 0xc0+dst.idx); in x87_faddp()
1767 note_x87_pop(p); in x87_faddp()
1770 void x87_fdivp( struct x86_function *p, struct x86_reg dst ) in x87_fdivp() argument
1775 emit_2ub(p, 0xde, 0xf8+dst.idx); in x87_fdivp()
1776 note_x87_pop(p); in x87_fdivp()
1779 void x87_fdivrp( struct x86_function *p, struct x86_reg dst ) in x87_fdivrp() argument
1784 emit_2ub(p, 0xde, 0xf0+dst.idx); in x87_fdivrp()
1785 note_x87_pop(p); in x87_fdivrp()
1788 void x87_ftst( struct x86_function *p ) in x87_ftst() argument
1791 emit_2ub(p, 0xd9, 0xe4); in x87_ftst()
1794 void x87_fucom( struct x86_function *p, struct x86_reg arg ) in x87_fucom() argument
1798 emit_2ub(p, 0xdd, 0xe0+arg.idx); in x87_fucom()
1801 void x87_fucomp( struct x86_function *p, struct x86_reg arg ) in x87_fucomp() argument
1805 emit_2ub(p, 0xdd, 0xe8+arg.idx); in x87_fucomp()
1806 note_x87_pop(p); in x87_fucomp()
1809 void x87_fucompp( struct x86_function *p ) in x87_fucompp() argument
1812 emit_2ub(p, 0xda, 0xe9); in x87_fucompp()
1813 note_x87_pop(p); /* pop twice */ in x87_fucompp()
1814 note_x87_pop(p); /* pop twice */ in x87_fucompp()
1817 void x87_fxch( struct x86_function *p, struct x86_reg arg ) in x87_fxch() argument
1821 emit_2ub(p, 0xd9, 0xc8+arg.idx); in x87_fxch()
1824 void x87_fabs( struct x86_function *p ) in x87_fabs() argument
1827 emit_2ub(p, 0xd9, 0xe1); in x87_fabs()
1830 void x87_fchs( struct x86_function *p ) in x87_fchs() argument
1833 emit_2ub(p, 0xd9, 0xe0); in x87_fchs()
1836 void x87_fcos( struct x86_function *p ) in x87_fcos() argument
1839 emit_2ub(p, 0xd9, 0xff); in x87_fcos()
1843 void x87_fprndint( struct x86_function *p ) in x87_fprndint() argument
1846 emit_2ub(p, 0xd9, 0xfc); in x87_fprndint()
1849 void x87_fscale( struct x86_function *p ) in x87_fscale() argument
1852 emit_2ub(p, 0xd9, 0xfd); in x87_fscale()
1855 void x87_fsin( struct x86_function *p ) in x87_fsin() argument
1858 emit_2ub(p, 0xd9, 0xfe); in x87_fsin()
1861 void x87_fsincos( struct x86_function *p ) in x87_fsincos() argument
1864 emit_2ub(p, 0xd9, 0xfb); in x87_fsincos()
1867 void x87_fsqrt( struct x86_function *p ) in x87_fsqrt() argument
1870 emit_2ub(p, 0xd9, 0xfa); in x87_fsqrt()
1873 void x87_fxtract( struct x86_function *p ) in x87_fxtract() argument
1876 emit_2ub(p, 0xd9, 0xf4); in x87_fxtract()
1883 void x87_f2xm1( struct x86_function *p ) in x87_f2xm1() argument
1886 emit_2ub(p, 0xd9, 0xf0); in x87_f2xm1()
1892 void x87_fyl2x( struct x86_function *p ) in x87_fyl2x() argument
1895 emit_2ub(p, 0xd9, 0xf1); in x87_fyl2x()
1896 note_x87_pop(p); in x87_fyl2x()
1904 void x87_fyl2xp1( struct x86_function *p ) in x87_fyl2xp1() argument
1907 emit_2ub(p, 0xd9, 0xf9); in x87_fyl2xp1()
1908 note_x87_pop(p); in x87_fyl2xp1()
1912 void x87_fld( struct x86_function *p, struct x86_reg arg ) in x87_fld() argument
1916 emit_2ub(p, 0xd9, 0xc0 + arg.idx); in x87_fld()
1918 emit_1ub(p, 0xd9); in x87_fld()
1919 emit_modrm_noreg(p, 0, arg); in x87_fld()
1921 note_x87_push(p); in x87_fld()
1924 void x87_fst( struct x86_function *p, struct x86_reg dst ) in x87_fst() argument
1928 emit_2ub(p, 0xdd, 0xd0 + dst.idx); in x87_fst()
1930 emit_1ub(p, 0xd9); in x87_fst()
1931 emit_modrm_noreg(p, 2, dst); in x87_fst()
1935 void x87_fstp( struct x86_function *p, struct x86_reg dst ) in x87_fstp() argument
1939 emit_2ub(p, 0xdd, 0xd8 + dst.idx); in x87_fstp()
1941 emit_1ub(p, 0xd9); in x87_fstp()
1942 emit_modrm_noreg(p, 3, dst); in x87_fstp()
1944 note_x87_pop(p); in x87_fstp()
1947 void x87_fpop( struct x86_function *p ) in x87_fpop() argument
1949 x87_fstp( p, x86_make_reg( file_x87, 0 )); in x87_fpop()
1953 void x87_fcom( struct x86_function *p, struct x86_reg dst ) in x87_fcom() argument
1957 emit_2ub(p, 0xd8, 0xd0 + dst.idx); in x87_fcom()
1959 emit_1ub(p, 0xd8); in x87_fcom()
1960 emit_modrm_noreg(p, 2, dst); in x87_fcom()
1965 void x87_fcomp( struct x86_function *p, struct x86_reg dst ) in x87_fcomp() argument
1969 emit_2ub(p, 0xd8, 0xd8 + dst.idx); in x87_fcomp()
1971 emit_1ub(p, 0xd8); in x87_fcomp()
1972 emit_modrm_noreg(p, 3, dst); in x87_fcomp()
1974 note_x87_pop(p); in x87_fcomp()
1977 void x87_fcomi( struct x86_function *p, struct x86_reg arg ) in x87_fcomi() argument
1980 emit_2ub(p, 0xdb, 0xf0+arg.idx); in x87_fcomi()
1983 void x87_fcomip( struct x86_function *p, struct x86_reg arg ) in x87_fcomip() argument
1986 emit_2ub(p, 0xdb, 0xf0+arg.idx); in x87_fcomip()
1987 note_x87_pop(p); in x87_fcomip()
1991 void x87_fnstsw( struct x86_function *p, struct x86_reg dst ) in x87_fnstsw() argument
1998 emit_2ub(p, 0xdf, 0xe0); in x87_fnstsw()
2000 emit_1ub(p, 0xdd); in x87_fnstsw()
2001 emit_modrm_noreg(p, 7, dst); in x87_fnstsw()
2006 void x87_fnstcw( struct x86_function *p, struct x86_reg dst ) in x87_fnstcw() argument
2011 emit_1ub(p, 0x9b); /* WAIT -- needed? */ in x87_fnstcw()
2012 emit_1ub(p, 0xd9); in x87_fnstcw()
2013 emit_modrm_noreg(p, 7, dst); in x87_fnstcw()
2023 void mmx_emms( struct x86_function *p ) in mmx_emms() argument
2026 assert(p->need_emms); in mmx_emms()
2027 emit_2ub(p, 0x0f, 0x77); in mmx_emms()
2028 p->need_emms = 0; in mmx_emms()
2031 void mmx_packssdw( struct x86_function *p, in mmx_packssdw() argument
2039 p->need_emms = 1; in mmx_packssdw()
2041 emit_2ub(p, X86_TWOB, 0x6b); in mmx_packssdw()
2042 emit_modrm( p, dst, src ); in mmx_packssdw()
2045 void mmx_packuswb( struct x86_function *p, in mmx_packuswb() argument
2053 p->need_emms = 1; in mmx_packuswb()
2055 emit_2ub(p, X86_TWOB, 0x67); in mmx_packuswb()
2056 emit_modrm( p, dst, src ); in mmx_packuswb()
2059 void mmx_movd( struct x86_function *p, in mmx_movd() argument
2064 p->need_emms = 1; in mmx_movd()
2065 emit_1ub(p, X86_TWOB); in mmx_movd()
2066 emit_op_modrm( p, 0x6e, 0x7e, dst, src ); in mmx_movd()
2069 void mmx_movq( struct x86_function *p, in mmx_movq() argument
2074 p->need_emms = 1; in mmx_movq()
2075 emit_1ub(p, X86_TWOB); in mmx_movq()
2076 emit_op_modrm( p, 0x6f, 0x7f, dst, src ); in mmx_movq()
2085 void x86_cdecl_caller_push_regs( struct x86_function *p ) in x86_cdecl_caller_push_regs() argument
2087 x86_push(p, x86_make_reg(file_REG32, reg_AX)); in x86_cdecl_caller_push_regs()
2088 x86_push(p, x86_make_reg(file_REG32, reg_CX)); in x86_cdecl_caller_push_regs()
2089 x86_push(p, x86_make_reg(file_REG32, reg_DX)); in x86_cdecl_caller_push_regs()
2092 void x86_cdecl_caller_pop_regs( struct x86_function *p ) in x86_cdecl_caller_pop_regs() argument
2094 x86_pop(p, x86_make_reg(file_REG32, reg_DX)); in x86_cdecl_caller_pop_regs()
2095 x86_pop(p, x86_make_reg(file_REG32, reg_CX)); in x86_cdecl_caller_pop_regs()
2096 x86_pop(p, x86_make_reg(file_REG32, reg_AX)); in x86_cdecl_caller_pop_regs()
2100 struct x86_reg x86_fn_arg( struct x86_function *p, in x86_fn_arg() argument
2103 switch(x86_target(p)) in x86_fn_arg()
2120 p->stack_offset + arg * 8); in x86_fn_arg()
2139 p->stack_offset + (arg - 6) * 8); /* ??? */ in x86_fn_arg()
2143 p->stack_offset + arg * 4); /* ??? */ in x86_fn_arg()
2150 static void x86_init_func_common( struct x86_function *p ) in x86_init_func_common() argument
2153 p->caps = 0; in x86_init_func_common()
2155 p->caps |= X86_MMX; in x86_init_func_common()
2157 p->caps |= X86_MMX2; in x86_init_func_common()
2159 p->caps |= X86_SSE; in x86_init_func_common()
2161 p->caps |= X86_SSE2; in x86_init_func_common()
2163 p->caps |= X86_SSE3; in x86_init_func_common()
2165 p->caps |= X86_SSE4_1; in x86_init_func_common()
2166 p->csr = p->store; in x86_init_func_common()
2170 void x86_init_func( struct x86_function *p ) in x86_init_func() argument
2172 p->size = 0; in x86_init_func()
2173 p->store = NULL; in x86_init_func()
2174 x86_init_func_common(p); in x86_init_func()
2177 void x86_init_func_size( struct x86_function *p, unsigned code_size ) in x86_init_func_size() argument
2179 p->size = code_size; in x86_init_func_size()
2180 p->store = rtasm_exec_malloc(code_size); in x86_init_func_size()
2181 if (p->store == NULL) { in x86_init_func_size()
2182 p->store = p->error_overflow; in x86_init_func_size()
2184 x86_init_func_common(p); in x86_init_func_size()
2187 void x86_release_func( struct x86_function *p ) in x86_release_func() argument
2189 if (p->store && p->store != p->error_overflow) in x86_release_func()
2190 rtasm_exec_free(p->store); in x86_release_func()
2192 p->store = NULL; in x86_release_func()
2193 p->csr = NULL; in x86_release_func()
2194 p->size = 0; in x86_release_func()
2211 x86_func x86_get_func( struct x86_function *p ) in x86_get_func() argument
2214 if (DISASSEM && p->store) in x86_get_func()
2215 debug_printf("disassemble %p %p\n", p->store, p->csr); in x86_get_func()
2217 if (p->store == p->error_overflow) in x86_get_func()
2220 return voidptr_to_x86_func(p->store); in x86_get_func()