summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2013-01-22 21:22:10 +0100
committerTom Stellard <[email protected]>2013-01-28 18:30:37 +0000
commit0ba0926861f489261e45404cd57d8f92add9e1ee (patch)
tree35df8d4241f845f22dd65e2335ff459eb64356a6
parenta871e01174466812f081f4c474b95c44cf8aee57 (diff)
r600g: More robust checks for MOVA_INT instructions
-rw-r--r--src/gallium/drivers/r600/r600_asm.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 07fe1df865b..123a9f88e76 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -480,6 +480,23 @@ static int is_alu_mova_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *
}
}
+static int alu_uses_rel(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
+{
+ unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
+ unsigned src;
+
+ if (alu->dst.rel) {
+ return 1;
+ }
+
+ for (src = 0; src < num_src; ++src) {
+ if (alu->src[src].rel) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
static int is_opcode_in_range(unsigned opcode, unsigned min, unsigned max)
{
return min <= opcode && opcode <= max;
@@ -1084,6 +1101,14 @@ static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu
return 0;
have_mova = 1;
}
+
+ if (alu_uses_rel(bc, prev[i])) {
+ if (have_mova) {
+ return 0;
+ }
+ have_rel = 1;
+ }
+
num_once_inst += is_alu_once_inst(bc, prev[i]);
}
if (slots[i] && r600_bytecode_alu_nliterals(bc, slots[i], literal, &nliteral))
@@ -1131,21 +1156,23 @@ static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu
if (is_nop_inst(bc, alu))
return 0;
- /* Let's check dst gpr. */
- if (alu->dst.rel) {
- if (have_mova)
+ if (is_alu_mova_inst(bc, alu)) {
+ if (have_rel) {
return 0;
+ }
+ have_mova = 1;
+ }
+
+ if (alu_uses_rel(bc, alu)) {
+ if (have_mova) {
+ return 0;
+ }
have_rel = 1;
}
/* Let's check source gprs */
num_src = r600_bytecode_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 don't matter. */
if (!is_gpr(alu->src[src].sel))