summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-10-15 13:08:00 -0400
committerRob Clark <[email protected]>2014-10-15 15:49:49 -0400
commit652b8fbbbb0132c634c90e4d1fdbca9497b7cd94 (patch)
tree012f30717b840bffbef98fe0a58b5ab011c0f57b /src/gallium/drivers/freedreno/ir3
parente71a3f80fb5962651e8c3ece37ea2a61ef24f5f3 (diff)
freedreno/ir3: large const support
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3.c2
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3.h2
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c23
3 files changed, 20 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.c b/src/gallium/drivers/freedreno/ir3/ir3.c
index 3da10fb81e3..70d37ffdeb5 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3.c
@@ -104,7 +104,7 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_info *info,
val.iim_val = reg->iim_val;
} else {
int8_t components = util_last_bit(reg->wrmask);
- int8_t max = (reg->num + repeat + components - 1) >> 2;
+ int16_t max = (reg->num + repeat + components - 1) >> 2;
val.comp = reg->num & 0x3;
val.num = reg->num >> 2;
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h
index b92a57a43f8..d2d3dcaadb9 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -47,7 +47,7 @@ struct ir3_info {
*/
int8_t max_reg; /* highest GPR # used by shader */
int8_t max_half_reg;
- int8_t max_const;
+ int16_t max_const;
};
struct ir3_register {
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index 1a5119c074f..8c4ec88ccc0 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -600,11 +600,6 @@ add_src_reg_wrmask(struct ir3_compile_context *ctx,
struct ir3_register *reg;
struct ir3_instruction *orig = NULL;
- /* TODO we need to use a mov to temp for const >= 64.. or maybe
- * we could use relative addressing..
- */
- compile_assert(ctx, src->Index < 64);
-
switch (src->File) {
case TGSI_FILE_IMMEDIATE:
/* TODO if possible, use actual immediate instead of const.. but
@@ -632,6 +627,24 @@ add_src_reg_wrmask(struct ir3_compile_context *ctx,
break;
}
+ /* We seem to have 8 bits (6.2) for dst register always, so I think
+ * it is safe to assume GPR cannot be >=64
+ *
+ * cat3 instructions only have 8 bits for src2, but cannot take a
+ * const for src2
+ *
+ * cat5 and cat6 in some cases only has 8 bits, but cannot take a
+ * const for any src.
+ *
+ * Other than that we seem to have 12 bits to encode const src,
+ * except for cat1 which may only have 11 bits (but that seems like
+ * a bug)
+ */
+ if (flags & IR3_REG_CONST)
+ compile_assert(ctx, src->Index < (1 << 9));
+ else
+ compile_assert(ctx, src->Index < (1 << 6));
+
if (src->Absolute)
flags |= IR3_REG_ABS;
if (src->Negate)