summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi/tgsi_sse2.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-05-07 10:40:55 -0600
committerBrian Paul <brianp@vmware.com>2010-05-07 10:40:59 -0600
commit12d74d6ba1b4dff0ebef68edf09a6f560eae3a65 (patch)
tree1748244d3212df72193bde39901ba34c6452c35f /src/gallium/auxiliary/tgsi/tgsi_sse2.c
parent50c940707ec191c6f4d90fcb763370477c1bacde (diff)
tgis: fix SOA aliasing for MUL instruction in SSE codegen
Part of a fix for piglit trinity-fp1 test failure.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_sse2.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sse2.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 01b4a96012..d5061f8b51 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -1929,11 +1929,17 @@ emit_instruction(
break;
case TGSI_OPCODE_MUL:
+ /* do all fetches and adds, storing results in temp regs */
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
- FETCH( func, *inst, 0, 0, chan_index );
- FETCH( func, *inst, 1, 1, chan_index );
- emit_mul( func, 0, 1 );
- STORE( func, *inst, 0, 0, chan_index );
+ int r = chan_index + 1;
+ FETCH( func, *inst, 0, 0, chan_index ); /* load xmm[0] */
+ FETCH( func, *inst, r, 1, chan_index ); /* load xmm[r] */
+ emit_mul( func, r, 0 ); /* xmm[r] = xmm[r] * xmm[0] */
+ }
+ /* do all stores of the temp regs */
+ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
+ int r = chan_index + 1;
+ STORE( func, *inst, r, 0, chan_index ); /* store xmm[r] */
}
break;
@@ -2833,6 +2839,7 @@ check_soa_dependencies(const struct tgsi_full_instruction *inst)
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_MOV:
+ case TGSI_OPCODE_MUL:
case TGSI_OPCODE_XPD:
/* OK - these opcodes correctly handle SOA dependencies */
break;