summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-21 20:41:01 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-23 09:16:57 +0100
commit5b1bd30f22ffa3955150ec008631d0f4754d340f (patch)
treed8e5e24bfbc4f0cae54d4c66b5ed839a5c10a4a5
parent083f3f5c32a28d2993a8a5a8b4f5ef81224a5ec3 (diff)
draw: when preloading args to x87 stack, need to use reverse order
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 97de43c232..fde92c7226 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -980,7 +980,7 @@ static boolean emit_EXP( struct aos_compilation *cp, const struct tgsi_full_inst
x87_fstp_or_pop(cp->func, writemask, 0, dst); /* flr(a) a 2^flr(a) */
- x87_fsubrp(cp->func, st1); /* frac(a) 2^flr(a) */
+ x87_fsubp(cp->func, st1); /* frac(a) 2^flr(a) */
x87_fst_or_nop(cp->func, writemask, 1, dst); /* frac(a) 2^flr(a) */
@@ -1041,9 +1041,9 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst
/* Load all sources first to avoid aliasing
*/
- for (i = 0; i < 4; i++) {
+ for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
- x87_fld_src(cp, &op->FullSrcRegisters[0], i);
+ x87_fld_src(cp, &op->FullSrcRegisters[0], i);
}
}
@@ -1068,9 +1068,9 @@ static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_inst
/* Load all sources first to avoid aliasing
*/
- for (i = 0; i < 4; i++) {
+ for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
- x87_fld_src(cp, &op->FullSrcRegisters[0], i);
+ x87_fld_src(cp, &op->FullSrcRegisters[0], i);
}
}
@@ -1098,7 +1098,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst
/* suck all the source values onto the stack before writing out any
* dst, which may alias...
*/
- for (i = 0; i < 4; i++) {
+ for (i = 3; i >= 0; i--) {
if (writemask & (1<<i)) {
x87_fld_src(cp, &op->FullSrcRegisters[0], i);
}
@@ -1108,7 +1108,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst
if (writemask & (1<<i)) {
x87_fld(cp->func, st0); /* a a */
x87_fprndint( cp->func ); /* flr(a) a */
- x87_fsubrp(cp->func, st1); /* frc(a) */
+ x87_fsubp(cp->func, st1); /* frc(a) */
x87_fstp(cp->func, x86_make_disp(dst, i*4));
}
}
@@ -1392,6 +1392,8 @@ static boolean
emit_instruction( struct aos_compilation *cp,
struct tgsi_full_instruction *inst )
{
+ x87_assert_stack_empty(cp->func);
+
switch( inst->Instruction.Opcode ) {
case TGSI_OPCODE_MOV:
return emit_MOV( cp, inst );
@@ -1657,6 +1659,7 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
break;
}
+ x87_assert_stack_empty(cp.func);
cp.insn_counter++;
debug_printf("\n");
}
@@ -1712,6 +1715,7 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient,
x86_pop(cp.func, cp.count_ESI);
x86_pop(cp.func, cp.idx_EBX);
+ x87_assert_stack_empty(cp.func);
x86_ret(cp.func);
tgsi_parse_free( &parse );