Lines Matching refs:p

92    debug_printf( "\n%4x %14s ", p->csr - p->store, foo );             \
140 static void do_realloc( struct x86_function *p ) in do_realloc() argument
142 if (p->store == p->error_overflow) { in do_realloc()
143 p->csr = p->store; in do_realloc()
145 else if (p->size == 0) { in do_realloc()
146 p->size = 1024; in do_realloc()
147 p->store = rtasm_exec_malloc(p->size); in do_realloc()
148 p->csr = p->store; in do_realloc()
151 uintptr_t used = pointer_to_uintptr( p->csr ) - pointer_to_uintptr( p->store ); in do_realloc()
152 unsigned char *tmp = p->store; in do_realloc()
153 p->size *= 2; in do_realloc()
154 p->store = rtasm_exec_malloc(p->size); in do_realloc()
156 if (p->store) { in do_realloc()
157 memcpy(p->store, tmp, used); in do_realloc()
158 p->csr = p->store + used; in do_realloc()
161 p->csr = p->store; in do_realloc()
167 if (p->store == NULL) { in do_realloc()
168 p->store = p->csr = p->error_overflow; in do_realloc()
169 p->size = sizeof(p->error_overflow); in do_realloc()
175 static unsigned char *reserve( struct x86_function *p, int bytes ) in reserve() argument
177 if (p->csr + bytes - p->store > (int) p->size) in reserve()
178 do_realloc(p); in reserve()
181 unsigned char *csr = p->csr; in reserve()
182 p->csr += bytes; in reserve()
189 static void emit_1b( struct x86_function *p, char b0 ) in emit_1b() argument
191 char *csr = (char *)reserve(p, 1); in emit_1b()
195 static void emit_1i( struct x86_function *p, int i0 ) in emit_1i() argument
197 int *icsr = (int *)reserve(p, sizeof(i0)); in emit_1i()
201 static void emit_1ub( struct x86_function *p, unsigned char b0 ) in emit_1ub() argument
203 unsigned char *csr = reserve(p, 1); in emit_1ub()
207 static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) in emit_2ub() argument
209 unsigned char *csr = reserve(p, 2); in emit_2ub()
214 static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) in emit_3ub() argument
216 unsigned char *csr = reserve(p, 3); in emit_3ub()
228 static void emit_modrm( struct x86_function *p, in emit_modrm() argument
244 emit_1ub(p, val); in emit_modrm()
251 emit_1ub(p, 0x24); /* simplistic! */ in emit_modrm()
259 emit_1b(p, (char) regmem.disp); in emit_modrm()
262 emit_1i(p, regmem.disp); in emit_modrm()
272 static void emit_modrm_noreg( struct x86_function *p, in emit_modrm_noreg() argument
277 emit_modrm(p, dummy, regmem); in emit_modrm_noreg()
285 static void emit_op_modrm( struct x86_function *p, in emit_op_modrm() argument
293 emit_1ub(p, op_dst_is_reg); in emit_op_modrm()
294 emit_modrm(p, dst, src); in emit_op_modrm()
300 emit_1ub(p, op_dst_is_mem); in emit_op_modrm()
301 emit_modrm(p, src, dst); in emit_op_modrm()
360 int x86_get_label( struct x86_function *p ) in x86_get_label() argument
362 return p->csr - p->store; in x86_get_label()
372 void x64_rexw(struct x86_function *p) in x64_rexw() argument
374 if(x86_target(p) != X86_32) in x64_rexw()
375 emit_1ub(p, 0x48); in x64_rexw()
378 void x86_jcc( struct x86_function *p, in x86_jcc() argument
382 int offset = label - (x86_get_label(p) + 2); in x86_jcc()
387 if (p->csr - p->store <= -offset) { in x86_jcc()
394 emit_1ub(p, 0x70 + cc); in x86_jcc()
395 emit_1b(p, (char) offset); in x86_jcc()
398 offset = label - (x86_get_label(p) + 6); in x86_jcc()
399 emit_2ub(p, 0x0f, 0x80 + cc); in x86_jcc()
400 emit_1i(p, offset); in x86_jcc()
406 int x86_jcc_forward( struct x86_function *p, in x86_jcc_forward() argument
410 emit_2ub(p, 0x0f, 0x80 + cc); in x86_jcc_forward()
411 emit_1i(p, 0); in x86_jcc_forward()
412 return x86_get_label(p); in x86_jcc_forward()
415 int x86_jmp_forward( struct x86_function *p) in x86_jmp_forward() argument
418 emit_1ub(p, 0xe9); in x86_jmp_forward()
419 emit_1i(p, 0); in x86_jmp_forward()
420 return x86_get_label(p); in x86_jmp_forward()
423 int x86_call_forward( struct x86_function *p) in x86_call_forward() argument
427 emit_1ub(p, 0xe8); in x86_call_forward()
428 emit_1i(p, 0); in x86_call_forward()
429 return x86_get_label(p); in x86_call_forward()
434 void x86_fixup_fwd_jump( struct x86_function *p, in x86_fixup_fwd_jump() argument
437 *(int *)(p->store + fixup - 4) = x86_get_label(p) - fixup; in x86_fixup_fwd_jump()
440 void x86_jmp( struct x86_function *p, int label) in x86_jmp() argument
443 emit_1ub(p, 0xe9); in x86_jmp()
444 emit_1i(p, label - x86_get_label(p) - 4); in x86_jmp()
447 void x86_call( struct x86_function *p, struct x86_reg reg) in x86_call() argument
450 emit_1ub(p, 0xff); in x86_call()
451 emit_modrm_noreg(p, 2, reg); in x86_call()
455 void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_mov_reg_imm() argument
460 emit_1ub(p, 0xb8 + dst.idx); in x86_mov_reg_imm()
461 emit_1i(p, imm); in x86_mov_reg_imm()
464 void x86_mov_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_mov_imm() argument
468 x86_mov_reg_imm(p, dst, imm); in x86_mov_imm()
471 emit_1ub(p, 0xc7); in x86_mov_imm()
472 emit_modrm_noreg(p, 0, dst); in x86_mov_imm()
473 emit_1i(p, imm); in x86_mov_imm()
477 void x86_mov16_imm( struct x86_function *p, struct x86_reg dst, uint16_t imm ) in x86_mov16_imm() argument
480 emit_1ub(p, 0x66); in x86_mov16_imm()
483 emit_1ub(p, 0xb8 + dst.idx); in x86_mov16_imm()
484 emit_2ub(p, imm & 0xff, imm >> 8); in x86_mov16_imm()
488 emit_1ub(p, 0xc7); in x86_mov16_imm()
489 emit_modrm_noreg(p, 0, dst); in x86_mov16_imm()
490 emit_2ub(p, imm & 0xff, imm >> 8); in x86_mov16_imm()
494 void x86_mov8_imm( struct x86_function *p, struct x86_reg dst, uint8_t imm ) in x86_mov8_imm() argument
499 emit_1ub(p, 0xb0 + dst.idx); in x86_mov8_imm()
500 emit_1ub(p, imm); in x86_mov8_imm()
504 emit_1ub(p, 0xc6); in x86_mov8_imm()
505 emit_modrm_noreg(p, 0, dst); in x86_mov8_imm()
506 emit_1ub(p, imm); in x86_mov8_imm()
514 x86_group1_imm( struct x86_function *p, in x86_group1_imm() argument
520 emit_1ub(p, 0x83); in x86_group1_imm()
521 emit_modrm_noreg(p, op, dst); in x86_group1_imm()
522 emit_1b(p, (char)imm); in x86_group1_imm()
525 emit_1ub(p, 0x81); in x86_group1_imm()
526 emit_modrm_noreg(p, op, dst); in x86_group1_imm()
527 emit_1i(p, imm); in x86_group1_imm()
531 void x86_add_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_add_imm() argument
534 x86_group1_imm(p, 0, dst, imm); in x86_add_imm()
537 void x86_or_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_or_imm() argument
540 x86_group1_imm(p, 1, dst, imm); in x86_or_imm()
543 void x86_and_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_and_imm() argument
546 x86_group1_imm(p, 4, dst, imm); in x86_and_imm()
549 void x86_sub_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_sub_imm() argument
552 x86_group1_imm(p, 5, dst, imm); in x86_sub_imm()
555 void x86_xor_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_xor_imm() argument
558 x86_group1_imm(p, 6, dst, imm); in x86_xor_imm()
561 void x86_cmp_imm( struct x86_function *p, struct x86_reg dst, int imm ) in x86_cmp_imm() argument
564 x86_group1_imm(p, 7, dst, imm); in x86_cmp_imm()
568 void x86_push( struct x86_function *p, in x86_push() argument
573 emit_1ub(p, 0x50 + reg.idx); in x86_push()
576 emit_1ub(p, 0xff); in x86_push()
577 emit_modrm_noreg(p, 6, reg); in x86_push()
581 p->stack_offset += sizeof(void*); in x86_push()
584 void x86_push_imm32( struct x86_function *p, in x86_push_imm32() argument
588 emit_1ub(p, 0x68); in x86_push_imm32()
589 emit_1i(p, imm32); in x86_push_imm32()
591 p->stack_offset += sizeof(void*); in x86_push_imm32()
595 void x86_pop( struct x86_function *p, in x86_pop() argument
600 emit_1ub(p, 0x58 + reg.idx); in x86_pop()
601 p->stack_offset -= sizeof(void*); in x86_pop()
604 void x86_inc( struct x86_function *p, in x86_inc() argument
608 if(x86_target(p) == X86_32 && reg.mod == mod_REG) in x86_inc()
610 emit_1ub(p, 0x40 + reg.idx); in x86_inc()
613 emit_1ub(p, 0xff); in x86_inc()
614 emit_modrm_noreg(p, 0, reg); in x86_inc()
617 void x86_dec( struct x86_function *p, in x86_dec() argument
621 if(x86_target(p) == X86_32 && reg.mod == mod_REG) in x86_dec()
623 emit_1ub(p, 0x48 + reg.idx); in x86_dec()
626 emit_1ub(p, 0xff); in x86_dec()
627 emit_modrm_noreg(p, 1, reg); in x86_dec()
630 void x86_ret( struct x86_function *p ) in x86_ret() argument
633 assert(p->stack_offset == 0); in x86_ret()
634 emit_1ub(p, 0xc3); in x86_ret()
637 void x86_retw( struct x86_function *p, unsigned short imm ) in x86_retw() argument
640 emit_3ub(p, 0xc2, imm & 0xff, (imm >> 8) & 0xff); in x86_retw()
643 void x86_sahf( struct x86_function *p ) in x86_sahf() argument
646 emit_1ub(p, 0x9e); in x86_sahf()
649 void x86_mov( struct x86_function *p, in x86_mov() argument
668 emit_1ub(p, rex); in x86_mov()
670 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x86_mov()
673 void x86_mov16( struct x86_function *p, in x86_mov16() argument
678 emit_1ub(p, 0x66); in x86_mov16()
679 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x86_mov16()
682 void x86_mov8( struct x86_function *p, in x86_mov8() argument
687 emit_op_modrm( p, 0x8a, 0x88, dst, src ); in x86_mov8()
690 void x64_mov64( struct x86_function *p, in x64_mov64() argument
696 assert(x86_target(p) != X86_32); in x64_mov64()
712 emit_1ub(p, rex); in x64_mov64()
713 emit_op_modrm( p, 0x8b, 0x89, dst, src ); in x64_mov64()
716 void x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x86_movzx8() argument
719 emit_2ub(p, 0x0f, 0xb6); in x86_movzx8()
720 emit_modrm(p, dst, src); in x86_movzx8()
723 void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x86_movzx16() argument
726 emit_2ub(p, 0x0f, 0xb7); in x86_movzx16()
727 emit_modrm(p, dst, src); in x86_movzx16()
730 void x86_cmovcc( struct x86_function *p, in x86_cmovcc() argument
736 emit_2ub( p, 0x0f, 0x40 + cc ); in x86_cmovcc()
737 emit_modrm( p, dst, src ); in x86_cmovcc()
740 void x86_xor( struct x86_function *p, in x86_xor() argument
745 emit_op_modrm( p, 0x33, 0x31, dst, src ); in x86_xor()
748 void x86_cmp( struct x86_function *p, in x86_cmp() argument
753 emit_op_modrm( p, 0x3b, 0x39, dst, src ); in x86_cmp()
756 void x86_lea( struct x86_function *p, in x86_lea() argument
761 emit_1ub(p, 0x8d); in x86_lea()
762 emit_modrm( p, dst, src ); in x86_lea()
765 void x86_test( struct x86_function *p, in x86_test() argument
770 emit_1ub(p, 0x85); in x86_test()
771 emit_modrm( p, dst, src ); in x86_test()
774 void x86_add( struct x86_function *p, in x86_add() argument
779 emit_op_modrm(p, 0x03, 0x01, dst, src ); in x86_add()
784 void x86_mul( struct x86_function *p, in x86_mul() argument
788 emit_1ub(p, 0xf7); in x86_mul()
789 emit_modrm_noreg(p, 4, src ); in x86_mul()
793 void x86_imul( struct x86_function *p, in x86_imul() argument
798 emit_2ub(p, X86_TWOB, 0xAF); in x86_imul()
799 emit_modrm(p, dst, src); in x86_imul()
803 void x86_sub( struct x86_function *p, in x86_sub() argument
808 emit_op_modrm(p, 0x2b, 0x29, dst, src ); in x86_sub()
811 void x86_or( struct x86_function *p, in x86_or() argument
816 emit_op_modrm( p, 0x0b, 0x09, dst, src ); in x86_or()
819 void x86_and( struct x86_function *p, in x86_and() argument
824 emit_op_modrm( p, 0x23, 0x21, dst, src ); in x86_and()
827 void x86_div( struct x86_function *p, in x86_div() argument
831 emit_op_modrm(p, 0xf7, 0, x86_make_reg(file_REG32, 6), src); in x86_div()
834 void x86_bswap( struct x86_function *p, struct x86_reg reg ) in x86_bswap() argument
839 emit_2ub(p, 0x0f, 0xc8 + reg.idx); in x86_bswap()
842 void x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_shr_imm() argument
847 emit_1ub(p, 0xd1); in x86_shr_imm()
848 emit_modrm_noreg(p, 5, reg); in x86_shr_imm()
852 emit_1ub(p, 0xc1); in x86_shr_imm()
853 emit_modrm_noreg(p, 5, reg); in x86_shr_imm()
854 emit_1ub(p, imm); in x86_shr_imm()
858 void x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_sar_imm() argument
863 emit_1ub(p, 0xd1); in x86_sar_imm()
864 emit_modrm_noreg(p, 7, reg); in x86_sar_imm()
868 emit_1ub(p, 0xc1); in x86_sar_imm()
869 emit_modrm_noreg(p, 7, reg); in x86_sar_imm()
870 emit_1ub(p, imm); in x86_sar_imm()
874 void x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ) in x86_shl_imm() argument
879 emit_1ub(p, 0xd1); in x86_shl_imm()
880 emit_modrm_noreg(p, 4, reg); in x86_shl_imm()
884 emit_1ub(p, 0xc1); in x86_shl_imm()
885 emit_modrm_noreg(p, 4, reg); in x86_shl_imm()
886 emit_1ub(p, imm); in x86_shl_imm()
895 void sse_prefetchnta( struct x86_function *p, struct x86_reg ptr) in sse_prefetchnta() argument
899 emit_2ub(p, 0x0f, 0x18); in sse_prefetchnta()
900 emit_modrm_noreg(p, 0, ptr); in sse_prefetchnta()
903 void sse_prefetch0( struct x86_function *p, struct x86_reg ptr) in sse_prefetch0() argument
907 emit_2ub(p, 0x0f, 0x18); in sse_prefetch0()
908 emit_modrm_noreg(p, 1, ptr); in sse_prefetch0()
911 void sse_prefetch1( struct x86_function *p, struct x86_reg ptr) in sse_prefetch1() argument
915 emit_2ub(p, 0x0f, 0x18); in sse_prefetch1()
916 emit_modrm_noreg(p, 2, ptr); in sse_prefetch1()
919 void sse_movntps( struct x86_function *p, in sse_movntps() argument
927 emit_2ub(p, 0x0f, 0x2b); in sse_movntps()
928 emit_modrm(p, src, dst); in sse_movntps()
934 void sse_movss( struct x86_function *p, in sse_movss() argument
939 emit_2ub(p, 0xF3, X86_TWOB); in sse_movss()
940 emit_op_modrm( p, 0x10, 0x11, dst, src ); in sse_movss()
943 void sse_movaps( struct x86_function *p, in sse_movaps() argument
948 emit_1ub(p, X86_TWOB); in sse_movaps()
949 emit_op_modrm( p, 0x28, 0x29, dst, src ); in sse_movaps()
952 void sse_movups( struct x86_function *p, in sse_movups() argument
957 emit_1ub(p, X86_TWOB); in sse_movups()
958 emit_op_modrm( p, 0x10, 0x11, dst, src ); in sse_movups()
961 void sse_movhps( struct x86_function *p, in sse_movhps() argument
967 emit_1ub(p, X86_TWOB); in sse_movhps()
968 emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */ in sse_movhps()
971 void sse_movlps( struct x86_function *p, in sse_movlps() argument
977 emit_1ub(p, X86_TWOB); in sse_movlps()
978 emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */ in sse_movlps()
981 void sse_maxps( struct x86_function *p, in sse_maxps() argument
986 emit_2ub(p, X86_TWOB, 0x5F); in sse_maxps()
987 emit_modrm( p, dst, src ); in sse_maxps()
990 void sse_maxss( struct x86_function *p, in sse_maxss() argument
995 emit_3ub(p, 0xF3, X86_TWOB, 0x5F); in sse_maxss()
996 emit_modrm( p, dst, src ); in sse_maxss()
999 void sse_divss( struct x86_function *p, in sse_divss() argument
1004 emit_3ub(p, 0xF3, X86_TWOB, 0x5E); in sse_divss()
1005 emit_modrm( p, dst, src ); in sse_divss()
1008 void sse_minps( struct x86_function *p, in sse_minps() argument
1013 emit_2ub(p, X86_TWOB, 0x5D); in sse_minps()
1014 emit_modrm( p, dst, src ); in sse_minps()
1017 void sse_subps( struct x86_function *p, in sse_subps() argument
1022 emit_2ub(p, X86_TWOB, 0x5C); in sse_subps()
1023 emit_modrm( p, dst, src ); in sse_subps()
1026 void sse_mulps( struct x86_function *p, in sse_mulps() argument
1031 emit_2ub(p, X86_TWOB, 0x59); in sse_mulps()
1032 emit_modrm( p, dst, src ); in sse_mulps()
1035 void sse_mulss( struct x86_function *p, in sse_mulss() argument
1040 emit_3ub(p, 0xF3, X86_TWOB, 0x59); in sse_mulss()
1041 emit_modrm( p, dst, src ); in sse_mulss()
1044 void sse_addps( struct x86_function *p, in sse_addps() argument
1049 emit_2ub(p, X86_TWOB, 0x58); in sse_addps()
1050 emit_modrm( p, dst, src ); in sse_addps()
1053 void sse_addss( struct x86_function *p, in sse_addss() argument
1058 emit_3ub(p, 0xF3, X86_TWOB, 0x58); in sse_addss()
1059 emit_modrm( p, dst, src ); in sse_addss()
1062 void sse_andnps( struct x86_function *p, in sse_andnps() argument
1067 emit_2ub(p, X86_TWOB, 0x55); in sse_andnps()
1068 emit_modrm( p, dst, src ); in sse_andnps()
1071 void sse_andps( struct x86_function *p, in sse_andps() argument
1076 emit_2ub(p, X86_TWOB, 0x54); in sse_andps()
1077 emit_modrm( p, dst, src ); in sse_andps()
1080 void sse_rsqrtps( struct x86_function *p, in sse_rsqrtps() argument
1085 emit_2ub(p, X86_TWOB, 0x52); in sse_rsqrtps()
1086 emit_modrm( p, dst, src ); in sse_rsqrtps()
1089 void sse_rsqrtss( struct x86_function *p, in sse_rsqrtss() argument
1094 emit_3ub(p, 0xF3, X86_TWOB, 0x52); in sse_rsqrtss()
1095 emit_modrm( p, dst, src ); in sse_rsqrtss()
1099 void sse_movhlps( struct x86_function *p, in sse_movhlps() argument
1105 emit_2ub(p, X86_TWOB, 0x12); in sse_movhlps()
1106 emit_modrm( p, dst, src ); in sse_movhlps()
1109 void sse_movlhps( struct x86_function *p, in sse_movlhps() argument
1115 emit_2ub(p, X86_TWOB, 0x16); in sse_movlhps()
1116 emit_modrm( p, dst, src ); in sse_movlhps()
1119 void sse_orps( struct x86_function *p, in sse_orps() argument
1124 emit_2ub(p, X86_TWOB, 0x56); in sse_orps()
1125 emit_modrm( p, dst, src ); in sse_orps()
1128 void sse_xorps( struct x86_function *p, in sse_xorps() argument
1133 emit_2ub(p, X86_TWOB, 0x57); in sse_xorps()
1134 emit_modrm( p, dst, src ); in sse_xorps()
1137 void sse_cvtps2pi( struct x86_function *p, in sse_cvtps2pi() argument
1145 p->need_emms = 1; in sse_cvtps2pi()
1147 emit_2ub(p, X86_TWOB, 0x2d); in sse_cvtps2pi()
1148 emit_modrm( p, dst, src ); in sse_cvtps2pi()
1151 void sse2_cvtdq2ps( struct x86_function *p, in sse2_cvtdq2ps() argument
1156 emit_2ub(p, X86_TWOB, 0x5b); in sse2_cvtdq2ps()
1157 emit_modrm( p, dst, src ); in sse2_cvtdq2ps()
1164 void sse_shufps( struct x86_function *p, in sse_shufps() argument
1170 emit_2ub(p, X86_TWOB, 0xC6); in sse_shufps()
1171 emit_modrm(p, dst, src); in sse_shufps()
1172 emit_1ub(p, shuf); in sse_shufps()
1175 void sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse_unpckhps() argument
1178 emit_2ub( p, X86_TWOB, 0x15 ); in sse_unpckhps()
1179 emit_modrm( p, dst, src ); in sse_unpckhps()
1182 void sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse_unpcklps() argument
1185 emit_2ub( p, X86_TWOB, 0x14 ); in sse_unpcklps()
1186 emit_modrm( p, dst, src ); in sse_unpcklps()
1189 void sse_cmpps( struct x86_function *p, in sse_cmpps() argument
1195 emit_2ub(p, X86_TWOB, 0xC2); in sse_cmpps()
1196 emit_modrm(p, dst, src); in sse_cmpps()
1197 emit_1ub(p, cc); in sse_cmpps()
1200 void sse_pmovmskb( struct x86_function *p, in sse_pmovmskb() argument
1205 emit_3ub(p, 0x66, X86_TWOB, 0xD7); in sse_pmovmskb()
1206 emit_modrm(p, dst, src); in sse_pmovmskb()
1209 void sse_movmskps( struct x86_function *p, in sse_movmskps() argument
1214 emit_2ub(p, X86_TWOB, 0x50); in sse_movmskps()
1215 emit_modrm(p, dst, src); in sse_movmskps()
1222 void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movd() argument
1225 emit_2ub(p, 0x66, 0x0f); in sse2_movd()
1228 emit_1ub(p, 0x7e); in sse2_movd()
1229 emit_modrm(p, src, dst); in sse2_movd()
1233 emit_op_modrm(p, 0x6e, 0x7e, dst, src); in sse2_movd()
1237 void sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movq() argument
1242 emit_3ub(p, 0xf3, 0x0f, 0x7e); in sse2_movq()
1243 emit_modrm(p, dst, src); in sse2_movq()
1249 emit_3ub(p, 0x66, 0x0f, 0xd6); in sse2_movq()
1250 emit_modrm(p, src, dst); in sse2_movq()
1258 void sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movdqu() argument
1261 emit_2ub(p, 0xf3, 0x0f); in sse2_movdqu()
1262 emit_op_modrm(p, 0x6f, 0x7f, dst, src); in sse2_movdqu()
1265 void sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movdqa() argument
1268 emit_2ub(p, 0x66, 0x0f); in sse2_movdqa()
1269 emit_op_modrm(p, 0x6f, 0x7f, dst, src); in sse2_movdqa()
1272 void sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movsd() argument
1275 emit_2ub(p, 0xf2, 0x0f); in sse2_movsd()
1276 emit_op_modrm(p, 0x10, 0x11, dst, src); in sse2_movsd()
1279 void sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movupd() argument
1282 emit_2ub(p, 0x66, 0x0f); in sse2_movupd()
1283 emit_op_modrm(p, 0x10, 0x11, dst, src); in sse2_movupd()
1286 void sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_movapd() argument
1289 emit_2ub(p, 0x66, 0x0f); in sse2_movapd()
1290 emit_op_modrm(p, 0x28, 0x29, dst, src); in sse2_movapd()
1296 void sse2_pshufd( struct x86_function *p, in sse2_pshufd() argument
1302 emit_3ub(p, 0x66, X86_TWOB, 0x70); in sse2_pshufd()
1303 emit_modrm(p, dst, src); in sse2_pshufd()
1304 emit_1ub(p, shuf); in sse2_pshufd()
1307 void sse2_pshuflw( struct x86_function *p, in sse2_pshuflw() argument
1313 emit_3ub(p, 0xf2, X86_TWOB, 0x70); in sse2_pshuflw()
1314 emit_modrm(p, dst, src); in sse2_pshuflw()
1315 emit_1ub(p, shuf); in sse2_pshuflw()
1318 void sse2_pshufhw( struct x86_function *p, in sse2_pshufhw() argument
1324 emit_3ub(p, 0xf3, X86_TWOB, 0x70); in sse2_pshufhw()
1325 emit_modrm(p, dst, src); in sse2_pshufhw()
1326 emit_1ub(p, shuf); in sse2_pshufhw()
1329 void sse2_cvttps2dq( struct x86_function *p, in sse2_cvttps2dq() argument
1334 emit_3ub( p, 0xF3, X86_TWOB, 0x5B ); in sse2_cvttps2dq()
1335 emit_modrm( p, dst, src ); in sse2_cvttps2dq()
1338 void sse2_cvtps2dq( struct x86_function *p, in sse2_cvtps2dq() argument
1343 emit_3ub(p, 0x66, X86_TWOB, 0x5B); in sse2_cvtps2dq()
1344 emit_modrm( p, dst, src ); in sse2_cvtps2dq()
1347 void sse2_cvtsd2ss( struct x86_function *p, in sse2_cvtsd2ss() argument
1352 emit_3ub(p, 0xf2, 0x0f, 0x5a); in sse2_cvtsd2ss()
1353 emit_modrm( p, dst, src ); in sse2_cvtsd2ss()
1356 void sse2_cvtpd2ps( struct x86_function *p, in sse2_cvtpd2ps() argument
1361 emit_3ub(p, 0x66, 0x0f, 0x5a); in sse2_cvtpd2ps()
1362 emit_modrm( p, dst, src ); in sse2_cvtpd2ps()
1365 void sse2_packssdw( struct x86_function *p, in sse2_packssdw() argument
1370 emit_3ub(p, 0x66, X86_TWOB, 0x6B); in sse2_packssdw()
1371 emit_modrm( p, dst, src ); in sse2_packssdw()
1374 void sse2_packsswb( struct x86_function *p, in sse2_packsswb() argument
1379 emit_3ub(p, 0x66, X86_TWOB, 0x63); in sse2_packsswb()
1380 emit_modrm( p, dst, src ); in sse2_packsswb()
1383 void sse2_packuswb( struct x86_function *p, in sse2_packuswb() argument
1388 emit_3ub(p, 0x66, X86_TWOB, 0x67); in sse2_packuswb()
1389 emit_modrm( p, dst, src ); in sse2_packuswb()
1392 void sse2_punpcklbw( struct x86_function *p, in sse2_punpcklbw() argument
1397 emit_3ub(p, 0x66, X86_TWOB, 0x60); in sse2_punpcklbw()
1398 emit_modrm( p, dst, src ); in sse2_punpcklbw()
1401 void sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpcklwd() argument
1404 emit_3ub(p, 0x66, 0x0f, 0x61); in sse2_punpcklwd()
1405 emit_modrm( p, dst, src ); in sse2_punpcklwd()
1408 void sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpckldq() argument
1411 emit_3ub(p, 0x66, 0x0f, 0x62); in sse2_punpckldq()
1412 emit_modrm( p, dst, src ); in sse2_punpckldq()
1415 void sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_punpcklqdq() argument
1418 emit_3ub(p, 0x66, 0x0f, 0x6c); in sse2_punpcklqdq()
1419 emit_modrm( p, dst, src ); in sse2_punpcklqdq()
1422 void sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psllw_imm() argument
1425 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psllw_imm()
1426 emit_modrm_noreg(p, 6, dst); in sse2_psllw_imm()
1427 emit_1ub(p, imm); in sse2_psllw_imm()
1430 void sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_pslld_imm() argument
1433 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_pslld_imm()
1434 emit_modrm_noreg(p, 6, dst); in sse2_pslld_imm()
1435 emit_1ub(p, imm); in sse2_pslld_imm()
1438 void sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psllq_imm() argument
1441 emit_3ub(p, 0x66, 0x0f, 0x73); in sse2_psllq_imm()
1442 emit_modrm_noreg(p, 6, dst); in sse2_psllq_imm()
1443 emit_1ub(p, imm); in sse2_psllq_imm()
1446 void sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrlw_imm() argument
1449 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psrlw_imm()
1450 emit_modrm_noreg(p, 2, dst); in sse2_psrlw_imm()
1451 emit_1ub(p, imm); in sse2_psrlw_imm()
1454 void sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrld_imm() argument
1457 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_psrld_imm()
1458 emit_modrm_noreg(p, 2, dst); in sse2_psrld_imm()
1459 emit_1ub(p, imm); in sse2_psrld_imm()
1462 void sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrlq_imm() argument
1465 emit_3ub(p, 0x66, 0x0f, 0x73); in sse2_psrlq_imm()
1466 emit_modrm_noreg(p, 2, dst); in sse2_psrlq_imm()
1467 emit_1ub(p, imm); in sse2_psrlq_imm()
1470 void sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psraw_imm() argument
1473 emit_3ub(p, 0x66, 0x0f, 0x71); in sse2_psraw_imm()
1474 emit_modrm_noreg(p, 4, dst); in sse2_psraw_imm()
1475 emit_1ub(p, imm); in sse2_psraw_imm()
1478 void sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ) in sse2_psrad_imm() argument
1481 emit_3ub(p, 0x66, 0x0f, 0x72); in sse2_psrad_imm()
1482 emit_modrm_noreg(p, 4, dst); in sse2_psrad_imm()
1483 emit_1ub(p, imm); in sse2_psrad_imm()
1486 void sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in sse2_por() argument
1489 emit_3ub(p, 0x66, 0x0f, 0xeb); in sse2_por()
1490 emit_modrm(p, dst, src); in sse2_por()
1493 void sse2_rcpps( struct x86_function *p, in sse2_rcpps() argument
1498 emit_2ub(p, X86_TWOB, 0x53); in sse2_rcpps()
1499 emit_modrm( p, dst, src ); in sse2_rcpps()
1502 void sse2_rcpss( struct x86_function *p, in sse2_rcpss() argument
1507 emit_3ub(p, 0xF3, X86_TWOB, 0x53); in sse2_rcpss()
1508 emit_modrm( p, dst, src ); in sse2_rcpss()
1514 static void note_x87_pop( struct x86_function *p ) in note_x87_pop() argument
1516 p->x87_stack--; in note_x87_pop()
1517 assert(p->x87_stack >= 0); in note_x87_pop()
1520 static void note_x87_push( struct x86_function *p ) in note_x87_push() argument
1522 p->x87_stack++; in note_x87_push()
1523 assert(p->x87_stack <= 7); in note_x87_push()
1526 void x87_assert_stack_empty( struct x86_function *p ) in x87_assert_stack_empty() argument
1528 assert (p->x87_stack == 0); in x87_assert_stack_empty()
1532 void x87_fist( struct x86_function *p, struct x86_reg dst ) in x87_fist() argument
1535 emit_1ub(p, 0xdb); in x87_fist()
1536 emit_modrm_noreg(p, 2, dst); in x87_fist()
1539 void x87_fistp( struct x86_function *p, struct x86_reg dst ) in x87_fistp() argument
1542 emit_1ub(p, 0xdb); in x87_fistp()
1543 emit_modrm_noreg(p, 3, dst); in x87_fistp()
1544 note_x87_pop(p); in x87_fistp()
1547 void x87_fild( struct x86_function *p, struct x86_reg arg ) in x87_fild() argument
1550 emit_1ub(p, 0xdf); in x87_fild()
1551 emit_modrm_noreg(p, 0, arg); in x87_fild()
1552 note_x87_push(p); in x87_fild()
1555 void x87_fldz( struct x86_function *p ) in x87_fldz() argument
1558 emit_2ub(p, 0xd9, 0xee); in x87_fldz()
1559 note_x87_push(p); in x87_fldz()
1563 void x87_fldcw( struct x86_function *p, struct x86_reg arg ) in x87_fldcw() argument
1568 emit_1ub(p, 0xd9); in x87_fldcw()
1569 emit_modrm_noreg(p, 5, arg); in x87_fldcw()
1572 void x87_fld1( struct x86_function *p ) in x87_fld1() argument
1575 emit_2ub(p, 0xd9, 0xe8); in x87_fld1()
1576 note_x87_push(p); in x87_fld1()
1579 void x87_fldl2e( struct x86_function *p ) in x87_fldl2e() argument
1582 emit_2ub(p, 0xd9, 0xea); in x87_fldl2e()
1583 note_x87_push(p); in x87_fldl2e()
1586 void x87_fldln2( struct x86_function *p ) in x87_fldln2() argument
1589 emit_2ub(p, 0xd9, 0xed); in x87_fldln2()
1590 note_x87_push(p); in x87_fldln2()
1593 void x87_fwait( struct x86_function *p ) in x87_fwait() argument
1596 emit_1ub(p, 0x9b); in x87_fwait()
1599 void x87_fnclex( struct x86_function *p ) in x87_fnclex() argument
1602 emit_2ub(p, 0xdb, 0xe2); in x87_fnclex()
1605 void x87_fclex( struct x86_function *p ) in x87_fclex() argument
1607 x87_fwait(p); in x87_fclex()
1608 x87_fnclex(p); in x87_fclex()
1611 void x87_fcmovb( struct x86_function *p, struct x86_reg arg ) in x87_fcmovb() argument
1615 emit_2ub(p, 0xda, 0xc0+arg.idx); in x87_fcmovb()
1618 void x87_fcmove( struct x86_function *p, struct x86_reg arg ) in x87_fcmove() argument
1622 emit_2ub(p, 0xda, 0xc8+arg.idx); in x87_fcmove()
1625 void x87_fcmovbe( struct x86_function *p, struct x86_reg arg ) in x87_fcmovbe() argument
1629 emit_2ub(p, 0xda, 0xd0+arg.idx); in x87_fcmovbe()
1632 void x87_fcmovnb( struct x86_function *p, struct x86_reg arg ) in x87_fcmovnb() argument
1636 emit_2ub(p, 0xdb, 0xc0+arg.idx); in x87_fcmovnb()
1639 void x87_fcmovne( struct x86_function *p, struct x86_reg arg ) in x87_fcmovne() argument
1643 emit_2ub(p, 0xdb, 0xc8+arg.idx); in x87_fcmovne()
1646 void x87_fcmovnbe( struct x86_function *p, struct x86_reg arg ) in x87_fcmovnbe() argument
1650 emit_2ub(p, 0xdb, 0xd0+arg.idx); in x87_fcmovnbe()
1655 static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, in x87_arith_op() argument
1666 emit_2ub(p, dst0ub0, dst0ub1+arg.idx); in x87_arith_op()
1668 emit_2ub(p, arg0ub0, arg0ub1+arg.idx); in x87_arith_op()
1674 emit_1ub(p, 0xd8); in x87_arith_op()
1675 emit_modrm_noreg(p, argmem_noreg, arg); in x87_arith_op()
1681 void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fmul() argument
1684 x87_arith_op(p, dst, src, in x87_fmul()
1690 void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fsub() argument
1693 x87_arith_op(p, dst, src, in x87_fsub()
1699 void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fsubr() argument
1702 x87_arith_op(p, dst, src, in x87_fsubr()
1708 void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fadd() argument
1711 x87_arith_op(p, dst, src, in x87_fadd()
1717 void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fdiv() argument
1720 x87_arith_op(p, dst, src, in x87_fdiv()
1726 void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) in x87_fdivr() argument
1729 x87_arith_op(p, dst, src, in x87_fdivr()
1735 void x87_fmulp( struct x86_function *p, struct x86_reg dst ) in x87_fmulp() argument
1740 emit_2ub(p, 0xde, 0xc8+dst.idx); in x87_fmulp()
1741 note_x87_pop(p); in x87_fmulp()
1744 void x87_fsubp( struct x86_function *p, struct x86_reg dst ) in x87_fsubp() argument
1749 emit_2ub(p, 0xde, 0xe8+dst.idx); in x87_fsubp()
1750 note_x87_pop(p); in x87_fsubp()
1753 void x87_fsubrp( struct x86_function *p, struct x86_reg dst ) in x87_fsubrp() argument
1758 emit_2ub(p, 0xde, 0xe0+dst.idx); in x87_fsubrp()
1759 note_x87_pop(p); in x87_fsubrp()
1762 void x87_faddp( struct x86_function *p, struct x86_reg dst ) in x87_faddp() argument
1767 emit_2ub(p, 0xde, 0xc0+dst.idx); in x87_faddp()
1768 note_x87_pop(p); in x87_faddp()
1771 void x87_fdivp( struct x86_function *p, struct x86_reg dst ) in x87_fdivp() argument
1776 emit_2ub(p, 0xde, 0xf8+dst.idx); in x87_fdivp()
1777 note_x87_pop(p); in x87_fdivp()
1780 void x87_fdivrp( struct x86_function *p, struct x86_reg dst ) in x87_fdivrp() argument
1785 emit_2ub(p, 0xde, 0xf0+dst.idx); in x87_fdivrp()
1786 note_x87_pop(p); in x87_fdivrp()
1789 void x87_ftst( struct x86_function *p ) in x87_ftst() argument
1792 emit_2ub(p, 0xd9, 0xe4); in x87_ftst()
1795 void x87_fucom( struct x86_function *p, struct x86_reg arg ) in x87_fucom() argument
1799 emit_2ub(p, 0xdd, 0xe0+arg.idx); in x87_fucom()
1802 void x87_fucomp( struct x86_function *p, struct x86_reg arg ) in x87_fucomp() argument
1806 emit_2ub(p, 0xdd, 0xe8+arg.idx); in x87_fucomp()
1807 note_x87_pop(p); in x87_fucomp()
1810 void x87_fucompp( struct x86_function *p ) in x87_fucompp() argument
1813 emit_2ub(p, 0xda, 0xe9); in x87_fucompp()
1814 note_x87_pop(p); /* pop twice */ in x87_fucompp()
1815 note_x87_pop(p); /* pop twice */ in x87_fucompp()
1818 void x87_fxch( struct x86_function *p, struct x86_reg arg ) in x87_fxch() argument
1822 emit_2ub(p, 0xd9, 0xc8+arg.idx); in x87_fxch()
1825 void x87_fabs( struct x86_function *p ) in x87_fabs() argument
1828 emit_2ub(p, 0xd9, 0xe1); in x87_fabs()
1831 void x87_fchs( struct x86_function *p ) in x87_fchs() argument
1834 emit_2ub(p, 0xd9, 0xe0); in x87_fchs()
1837 void x87_fcos( struct x86_function *p ) in x87_fcos() argument
1840 emit_2ub(p, 0xd9, 0xff); in x87_fcos()
1844 void x87_fprndint( struct x86_function *p ) in x87_fprndint() argument
1847 emit_2ub(p, 0xd9, 0xfc); in x87_fprndint()
1850 void x87_fscale( struct x86_function *p ) in x87_fscale() argument
1853 emit_2ub(p, 0xd9, 0xfd); in x87_fscale()
1856 void x87_fsin( struct x86_function *p ) in x87_fsin() argument
1859 emit_2ub(p, 0xd9, 0xfe); in x87_fsin()
1862 void x87_fsincos( struct x86_function *p ) in x87_fsincos() argument
1865 emit_2ub(p, 0xd9, 0xfb); in x87_fsincos()
1868 void x87_fsqrt( struct x86_function *p ) in x87_fsqrt() argument
1871 emit_2ub(p, 0xd9, 0xfa); in x87_fsqrt()
1874 void x87_fxtract( struct x86_function *p ) in x87_fxtract() argument
1877 emit_2ub(p, 0xd9, 0xf4); in x87_fxtract()
1884 void x87_f2xm1( struct x86_function *p ) in x87_f2xm1() argument
1887 emit_2ub(p, 0xd9, 0xf0); in x87_f2xm1()
1893 void x87_fyl2x( struct x86_function *p ) in x87_fyl2x() argument
1896 emit_2ub(p, 0xd9, 0xf1); in x87_fyl2x()
1897 note_x87_pop(p); in x87_fyl2x()
1905 void x87_fyl2xp1( struct x86_function *p ) in x87_fyl2xp1() argument
1908 emit_2ub(p, 0xd9, 0xf9); in x87_fyl2xp1()
1909 note_x87_pop(p); in x87_fyl2xp1()
1913 void x87_fld( struct x86_function *p, struct x86_reg arg ) in x87_fld() argument
1917 emit_2ub(p, 0xd9, 0xc0 + arg.idx); in x87_fld()
1919 emit_1ub(p, 0xd9); in x87_fld()
1920 emit_modrm_noreg(p, 0, arg); in x87_fld()
1922 note_x87_push(p); in x87_fld()
1925 void x87_fst( struct x86_function *p, struct x86_reg dst ) in x87_fst() argument
1929 emit_2ub(p, 0xdd, 0xd0 + dst.idx); in x87_fst()
1931 emit_1ub(p, 0xd9); in x87_fst()
1932 emit_modrm_noreg(p, 2, dst); in x87_fst()
1936 void x87_fstp( struct x86_function *p, struct x86_reg dst ) in x87_fstp() argument
1940 emit_2ub(p, 0xdd, 0xd8 + dst.idx); in x87_fstp()
1942 emit_1ub(p, 0xd9); in x87_fstp()
1943 emit_modrm_noreg(p, 3, dst); in x87_fstp()
1945 note_x87_pop(p); in x87_fstp()
1948 void x87_fpop( struct x86_function *p ) in x87_fpop() argument
1950 x87_fstp( p, x86_make_reg( file_x87, 0 )); in x87_fpop()
1954 void x87_fcom( struct x86_function *p, struct x86_reg dst ) in x87_fcom() argument
1958 emit_2ub(p, 0xd8, 0xd0 + dst.idx); in x87_fcom()
1960 emit_1ub(p, 0xd8); in x87_fcom()
1961 emit_modrm_noreg(p, 2, dst); in x87_fcom()
1966 void x87_fcomp( struct x86_function *p, struct x86_reg dst ) in x87_fcomp() argument
1970 emit_2ub(p, 0xd8, 0xd8 + dst.idx); in x87_fcomp()
1972 emit_1ub(p, 0xd8); in x87_fcomp()
1973 emit_modrm_noreg(p, 3, dst); in x87_fcomp()
1975 note_x87_pop(p); in x87_fcomp()
1978 void x87_fcomi( struct x86_function *p, struct x86_reg arg ) in x87_fcomi() argument
1981 emit_2ub(p, 0xdb, 0xf0+arg.idx); in x87_fcomi()
1984 void x87_fcomip( struct x86_function *p, struct x86_reg arg ) in x87_fcomip() argument
1987 emit_2ub(p, 0xdb, 0xf0+arg.idx); in x87_fcomip()
1988 note_x87_pop(p); in x87_fcomip()
1992 void x87_fnstsw( struct x86_function *p, struct x86_reg dst ) in x87_fnstsw() argument
1999 emit_2ub(p, 0xdf, 0xe0); in x87_fnstsw()
2001 emit_1ub(p, 0xdd); in x87_fnstsw()
2002 emit_modrm_noreg(p, 7, dst); in x87_fnstsw()
2007 void x87_fnstcw( struct x86_function *p, struct x86_reg dst ) in x87_fnstcw() argument
2012 emit_1ub(p, 0x9b); /* WAIT -- needed? */ in x87_fnstcw()
2013 emit_1ub(p, 0xd9); in x87_fnstcw()
2014 emit_modrm_noreg(p, 7, dst); in x87_fnstcw()
2024 void mmx_emms( struct x86_function *p ) in mmx_emms() argument
2027 assert(p->need_emms); in mmx_emms()
2028 emit_2ub(p, 0x0f, 0x77); in mmx_emms()
2029 p->need_emms = 0; in mmx_emms()
2032 void mmx_packssdw( struct x86_function *p, in mmx_packssdw() argument
2040 p->need_emms = 1; in mmx_packssdw()
2042 emit_2ub(p, X86_TWOB, 0x6b); in mmx_packssdw()
2043 emit_modrm( p, dst, src ); in mmx_packssdw()
2046 void mmx_packuswb( struct x86_function *p, in mmx_packuswb() argument
2054 p->need_emms = 1; in mmx_packuswb()
2056 emit_2ub(p, X86_TWOB, 0x67); in mmx_packuswb()
2057 emit_modrm( p, dst, src ); in mmx_packuswb()
2060 void mmx_movd( struct x86_function *p, in mmx_movd() argument
2065 p->need_emms = 1; in mmx_movd()
2066 emit_1ub(p, X86_TWOB); in mmx_movd()
2067 emit_op_modrm( p, 0x6e, 0x7e, dst, src ); in mmx_movd()
2070 void mmx_movq( struct x86_function *p, in mmx_movq() argument
2075 p->need_emms = 1; in mmx_movq()
2076 emit_1ub(p, X86_TWOB); in mmx_movq()
2077 emit_op_modrm( p, 0x6f, 0x7f, dst, src ); in mmx_movq()
2086 void x86_cdecl_caller_push_regs( struct x86_function *p ) in x86_cdecl_caller_push_regs() argument
2088 x86_push(p, x86_make_reg(file_REG32, reg_AX)); in x86_cdecl_caller_push_regs()
2089 x86_push(p, x86_make_reg(file_REG32, reg_CX)); in x86_cdecl_caller_push_regs()
2090 x86_push(p, x86_make_reg(file_REG32, reg_DX)); in x86_cdecl_caller_push_regs()
2093 void x86_cdecl_caller_pop_regs( struct x86_function *p ) in x86_cdecl_caller_pop_regs() argument
2095 x86_pop(p, x86_make_reg(file_REG32, reg_DX)); in x86_cdecl_caller_pop_regs()
2096 x86_pop(p, x86_make_reg(file_REG32, reg_CX)); in x86_cdecl_caller_pop_regs()
2097 x86_pop(p, x86_make_reg(file_REG32, reg_AX)); in x86_cdecl_caller_pop_regs()
2101 struct x86_reg x86_fn_arg( struct x86_function *p, in x86_fn_arg() argument
2104 switch(x86_target(p)) in x86_fn_arg()
2121 p->stack_offset + arg * 8); in x86_fn_arg()
2140 p->stack_offset + (arg - 6) * 8); /* ??? */ in x86_fn_arg()
2144 p->stack_offset + arg * 4); /* ??? */ in x86_fn_arg()
2151 static void x86_init_func_common( struct x86_function *p ) in x86_init_func_common() argument
2154 p->caps = 0; in x86_init_func_common()
2156 p->caps |= X86_MMX; in x86_init_func_common()
2158 p->caps |= X86_MMX2; in x86_init_func_common()
2160 p->caps |= X86_SSE; in x86_init_func_common()
2162 p->caps |= X86_SSE2; in x86_init_func_common()
2164 p->caps |= X86_SSE3; in x86_init_func_common()
2166 p->caps |= X86_SSE4_1; in x86_init_func_common()
2167 p->csr = p->store; in x86_init_func_common()
2171 void x86_init_func( struct x86_function *p ) in x86_init_func() argument
2173 p->size = 0; in x86_init_func()
2174 p->store = NULL; in x86_init_func()
2175 x86_init_func_common(p); in x86_init_func()
2178 void x86_init_func_size( struct x86_function *p, unsigned code_size ) in x86_init_func_size() argument
2180 p->size = code_size; in x86_init_func_size()
2181 p->store = rtasm_exec_malloc(code_size); in x86_init_func_size()
2182 if (p->store == NULL) { in x86_init_func_size()
2183 p->store = p->error_overflow; in x86_init_func_size()
2185 x86_init_func_common(p); in x86_init_func_size()
2188 void x86_release_func( struct x86_function *p ) in x86_release_func() argument
2190 if (p->store && p->store != p->error_overflow) in x86_release_func()
2191 rtasm_exec_free(p->store); in x86_release_func()
2193 p->store = NULL; in x86_release_func()
2194 p->csr = NULL; in x86_release_func()
2195 p->size = 0; in x86_release_func()
2212 x86_func x86_get_func( struct x86_function *p ) in x86_get_func() argument
2215 if (DISASSEM && p->store) in x86_get_func()
2216 debug_printf("disassemble %p %p\n", p->store, p->csr); in x86_get_func()
2218 if (p->store == p->error_overflow) in x86_get_func()
2221 return voidptr_to_x86_func(p->store); in x86_get_func()