#include "tgsi_core.h"
#include "x86/rtasm/x86sse.h"
-#if defined(__i386__) || defined(__386__)
-
#define FOR_EACH_CHANNEL( CHAN )\
for( CHAN = 0; CHAN < 4; CHAN++ )
#define CHAN_Z 2
#define CHAN_W 3
-#define ALIGN16( ADDR ) (((ADDR) + 15) & ~15)
+static unsigned
+p2u( void *p )
+{
+ union {
+ void *p;
+ unsigned u;
+ } pu;
+
+ pu.p = p;
+ return pu.u;
+}
static struct x86_reg
get_argument(
static void
cos4f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_cos_storage );
+ float *store = (float *) tgsi_align_128bit( g_cos_storage );
#ifdef WIN32
store[0] = (float) cos( (double) store[0] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_cos_storage ),
+ p2u( tgsi_align_128bit( g_cos_storage ) ),
cos4f );
}
static void
sin4f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_sin_storage );
+ float *store = (float *) tgsi_align_128bit( g_sin_storage );
#ifdef WIN32
store[0] = (float) sin( (double) store[0] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_sin_storage ),
+ p2u( tgsi_align_128bit( g_sin_storage ) ),
sin4f );
}
static void
pow4f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_pow_storage );
+ float *store = (float *) tgsi_align_128bit( g_pow_storage );
#ifdef WIN32
store[0] = (float) pow( (double) store[0], (double) store[4] );
func,
xmm_dst,
xmm_src,
- ALIGN16( (unsigned) g_pow_storage ),
+ p2u( tgsi_align_128bit( g_pow_storage ) ),
pow4f );
}
static void
ex24f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_ex2_storage );
+ float *store = (float *) tgsi_align_128bit( g_ex2_storage );
#ifdef WIN32
store[0] = (float) pow( 2.0, (double) store[0] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_ex2_storage ),
+ p2u( tgsi_align_128bit( g_ex2_storage ) ),
ex24f );
}
static void
lg24f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_lg2_storage );
+ float *store = (float *) tgsi_align_128bit( g_lg2_storage );
store[0] = LOG2( store[0] );
store[1] = LOG2( store[1] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_lg2_storage ),
+ p2u( tgsi_align_128bit( g_lg2_storage ) ),
lg24f );
}
static void
flr4f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_flr_storage );
+ float *store = (float *) tgsi_align_128bit( g_flr_storage );
store[0] = (float) floor( (double) store[0] );
store[1] = (float) floor( (double) store[1] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_flr_storage ),
+ p2u( tgsi_align_128bit( g_flr_storage ) ),
flr4f );
}
static void
frc4f( void )
{
- float *store = (float *) ALIGN16( (unsigned) g_frc_storage );
+ float *store = (float *) tgsi_align_128bit( g_frc_storage );
store[0] -= (float) floor( (double) store[0] );
store[1] -= (float) floor( (double) store[1] );
emit_func_call1(
func,
xmm_dst,
- ALIGN16( (unsigned) g_frc_storage ),
+ p2u( tgsi_align_128bit( g_frc_storage ) ),
frc4f );
}
break;
case TGSI_OPCODE_TEX:
- assert( 0 );
+ emit_tempf(
+ func,
+ 0,
+ TGSI_EXEC_TEMP_ONE_I,
+ TGSI_EXEC_TEMP_ONE_C );
+ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
+ STORE( func, *inst, 0, 0, chan_index );
+ }
break;
case TGSI_OPCODE_TXD:
assert( 0 );
break;
- case TGSI_OPCODE_END:
- /* nothing */
- break;
-
default:
assert( 0 );
}
unsigned
tgsi_emit_sse2(
- const struct tgsi_token *tokens,
+ struct tgsi_token *tokens,
struct x86_function *func )
{
struct tgsi_parse_context parse;
*/
unsigned
tgsi_emit_sse2_fs(
- const struct tgsi_token *tokens,
+ struct tgsi_token *tokens,
struct x86_function *func )
{
struct tgsi_parse_context parse;
return 1;
}
-
-#endif