*/
+#include "pipe/p_config.h"
#include "pipe/p_compiler.h"
-#include "pipe/p_util.h"
+#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "translate.h"
-#if defined(__i386__) || defined(__386__) || defined(i386)
+#if defined(PIPE_ARCH_X86)
#include "rtasm/rtasm_cpu.h"
#include "rtasm/rtasm_x86sse.h"
#define W 3
-#ifdef WIN32
-#define RTASM __cdecl
-#else
-#define RTASM
-#endif
-
-typedef void (RTASM *run_func)( struct translate *translate,
- unsigned start,
- unsigned count,
- void *output_buffer );
-
-typedef void (RTASM *run_elts_func)( struct translate *translate,
- const unsigned *elts,
+typedef void (PIPE_CDECL *run_func)( struct translate *translate,
+ unsigned start,
unsigned count,
void *output_buffer );
+typedef void (PIPE_CDECL *run_elts_func)( struct translate *translate,
+ const unsigned *elts,
+ unsigned count,
+ void *output_buffer );
+
struct translate_sse {
static void emit_swizzle( struct translate_sse *p,
struct x86_reg dest,
struct x86_reg src,
- unsigned shuffle )
+ unsigned char shuffle )
{
sse_shufps(p->func, dest, src, shuffle);
}
struct x86_reg srcEAX = x86_make_reg(file_REG32, reg_CX);
struct x86_reg countEBP = x86_make_reg(file_REG32, reg_BP);
struct x86_reg translateESI = x86_make_reg(file_REG32, reg_SI);
- uint8_t *fixup, *label;
+ int fixup, label;
unsigned j;
p->func = func;
x86_lea(p->func, vertexECX, x86_make_disp(vertexECX, p->translate.key.output_stride));
/* Incr index
- */ /* Emit code for each of the attributes. Currently routes
- * everything through SSE registers, even when it might be more
- * efficient to stick with regular old x86. No optimization or
- * other tricks - enough new ground to cover here just getting
- * things working.
- */
-
+ */
if (linear) {
x86_inc(p->func, idxEBX);
}
FREE(p);
}
-static void translate_sse_run_elts( struct translate *translate,
+static void PIPE_CDECL translate_sse_run_elts( struct translate *translate,
const unsigned *elts,
unsigned count,
void *output_buffer )
output_buffer );
}
-static void translate_sse_run( struct translate *translate,
+static void PIPE_CDECL translate_sse_run( struct translate *translate,
unsigned start,
unsigned count,
void *output_buffer )
goto fail;
p->gen_run = (run_func)x86_get_func(&p->linear_func);
+ if (p->gen_run == NULL)
+ goto fail;
+
p->gen_run_elts = (run_elts_func)x86_get_func(&p->elt_func);
+ if (p->gen_run_elts == NULL)
+ goto fail;
return &p->translate;
#else
-void translate_create_sse( const struct translate_key *key )
+struct translate *translate_sse2_create( const struct translate_key *key )
{
return NULL;
}