summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0/nvc0_pc.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-01-21 17:04:25 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-01-23 13:03:15 +0100
commit419ff10b0ebdeec06bd3466beda2a9e1a9d054d6 (patch)
treed53a1fbc18539f2bdad05398b0776abb3ec39e59 /src/gallium/drivers/nvc0/nvc0_pc.c
parentbf1df06773d6eca8b71a687f838edccd1a6c9cb8 (diff)
nvc0: recognize r63 as zero in constant folding
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_pc.c')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_pc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.c b/src/gallium/drivers/nvc0/nvc0_pc.c
index 304a191976..1d1b9e19b7 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc.c
+++ b/src/gallium/drivers/nvc0/nvc0_pc.c
@@ -103,6 +103,12 @@ nvc0_pc_replace_value(struct nv_pc *pc,
return n;
}
+static INLINE boolean
+is_gpr63(struct nv_value *val)
+{
+ return (val->reg.file == NV_FILE_GPR && val->reg.id == 63);
+}
+
struct nv_value *
nvc0_pc_find_constant(struct nv_ref *ref)
{
@@ -116,7 +122,7 @@ nvc0_pc_find_constant(struct nv_ref *ref)
assert(!src->insn->src[0]->mod);
src = src->insn->src[0]->value;
}
- if ((src->reg.file == NV_FILE_IMM) ||
+ if ((src->reg.file == NV_FILE_IMM) || is_gpr63(src) ||
(src->insn &&
src->insn->opcode == NV_OP_LD &&
src->insn->src[0]->value->reg.file >= NV_FILE_MEM_C(0) &&
@@ -130,7 +136,7 @@ nvc0_pc_find_immediate(struct nv_ref *ref)
{
struct nv_value *src = nvc0_pc_find_constant(ref);
- return (src && src->reg.file == NV_FILE_IMM) ? src : NULL;
+ return (src && (src->reg.file == NV_FILE_IMM || is_gpr63(src))) ? src : NULL;
}
static void