diff options
author | Zack Rusin <[email protected]> | 2007-09-28 12:28:16 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-28 12:28:16 -0400 |
commit | 901577e07fcab0cf90a272fee900cb0831ae84c3 (patch) | |
tree | 9e8674230a3e584c674d0683de5d40321bd51fc1 /src/mesa/x86 | |
parent | f2a33a63f1f41681375baa2a9ad261cb60db2a85 (diff) |
Revert "Redoing the way we handle vertex shaders for the draw module."
This reverts commit 6dcfddb8e2ec2bfb6187b912807fa65f28da2c5e.
Diffstat (limited to 'src/mesa/x86')
-rw-r--r-- | src/mesa/x86/rtasm/x86sse.c | 68 | ||||
-rw-r--r-- | src/mesa/x86/rtasm/x86sse.h | 49 |
2 files changed, 58 insertions, 59 deletions
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index f9a9352e468..a6cfa40f91f 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -6,22 +6,22 @@ #define DISASSEM 0 #define X86_TWOB 0x0f -static unsigned char *cptr( void (*label)() ) +static GLubyte *cptr( void (*label)() ) { - return (unsigned char *)(unsigned long)label; + return (char *)(unsigned long)label; } /* Emit bytes to the instruction stream: */ -static void emit_1b( struct x86_function *p, char b0 ) +static void emit_1b( struct x86_function *p, GLbyte b0 ) { - *(char *)(p->csr++) = b0; + *(GLbyte *)(p->csr++) = b0; } -static void emit_1i( struct x86_function *p, int i0 ) +static void emit_1i( struct x86_function *p, GLint i0 ) { - *(int *)(p->csr) = i0; + *(GLint *)(p->csr) = i0; p->csr += 4; } @@ -35,20 +35,20 @@ static void disassem( struct x86_function *p, const char *fn ) #endif } -static void emit_1ub_fn( struct x86_function *p, unsigned char b0, const char *fn ) +static void emit_1ub_fn( struct x86_function *p, GLubyte b0, const char *fn ) { disassem(p, fn); *(p->csr++) = b0; } -static void emit_2ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, const char *fn ) +static void emit_2ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, const char *fn ) { disassem(p, fn); *(p->csr++) = b0; *(p->csr++) = b1; } -static void emit_3ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2, const char *fn ) +static void emit_3ub_fn( struct x86_function *p, GLubyte b0, GLubyte b1, GLubyte b2, const char *fn ) { disassem(p, fn); *(p->csr++) = b0; @@ -69,7 +69,7 @@ static void emit_modrm( struct x86_function *p, struct x86_reg reg, struct x86_reg regmem ) { - unsigned char val = 0; + GLubyte val = 0; assert(reg.mod == mod_REG); @@ -104,7 +104,7 @@ static void emit_modrm( struct x86_function *p, static void emit_modrm_noreg( struct x86_function *p, - unsigned op, + GLuint op, struct x86_reg regmem ) { struct x86_reg dummy = x86_make_reg(file_REG32, op); @@ -117,8 +117,8 @@ static void emit_modrm_noreg( struct x86_function *p, * the arguments presented. */ static void emit_op_modrm( struct x86_function *p, - unsigned char op_dst_is_reg, - unsigned char op_dst_is_mem, + GLubyte op_dst_is_reg, + GLubyte op_dst_is_mem, struct x86_reg dst, struct x86_reg src ) { @@ -162,7 +162,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, } struct x86_reg x86_make_disp( struct x86_reg reg, - int disp ) + GLint disp ) { assert(reg.file == file_REG32); @@ -191,7 +191,7 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ) return x86_make_reg( reg.file, reg.idx ); } -unsigned char *x86_get_label( struct x86_function *p ) +GLubyte *x86_get_label( struct x86_function *p ) { return p->csr; } @@ -205,13 +205,13 @@ unsigned char *x86_get_label( struct x86_function *p ) void x86_jcc( struct x86_function *p, enum x86_cc cc, - unsigned char *label ) + GLubyte *label ) { - int offset = label - (x86_get_label(p) + 2); + GLint offset = label - (x86_get_label(p) + 2); if (offset <= 127 && offset >= -128) { emit_1ub(p, 0x70 + cc); - emit_1b(p, (char) offset); + emit_1b(p, (GLbyte) offset); } else { offset = label - (x86_get_label(p) + 6); @@ -222,7 +222,7 @@ void x86_jcc( struct x86_function *p, /* Always use a 32bit offset for forward jumps: */ -unsigned char *x86_jcc_forward( struct x86_function *p, +GLubyte *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ) { emit_2ub(p, 0x0f, 0x80 + cc); @@ -230,14 +230,14 @@ unsigned char *x86_jcc_forward( struct x86_function *p, return x86_get_label(p); } -unsigned char *x86_jmp_forward( struct x86_function *p) +GLubyte *x86_jmp_forward( struct x86_function *p) { emit_1ub(p, 0xe9); emit_1i(p, 0); return x86_get_label(p); } -unsigned char *x86_call_forward( struct x86_function *p) +GLubyte *x86_call_forward( struct x86_function *p) { emit_1ub(p, 0xe8); emit_1i(p, 0); @@ -247,12 +247,12 @@ unsigned char *x86_call_forward( struct x86_function *p) /* Fixup offset from forward jump: */ void x86_fixup_fwd_jump( struct x86_function *p, - unsigned char *fixup ) + GLubyte *fixup ) { *(int *)(fixup - 4) = x86_get_label(p) - fixup; } -void x86_jmp( struct x86_function *p, unsigned char *label) +void x86_jmp( struct x86_function *p, GLubyte *label) { emit_1ub(p, 0xe9); emit_1i(p, label - x86_get_label(p) - 4); @@ -268,7 +268,7 @@ void x86_call( struct x86_function *p, void (*label)()) * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ) +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ) { assert(dst.mod == mod_REG); emit_1ub(p, 0xb8 + dst.idx); @@ -595,7 +595,7 @@ void sse_cvtps2pi( struct x86_function *p, void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf) + GLubyte shuf) { emit_2ub(p, X86_TWOB, 0xC6); emit_modrm(p, dest, arg0); @@ -605,7 +605,7 @@ void sse_shufps( struct x86_function *p, void sse_cmpps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char cc) + GLubyte cc) { emit_2ub(p, X86_TWOB, 0xC2); emit_modrm(p, dest, arg0); @@ -630,7 +630,7 @@ void sse_pmovmskb( struct x86_function *p, void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf) + GLubyte shuf) { emit_3ub(p, 0x66, X86_TWOB, 0x70); emit_modrm(p, dest, arg0); @@ -772,11 +772,11 @@ void x87_fclex( struct x86_function *p ) static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86_reg arg, - unsigned char dst0ub0, - unsigned char dst0ub1, - unsigned char arg0ub0, - unsigned char arg0ub1, - unsigned char argmem_noreg) + GLubyte dst0ub0, + GLubyte dst0ub1, + GLubyte arg0ub0, + GLubyte arg0ub1, + GLubyte argmem_noreg) { assert(dst.file == file_x87); @@ -1116,7 +1116,7 @@ void mmx_movq( struct x86_function *p, * account any push/pop activity: */ struct x86_reg x86_fn_arg( struct x86_function *p, - unsigned arg ) + GLuint arg ) { return x86_make_disp(x86_make_reg(file_REG32, reg_SP), p->stack_offset + arg * 4); /* ??? */ @@ -1128,7 +1128,7 @@ void x86_init_func( struct x86_function *p ) x86_init_func_size(p, 1024); } -void x86_init_func_size( struct x86_function *p, unsigned code_size ) +void x86_init_func_size( struct x86_function *p, GLuint code_size ) { p->store = _mesa_exec_malloc(code_size); p->csr = p->store; diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h index 63b9a36392a..c1ca06088bc 100644 --- a/src/mesa/x86/rtasm/x86sse.h +++ b/src/mesa/x86/rtasm/x86sse.h @@ -4,22 +4,24 @@ #if defined(__i386__) || defined(__386__) +#include "glheader.h" + /* It is up to the caller to ensure that instructions issued are * suitable for the host cpu. There are no checks made in this module * for mmx/sse/sse2 support on the cpu. */ struct x86_reg { - unsigned file:3; - unsigned idx:3; - unsigned mod:2; /* mod_REG if this is just a register */ - int disp:24; /* only +/- 23bits of offset - should be enough... */ + GLuint file:3; + GLuint idx:3; + GLuint mod:2; /* mod_REG if this is just a register */ + GLint disp:24; /* only +/- 23bits of offset - should be enough... */ }; struct x86_function { - unsigned char *store; - unsigned char *csr; - unsigned stack_offset; - int need_emms; + GLubyte *store; + GLubyte *csr; + GLuint stack_offset; + GLint need_emms; const char *fn; }; @@ -79,7 +81,7 @@ enum sse_cc { void x86_init_func( struct x86_function *p ); -void x86_init_func_size( struct x86_function *p, unsigned code_size ); +void x86_init_func_size( struct x86_function *p, GLuint code_size ); void x86_release_func( struct x86_function *p ); void (*x86_get_func( struct x86_function *p ))( void ); @@ -91,7 +93,7 @@ struct x86_reg x86_make_reg( enum x86_reg_file file, enum x86_reg_name idx ); struct x86_reg x86_make_disp( struct x86_reg reg, - int disp ); + GLint disp ); struct x86_reg x86_deref( struct x86_reg reg ); @@ -100,23 +102,23 @@ struct x86_reg x86_get_base_reg( struct x86_reg reg ); /* Labels, jumps and fixup: */ -unsigned char *x86_get_label( struct x86_function *p ); +GLubyte *x86_get_label( struct x86_function *p ); void x86_jcc( struct x86_function *p, enum x86_cc cc, - unsigned char *label ); + GLubyte *label ); -unsigned char *x86_jcc_forward( struct x86_function *p, +GLubyte *x86_jcc_forward( struct x86_function *p, enum x86_cc cc ); -unsigned char *x86_jmp_forward( struct x86_function *p); +GLubyte *x86_jmp_forward( struct x86_function *p); -unsigned char *x86_call_forward( struct x86_function *p); +GLubyte *x86_call_forward( struct x86_function *p); void x86_fixup_fwd_jump( struct x86_function *p, - unsigned char *fixup ); + GLubyte *fixup ); -void x86_jmp( struct x86_function *p, unsigned char *label ); +void x86_jmp( struct x86_function *p, GLubyte *label ); void x86_call( struct x86_function *p, void (*label)() ); @@ -124,7 +126,7 @@ void x86_call( struct x86_function *p, void (*label)() ); * Temporary. As I need immediate operands, and dont want to mess with the codegen, * I load the immediate into general purpose register and use it. */ -void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); +void x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, GLint imm ); /* Macro for sse_shufps() and sse2_pshufd(): @@ -145,8 +147,7 @@ void sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) void sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf ); +void sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); void sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -156,8 +157,7 @@ void sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg sr void sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, - unsigned char cc ); +void sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, GLubyte cc ); void sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -175,8 +175,7 @@ void sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ) void sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); -void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, - unsigned char shuf ); +void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, GLubyte shuf ); void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); @@ -248,7 +247,7 @@ void x87_fucom( struct x86_function *p, struct x86_reg arg ); * account any push/pop activity. Note - doesn't track explict * manipulation of ESP by other instructions. */ -struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); +struct x86_reg x86_fn_arg( struct x86_function *p, GLuint arg ); #endif #endif |