summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2016-01-14 11:53:11 -0500
committerRob Clark <robdclark@gmail.com>2016-01-14 13:11:21 -0500
commitd5a4bbcf1d51aa7b535da0c83f8e954ae01bd047 (patch)
treeabe562dc8b0054f044e8cd9be35afda470f767be
parentb9dffcc8382c135c2c1d2ca245b9bd8ff68539c9 (diff)
relative dst supportHEADmaster
-rw-r--r--asm/ir-a3xx.c9
-rw-r--r--asm/parser.y4
-rw-r--r--ir3emu.c10
3 files changed, 19 insertions, 4 deletions
diff --git a/asm/ir-a3xx.c b/asm/ir-a3xx.c
index 6e921a1..2140c4a 100644
--- a/asm/ir-a3xx.c
+++ b/asm/ir-a3xx.c
@@ -105,8 +105,13 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_shader_info *info,
int16_t max;
components = util_last_bit(reg->wrmask);
- val.comp = reg->num & 0x3;
- val.num = reg->num >> 2;
+
+ if (reg->flags & IR3_REG_RELATIV) {
+ val.dummy10 = reg->offset;
+ } else {
+ val.comp = reg->num & 0x3;
+ val.num = reg->num >> 2;
+ }
max = (reg->num + repeat + components - 1) >> 2;
diff --git a/asm/parser.y b/asm/parser.y
index d5f9bde..676b949 100644
--- a/asm/parser.y
+++ b/asm/parser.y
@@ -680,7 +680,9 @@ dst_reg_flags: dst_reg_flag
| dst_reg_flag dst_reg_flags
/* note: destination registers are always incremented in repeat */
-dst_reg: reg { $1->flags |= IR3_REG_R; }
+dst_reg: 'r' '<' T_A0 offset '>' { new_reg(0, IR3_REG_RELATIV)->offset = $4; }
+| dst_reg_flags 'r' '<' T_A0 offset '>' { new_reg(0, IR3_REG_RELATIV)->offset = $4; }
+| reg { $1->flags |= IR3_REG_R; }
| dst_reg_flags reg { $2->flags |= IR3_REG_R; }
src_reg_flag: T_ABSNEG { rflags.flags |= IR3_REG_ABS|IR3_REG_NEGATE; }
diff --git a/ir3emu.c b/ir3emu.c
index 4fc5fcb..6e76ccc 100644
--- a/ir3emu.c
+++ b/ir3emu.c
@@ -286,7 +286,15 @@ static void write_dst(struct ir3_emu_ctx *ctx, regval_t r, struct ir3_regdst rd)
{
int idx = regidx(rd.dst);
- emu_assert(ctx, !rd.rel);
+ if (rd.rel) {
+ // XXX if there are {a0,p0}.{y,z,w} we don't know how to
+ // specify the component..
+
+ // since we are actually using garbage random inputs,
+ // pretend a0 is zero;
+ //idx = ctx->a0[0].i + rd.off;
+ idx = rd.dst.dummy10;
+ }
if (ctx->verbose)
printf(" dst: %08x %f\n", r.u, r.f);