From: Alyssa Rosenzweig Date: Wed, 13 Nov 2019 12:58:48 +0000 (-0500) Subject: pan/midgard: Compute destination override X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0e75adabb96dbd5c3986a52c7be68d08bfadfdc;p=mesa.git pan/midgard: Compute destination override We shift over the mask in this case. Signed-off-by: Alyssa Rosenzweig --- 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 @@ -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;