Browse Source

pan/midgard: Compute destination override

We shift over the mask in this case.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
master
Alyssa Rosenzweig 7 years ago
parent
commit
a0e75adabb
1 changed files with 25 additions and 7 deletions
  1. 25
    7
      src/panfrost/midgard/midgard_emit.c

+ 25
- 7
src/panfrost/midgard/midgard_emit.c View File

@@ -152,6 +152,30 @@ mir_pack_swizzle_64(unsigned *swizzle, unsigned max_component)
return packed;
}

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)
{
@@ -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;

Loading…
Cancel
Save