Mesa (master): nvc0: recognize r63 as zero in constant folding
Christoph Bumiller
chrisbmr at kemper.freedesktop.org
Sun Jan 23 12:12:55 UTC 2011
Module: Mesa
Branch: master
Commit: 419ff10b0ebdeec06bd3466beda2a9e1a9d054d6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=419ff10b0ebdeec06bd3466beda2a9e1a9d054d6
Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date: Fri Jan 21 17:04:25 2011 +0100
nvc0: recognize r63 as zero in constant folding
---
src/gallium/drivers/nvc0/nvc0_pc.c | 10 ++++++++--
src/gallium/drivers/nvc0/nvc0_pc.h | 2 +-
src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c | 10 ----------
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.c b/src/gallium/drivers/nvc0/nvc0_pc.c
index 304a191..1d1b9e1 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
diff --git a/src/gallium/drivers/nvc0/nvc0_pc.h b/src/gallium/drivers/nvc0/nvc0_pc.h
index 969cc68..01ca95b 100644
--- a/src/gallium/drivers/nvc0/nvc0_pc.h
+++ b/src/gallium/drivers/nvc0/nvc0_pc.h
@@ -310,7 +310,7 @@ struct nv_reg {
int32_t s32;
int64_t s64;
uint64_t u64;
- uint32_t u32;
+ uint32_t u32; /* expected to be 0 for $r63 */
float f32;
double f64;
} imm;
diff --git a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
index 950bee2..3709369 100644
--- a/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
+++ b/src/gallium/drivers/nvc0/nvc0_tgsi_to_nc.c
@@ -1388,16 +1388,6 @@ emit_tex(struct bld_context *bld, uint opcode, int tic, int tsc,
return nvi;
}
-/*
-static boolean
-bld_is_constant(struct nv_value *val)
-{
- if (val->reg.file == NV_FILE_IMM)
- return TRUE;
- return val->insn && nvCG_find_constant(val->insn->src[0]);
-}
-*/
-
static void
bld_tex(struct bld_context *bld, struct nv_value *dst0[4],
const struct tgsi_full_instruction *insn)
More information about the mesa-commit
mailing list