r600g: fix alu inst group merging for relative adressing
authorChristian König <deathsimple@vodafone.de>
Sun, 16 Jan 2011 20:21:41 +0000 (21:21 +0100)
committerChristian König <deathsimple@vodafone.de>
Sun, 16 Jan 2011 20:43:17 +0000 (21:43 +0100)
src/gallium/drivers/r600/r600_asm.c

index a473fb29c4d570dba6e4bb06008d0224741ba3be..7ade0c727bf871cfc3fac7dd9c5e9badc9e50e91 100644 (file)
@@ -852,6 +852,7 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
 
        int i, j, r, src, num_src;
        int num_once_inst = 0;
+       int have_mova = 0, have_rel = 0;
 
        r = assign_alu_units(bc, alu_prev, prev);
        if (r)
@@ -866,6 +867,12 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
                                return 0;
                        if (r600_bc_alu_nliterals(bc, prev[i], prev_literal, &prev_nliteral))
                                return 0;
+                       if (is_alu_mova_inst(bc, prev[i])) {
+                               if (have_rel)
+                                       return 0;
+                               have_mova = 1;
+                       }
+                       num_once_inst += is_alu_once_inst(bc, prev[i]);
                }
                if (slots[i] && r600_bc_alu_nliterals(bc, slots[i], literal, &nliteral))
                        return 0;
@@ -873,7 +880,6 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
                // let's check used slots
                if (prev[i] && !slots[i]) {
                        result[i] = prev[i];
-                       num_once_inst += is_alu_once_inst(bc, prev[i]);
                        continue;
                } else if (prev[i] && slots[i]) {
                        if (result[4] == NULL && prev[4] == NULL && slots[4] == NULL) {
@@ -899,6 +905,12 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
 
                num_src = r600_bc_get_num_operands(bc, alu);
                for (src = 0; src < num_src; ++src) {
+                       if (alu->src[src].rel) {
+                               if (have_mova)
+                                       return 0;
+                               have_rel = 1;
+                       }
+
                        // constants doesn't matter
                        if (!is_gpr(alu->src[src].sel))
                                continue;