summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_x86sse.c267
1 files changed, 243 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
index 7f8cc23d15e..f2c08c96a6f 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
@@ -34,6 +34,116 @@
#define X86_TWOB 0x0f
+#define DUMP_SSE 0
+
+#if DUMP_SSE
+
+static void
+_print_reg(
+ struct x86_reg reg )
+{
+ if (reg.mod != mod_REG)
+ debug_printf( "[" );
+
+ switch( reg.file ) {
+ case file_REG32:
+ switch( reg.idx ) {
+ case reg_AX: debug_printf( "EAX" ); break;
+ case reg_CX: debug_printf( "ECX" ); break;
+ case reg_DX: debug_printf( "EDX" ); break;
+ case reg_BX: debug_printf( "EBX" ); break;
+ case reg_SP: debug_printf( "ESP" ); break;
+ case reg_BP: debug_printf( "EBP" ); break;
+ case reg_SI: debug_printf( "ESI" ); break;
+ case reg_DI: debug_printf( "EDI" ); break;
+ }
+ break;
+ case file_MMX:
+ debug_printf( "MMX%u", reg.idx );
+ break;
+ case file_XMM:
+ debug_printf( "XMM%u", reg.idx );
+ break;
+ case file_x87:
+ debug_printf( "fp%u", reg.idx );
+ break;
+ }
+
+ if (reg.mod == mod_DISP8 ||
+ reg.mod == mod_DISP32)
+ debug_printf("+%d", reg.disp);
+
+ if (reg.mod != mod_REG)
+ debug_printf( "]" );
+}
+
+static void
+_fill(
+ const char *op )
+{
+ unsigned count = 10 - strlen( op );
+
+ while( count-- ) {
+ debug_printf( " " );
+ }
+}
+
+#define DUMP_START() debug_printf( "\nsse-dump start ----------------" )
+#define DUMP_END() debug_printf( "\nsse-dump end ----------------\n" )
+#define DUMP( OP ) debug_printf( "\n%s", OP )
+
+#define DUMP_I( OP, I ) do { \
+ debug_printf( "\n%s", OP ); \
+ _fill( OP ); \
+ debug_printf( "%u", I ); \
+} while( 0 )
+
+#define DUMP_R( OP, R0 ) do { \
+ debug_printf( "\n%s", OP ); \
+ _fill( OP ); \
+ _print_reg( R0 ); \
+} while( 0 )
+
+#define DUMP_RR( OP, R0, R1 ) do { \
+ debug_printf( "\n%s", OP ); \
+ _fill( OP ); \
+ _print_reg( R0 ); \
+ debug_printf( ", " ); \
+ _print_reg( R1 ); \
+} while( 0 )
+
+#define DUMP_RI( OP, R0, I ) do { \
+ debug_printf( "\n%s", OP ); \
+ _fill( OP ); \
+ _print_reg( R0 ); \
+ debug_printf( ", " ); \
+ debug_printf( "%u", I ); \
+} while( 0 )
+
+#define DUMP_RRI( OP, R0, R1, I ) do { \
+ debug_printf( "\n%s", OP ); \
+ _fill( OP ); \
+ _print_reg( R0 ); \
+ debug_printf( ", " ); \
+ _print_reg( R1 ); \
+ debug_printf( ", " ); \
+ debug_printf( "%u", I ); \
+} while( 0 )
+
+#else
+
+#define DUMP_START()
+#define DUMP_END()
+#define DUMP( OP )
+#define DUMP_I( OP, I )
+#define DUMP_R( OP, R0 )
+#define DUMP_RR( OP, R0, R1 )
+#define DUMP_RI( OP, R0, I )
+#define DUMP_RRI( OP, R0, R1, I )
+
+#endif
+
+
static void do_realloc( struct x86_function *p )
{
if (p->size == 0) {
@@ -272,6 +382,7 @@ unsigned char *x86_jcc_forward( struct x86_function *p,
unsigned char *x86_jmp_forward( struct x86_function *p)
{
+ DUMP( __FUNCTION__ );
emit_1ub(p, 0xe9);
emit_1i(p, 0);
return x86_get_label(p);
@@ -279,6 +390,8 @@ unsigned char *x86_jmp_forward( struct x86_function *p)
unsigned char *x86_call_forward( struct x86_function *p)
{
+ DUMP( __FUNCTION__ );
+
emit_1ub(p, 0xe8);
emit_1i(p, 0);
return x86_get_label(p);
@@ -294,6 +407,7 @@ void x86_fixup_fwd_jump( struct x86_function *p,
void x86_jmp( struct x86_function *p, unsigned char *label)
{
+ DUMP_I( __FUNCTION__, label );
emit_1ub(p, 0xe9);
emit_1i(p, pointer_to_intptr( label ) - pointer_to_intptr( x86_get_label(p) ) - 4);
}
@@ -310,12 +424,14 @@ static unsigned char *cptr( void (*label)() )
*/
void x86_call( struct x86_function *p, void (*label)())
{
+ DUMP_I( __FUNCTION__, label );
emit_1ub(p, 0xe8);
emit_1i(p, cptr(label) - x86_get_label(p) - 4);
}
#else
void x86_call( struct x86_function *p, struct x86_reg reg)
{
+ DUMP_R( __FUNCTION__, reg );
emit_1ub(p, 0xff);
emit_modrm_noreg(p, 2, reg);
}
@@ -328,6 +444,7 @@ void x86_call( struct x86_function *p, struct x86_reg reg)
*/
void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm )
{
+ DUMP_RI( __FUNCTION__, dst, imm );
assert(dst.mod == mod_REG);
emit_1ub(p, 0xb8 + dst.idx);
emit_1i(p, imm);
@@ -336,6 +453,7 @@ void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm )
void x86_push( struct x86_function *p,
struct x86_reg reg )
{
+ DUMP_R( __FUNCTION__, reg );
assert(reg.mod == mod_REG);
emit_1ub(p, 0x50 + reg.idx);
p->stack_offset += 4;
@@ -344,6 +462,7 @@ void x86_push( struct x86_function *p,
void x86_pop( struct x86_function *p,
struct x86_reg reg )
{
+ DUMP_R( __FUNCTION__, reg );
assert(reg.mod == mod_REG);
emit_1ub(p, 0x58 + reg.idx);
p->stack_offset -= 4;
@@ -352,6 +471,7 @@ void x86_pop( struct x86_function *p,
void x86_inc( struct x86_function *p,
struct x86_reg reg )
{
+ DUMP_R( __FUNCTION__, reg );
assert(reg.mod == mod_REG);
emit_1ub(p, 0x40 + reg.idx);
}
@@ -359,17 +479,20 @@ void x86_inc( struct x86_function *p,
void x86_dec( struct x86_function *p,
struct x86_reg reg )
{
+ DUMP_R( __FUNCTION__, reg );
assert(reg.mod == mod_REG);
emit_1ub(p, 0x48 + reg.idx);
}
void x86_ret( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_1ub(p, 0xc3);
}
void x86_sahf( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_1ub(p, 0x9e);
}
@@ -377,6 +500,7 @@ void x86_mov( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm( p, 0x8b, 0x89, dst, src );
}
@@ -384,6 +508,7 @@ void x86_xor( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm( p, 0x33, 0x31, dst, src );
}
@@ -391,6 +516,7 @@ void x86_cmp( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm( p, 0x3b, 0x39, dst, src );
}
@@ -398,6 +524,7 @@ void x86_lea( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_1ub(p, 0x8d);
emit_modrm( p, dst, src );
}
@@ -406,6 +533,7 @@ void x86_test( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_1ub(p, 0x85);
emit_modrm( p, dst, src );
}
@@ -414,6 +542,7 @@ void x86_add( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm(p, 0x03, 0x01, dst, src );
}
@@ -422,6 +551,7 @@ void x86_add( struct x86_function *p,
void x86_mul( struct x86_function *p,
struct x86_reg src )
{
+ DUMP_R( __FUNCTION__, src );
emit_1ub(p, 0xf7);
emit_modrm_noreg(p, 4, src );
}
@@ -431,6 +561,7 @@ void x86_imul( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0xAF);
emit_modrm(p, dst, src);
}
@@ -440,6 +571,7 @@ void x86_sub( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm(p, 0x2b, 0x29, dst, src );
}
@@ -447,6 +579,7 @@ void x86_or( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm( p, 0x0b, 0x09, dst, src );
}
@@ -454,6 +587,7 @@ void x86_and( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_op_modrm( p, 0x23, 0x21, dst, src );
}
@@ -468,6 +602,7 @@ void sse_movss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, 0xF3, X86_TWOB);
emit_op_modrm( p, 0x10, 0x11, dst, src );
}
@@ -476,6 +611,7 @@ void sse_movaps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x28, 0x29, dst, src );
}
@@ -484,6 +620,7 @@ void sse_movups( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x10, 0x11, dst, src );
}
@@ -492,6 +629,7 @@ void sse_movhps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.mod != mod_REG || src.mod != mod_REG);
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x16, 0x17, dst, src ); /* cf movlhps */
@@ -501,6 +639,7 @@ void sse_movlps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.mod != mod_REG || src.mod != mod_REG);
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x12, 0x13, dst, src ); /* cf movhlps */
@@ -510,6 +649,7 @@ void sse_maxps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x5F);
emit_modrm( p, dst, src );
}
@@ -518,6 +658,7 @@ void sse_maxss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x5F);
emit_modrm( p, dst, src );
}
@@ -526,6 +667,7 @@ void sse_divss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x5E);
emit_modrm( p, dst, src );
}
@@ -534,6 +676,7 @@ void sse_minps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x5D);
emit_modrm( p, dst, src );
}
@@ -542,6 +685,7 @@ void sse_subps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x5C);
emit_modrm( p, dst, src );
}
@@ -550,6 +694,7 @@ void sse_mulps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x59);
emit_modrm( p, dst, src );
}
@@ -558,6 +703,7 @@ void sse_mulss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x59);
emit_modrm( p, dst, src );
}
@@ -566,6 +712,7 @@ void sse_addps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x58);
emit_modrm( p, dst, src );
}
@@ -574,6 +721,7 @@ void sse_addss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x58);
emit_modrm( p, dst, src );
}
@@ -582,6 +730,7 @@ void sse_andnps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x55);
emit_modrm( p, dst, src );
}
@@ -590,6 +739,7 @@ void sse_andps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x54);
emit_modrm( p, dst, src );
}
@@ -598,6 +748,7 @@ void sse_rsqrtps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x52);
emit_modrm( p, dst, src );
}
@@ -606,6 +757,7 @@ void sse_rsqrtss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x52);
emit_modrm( p, dst, src );
@@ -615,6 +767,7 @@ void sse_movhlps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.mod == mod_REG && src.mod == mod_REG);
emit_2ub(p, X86_TWOB, 0x12);
emit_modrm( p, dst, src );
@@ -624,6 +777,7 @@ void sse_movlhps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.mod == mod_REG && src.mod == mod_REG);
emit_2ub(p, X86_TWOB, 0x16);
emit_modrm( p, dst, src );
@@ -633,6 +787,7 @@ void sse_orps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x56);
emit_modrm( p, dst, src );
}
@@ -641,6 +796,7 @@ void sse_xorps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x57);
emit_modrm( p, dst, src );
}
@@ -649,6 +805,7 @@ void sse_cvtps2pi( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.file == file_MMX &&
(src.file == file_XMM || src.mod != mod_REG));
@@ -662,6 +819,7 @@ void sse2_cvtdq2ps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x5b);
emit_modrm( p, dst, src );
}
@@ -671,31 +829,34 @@ void sse2_cvtdq2ps( struct x86_function *p,
* arg0.
*/
void sse_shufps( struct x86_function *p,
- struct x86_reg dest,
- struct x86_reg arg0,
+ struct x86_reg dst,
+ struct x86_reg src,
unsigned char shuf)
{
+ DUMP_RRI( __FUNCTION__, dst, src, shuf );
emit_2ub(p, X86_TWOB, 0xC6);
- emit_modrm(p, dest, arg0);
+ emit_modrm(p, dst, src);
emit_1ub(p, shuf);
}
void sse_cmpps( struct x86_function *p,
- struct x86_reg dest,
- struct x86_reg arg0,
+ struct x86_reg dst,
+ struct x86_reg src,
unsigned char cc)
{
+ DUMP_RRI( "CMPPS", dst, src, cc );
emit_2ub(p, X86_TWOB, 0xC2);
- emit_modrm(p, dest, arg0);
+ emit_modrm(p, dst, src);
emit_1ub(p, cc);
}
void sse_pmovmskb( struct x86_function *p,
- struct x86_reg dest,
+ struct x86_reg dst,
struct x86_reg src)
{
- emit_3ub(p, 0x66, X86_TWOB, 0xD7);
- emit_modrm(p, dest, src);
+ DUMP_RR( __FUNCTION__, dst, src );
+ emit_3ub(p, 0x66, X86_TWOB, 0xD7);
+ emit_modrm(p, dst, src);
}
/***********************************************************************
@@ -706,12 +867,13 @@ void sse_pmovmskb( struct x86_function *p,
* Perform a reduced swizzle:
*/
void sse2_pshufd( struct x86_function *p,
- struct x86_reg dest,
- struct x86_reg arg0,
+ struct x86_reg dst,
+ struct x86_reg src,
unsigned char shuf)
{
+ DUMP_RRI( __FUNCTION__, dst, src, shuf );
emit_3ub(p, 0x66, X86_TWOB, 0x70);
- emit_modrm(p, dest, arg0);
+ emit_modrm(p, dst, src);
emit_1ub(p, shuf);
}
@@ -719,6 +881,7 @@ void sse2_cvttps2dq( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub( p, 0xF3, X86_TWOB, 0x5B );
emit_modrm( p, dst, src );
}
@@ -727,6 +890,7 @@ void sse2_cvtps2dq( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0x66, X86_TWOB, 0x5B);
emit_modrm( p, dst, src );
}
@@ -735,6 +899,7 @@ void sse2_packssdw( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0x66, X86_TWOB, 0x6B);
emit_modrm( p, dst, src );
}
@@ -743,6 +908,7 @@ void sse2_packsswb( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0x66, X86_TWOB, 0x63);
emit_modrm( p, dst, src );
}
@@ -751,6 +917,7 @@ void sse2_packuswb( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0x66, X86_TWOB, 0x67);
emit_modrm( p, dst, src );
}
@@ -759,6 +926,7 @@ void sse2_punpcklbw( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0x66, X86_TWOB, 0x60);
emit_modrm( p, dst, src );
}
@@ -768,6 +936,7 @@ void sse2_rcpps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, X86_TWOB, 0x53);
emit_modrm( p, dst, src );
}
@@ -776,6 +945,7 @@ void sse2_rcpss( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_3ub(p, 0xF3, X86_TWOB, 0x53);
emit_modrm( p, dst, src );
}
@@ -784,6 +954,7 @@ void sse2_movd( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
emit_2ub(p, 0x66, X86_TWOB);
emit_op_modrm( p, 0x6e, 0x7e, dst, src );
}
@@ -796,30 +967,35 @@ void sse2_movd( struct x86_function *p,
*/
void x87_fist( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
emit_1ub(p, 0xdb);
emit_modrm_noreg(p, 2, dst);
}
void x87_fistp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
emit_1ub(p, 0xdb);
emit_modrm_noreg(p, 3, dst);
}
void x87_fild( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
emit_1ub(p, 0xdf);
emit_modrm_noreg(p, 0, arg);
}
void x87_fldz( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xee);
}
void x87_fldcw( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
assert(arg.file == file_REG32);
assert(arg.mod != mod_REG);
emit_1ub(p, 0xd9);
@@ -828,26 +1004,31 @@ void x87_fldcw( struct x86_function *p, struct x86_reg arg )
void x87_fld1( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xe8);
}
void x87_fldl2e( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xea);
}
void x87_fldln2( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xed);
}
void x87_fwait( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_1ub(p, 0x9b);
}
void x87_fnclex( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xdb, 0xe2);
}
@@ -884,49 +1065,55 @@ static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86
assert(0);
}
-void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xc8,
0xdc, 0xc8,
4);
}
-void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xe0,
0xdc, 0xe8,
4);
}
-void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xe8,
0xdc, 0xe0,
5);
}
-void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xc0,
0xdc, 0xc0,
0);
}
-void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xf0,
0xdc, 0xf8,
6);
}
-void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
+void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
{
- x87_arith_op(p, dst, arg,
+ DUMP_RR( __FUNCTION__, dst, src );
+ x87_arith_op(p, dst, src,
0xd8, 0xf8,
0xdc, 0xf0,
7);
@@ -934,6 +1121,7 @@ void x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg )
void x87_fmulp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xc8+dst.idx);
@@ -941,6 +1129,7 @@ void x87_fmulp( struct x86_function *p, struct x86_reg dst )
void x87_fsubp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xe8+dst.idx);
@@ -948,6 +1137,7 @@ void x87_fsubp( struct x86_function *p, struct x86_reg dst )
void x87_fsubrp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xe0+dst.idx);
@@ -955,6 +1145,7 @@ void x87_fsubrp( struct x86_function *p, struct x86_reg dst )
void x87_faddp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xc0+dst.idx);
@@ -962,6 +1153,7 @@ void x87_faddp( struct x86_function *p, struct x86_reg dst )
void x87_fdivp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xf8+dst.idx);
@@ -969,6 +1161,7 @@ void x87_fdivp( struct x86_function *p, struct x86_reg dst )
void x87_fdivrp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_x87);
assert(dst.idx >= 1);
emit_2ub(p, 0xde, 0xf0+dst.idx);
@@ -976,70 +1169,83 @@ void x87_fdivrp( struct x86_function *p, struct x86_reg dst )
void x87_fucom( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
assert(arg.file == file_x87);
emit_2ub(p, 0xdd, 0xe0+arg.idx);
}
void x87_fucomp( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
assert(arg.file == file_x87);
emit_2ub(p, 0xdd, 0xe8+arg.idx);
}
void x87_fucompp( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xda, 0xe9);
}
void x87_fxch( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
assert(arg.file == file_x87);
emit_2ub(p, 0xd9, 0xc8+arg.idx);
}
void x87_fabs( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xe1);
}
void x87_fchs( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xe0);
}
void x87_fcos( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xff);
}
void x87_fprndint( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xfc);
}
void x87_fscale( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xfd);
}
void x87_fsin( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xfe);
}
void x87_fsincos( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xfb);
}
void x87_fsqrt( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xfa);
}
void x87_fxtract( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xf4);
}
@@ -1049,6 +1255,7 @@ void x87_fxtract( struct x86_function *p )
*/
void x87_f2xm1( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xf0);
}
@@ -1057,6 +1264,7 @@ void x87_f2xm1( struct x86_function *p )
*/
void x87_fyl2x( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xf1);
}
@@ -1067,12 +1275,14 @@ void x87_fyl2x( struct x86_function *p )
*/
void x87_fyl2xp1( struct x86_function *p )
{
+ DUMP( __FUNCTION__ );
emit_2ub(p, 0xd9, 0xf9);
}
void x87_fld( struct x86_function *p, struct x86_reg arg )
{
+ DUMP_R( __FUNCTION__, arg );
if (arg.file == file_x87)
emit_2ub(p, 0xd9, 0xc0 + arg.idx);
else {
@@ -1083,6 +1293,7 @@ void x87_fld( struct x86_function *p, struct x86_reg arg )
void x87_fst( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
if (dst.file == file_x87)
emit_2ub(p, 0xdd, 0xd0 + dst.idx);
else {
@@ -1093,6 +1304,7 @@ void x87_fst( struct x86_function *p, struct x86_reg dst )
void x87_fstp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
if (dst.file == file_x87)
emit_2ub(p, 0xdd, 0xd8 + dst.idx);
else {
@@ -1103,6 +1315,7 @@ void x87_fstp( struct x86_function *p, struct x86_reg dst )
void x87_fcom( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
if (dst.file == file_x87)
emit_2ub(p, 0xd8, 0xd0 + dst.idx);
else {
@@ -1113,6 +1326,7 @@ void x87_fcom( struct x86_function *p, struct x86_reg dst )
void x87_fcomp( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
if (dst.file == file_x87)
emit_2ub(p, 0xd8, 0xd8 + dst.idx);
else {
@@ -1124,6 +1338,7 @@ void x87_fcomp( struct x86_function *p, struct x86_reg dst )
void x87_fnstsw( struct x86_function *p, struct x86_reg dst )
{
+ DUMP_R( __FUNCTION__, dst );
assert(dst.file == file_REG32);
if (dst.idx == reg_AX &&
@@ -1153,6 +1368,7 @@ void mmx_packssdw( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.file == file_MMX &&
(src.file == file_MMX || src.mod != mod_REG));
@@ -1166,6 +1382,7 @@ void mmx_packuswb( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
assert(dst.file == file_MMX &&
(src.file == file_MMX || src.mod != mod_REG));
@@ -1179,6 +1396,7 @@ void mmx_movd( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
p->need_emms = 1;
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x6e, 0x7e, dst, src );
@@ -1188,6 +1406,7 @@ void mmx_movq( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )
{
+ DUMP_RR( __FUNCTION__, dst, src );
p->need_emms = 1;
emit_1ub(p, X86_TWOB);
emit_op_modrm( p, 0x6f, 0x7f, dst, src );