summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-11-13 07:58:48 -0500
committerAlyssa Rosenzweig <[email protected]>2019-12-24 19:23:02 -0500
commita0e75adabb96dbd5c3986a52c7be68d08bfadfdc (patch)
tree63de3b28d3614a802f40d70d6bd900381450f7ac /src/panfrost/midgard
parent9a5d462480d9d5d1f91fc7984a7f423dd6cd46a3 (diff)
pan/midgard: Compute destination override
We shift over the mask in this case. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_emit.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c
index bda01acce8b..2be6ecedc14 100644
--- a/src/panfrost/midgard/midgard_emit.c
+++ b/src/panfrost/midgard/midgard_emit.c
@@ -153,6 +153,30 @@ mir_pack_swizzle_64(unsigned *swizzle, unsigned max_component)
}
static void
+mir_pack_mask_alu(midgard_instruction *ins)
+{
+ unsigned effective = ins->mask;
+
+ /* If we have a destination override, we need to figure out whether to
+ * override to the lower or upper half, shifting the effective mask in
+ * the latter, so AAAA.... becomes AAAA */
+
+ unsigned upper_shift = mir_upper_override(ins);
+
+ if (upper_shift) {
+ effective >>= upper_shift;
+ ins->alu.dest_override = midgard_dest_override_upper;
+ }
+
+ if (ins->alu.reg_mode == midgard_reg_mode_32)
+ ins->alu.mask = expand_writemask(effective, 4);
+ else if (ins->alu.reg_mode == midgard_reg_mode_64)
+ ins->alu.mask = expand_writemask(effective, 2);
+ else
+ ins->alu.mask = effective;
+}
+
+static void
mir_pack_swizzle_alu(midgard_instruction *ins)
{
midgard_vector_alu_src src[] = {
@@ -321,13 +345,7 @@ emit_alu_bundle(compiler_context *ctx,
midgard_scalar_alu scalarized;
if (ins->unit & UNITS_ANY_VECTOR) {
- if (ins->alu.reg_mode == midgard_reg_mode_64)
- ins->alu.mask = expand_writemask(ins->mask, 2);
- else if (ins->alu.reg_mode == midgard_reg_mode_32)
- ins->alu.mask = expand_writemask(ins->mask, 4);
- else
- ins->alu.mask = ins->mask;
-
+ mir_pack_mask_alu(ins);
mir_pack_swizzle_alu(ins);
size = sizeof(midgard_vector_alu);
source = &ins->alu;