mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 17:00:13 +01:00
pan/midgard: Break out one-src read_components
For constant packing, this is interesting to break down further. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3653>
This commit is contained in:
parent
b74212e701
commit
a12fe52cbc
2 changed files with 33 additions and 25 deletions
|
|
@ -530,6 +530,7 @@ bool mir_special_index(compiler_context *ctx, unsigned idx);
|
|||
unsigned mir_use_count(compiler_context *ctx, unsigned value);
|
||||
bool mir_is_written_before(compiler_context *ctx, midgard_instruction *ins, unsigned node);
|
||||
uint16_t mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node);
|
||||
uint16_t mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i);
|
||||
midgard_reg_mode mir_typesize(midgard_instruction *ins);
|
||||
midgard_reg_mode mir_srcsize(midgard_instruction *ins, unsigned i);
|
||||
unsigned mir_bytes_for_mode(midgard_reg_mode mode);
|
||||
|
|
|
|||
|
|
@ -465,6 +465,37 @@ mir_bytemask_of_read_components_single(unsigned *swizzle, unsigned inmask, midga
|
|||
return mir_to_bytemask(mode, cmask);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
mir_bytemask_of_read_components_index(midgard_instruction *ins, unsigned i)
|
||||
{
|
||||
uint16_t mask = 0;
|
||||
|
||||
/* Branch writeout uses all components */
|
||||
if (ins->compact_branch && ins->writeout && (i == 0))
|
||||
return 0xFFFF;
|
||||
|
||||
/* Conditional branches read one 32-bit component = 4 bytes (TODO: multi branch??) */
|
||||
if (ins->compact_branch && ins->branch.conditional && (i == 0))
|
||||
return 0xF;
|
||||
|
||||
/* ALU ops act componentwise so we need to pay attention to
|
||||
* their mask. Texture/ldst does not so we don't clamp source
|
||||
* readmasks based on the writemask */
|
||||
unsigned qmask = (ins->type == TAG_ALU_4) ? ins->mask : ~0;
|
||||
|
||||
/* Handle dot products and things */
|
||||
if (ins->type == TAG_ALU_4 && !ins->compact_branch) {
|
||||
unsigned props = alu_opcode_props[ins->alu.op].props;
|
||||
|
||||
unsigned channel_override = GET_CHANNEL_COUNT(props);
|
||||
|
||||
if (channel_override)
|
||||
qmask = mask_of(channel_override);
|
||||
}
|
||||
|
||||
return mir_bytemask_of_read_components_single(ins->swizzle[i], qmask, mir_srcsize(ins, i));
|
||||
}
|
||||
|
||||
uint16_t
|
||||
mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node)
|
||||
{
|
||||
|
|
@ -475,31 +506,7 @@ mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node)
|
|||
|
||||
mir_foreach_src(ins, i) {
|
||||
if (ins->src[i] != node) continue;
|
||||
|
||||
/* Branch writeout uses all components */
|
||||
if (ins->compact_branch && ins->writeout && (i == 0))
|
||||
return 0xFFFF;
|
||||
|
||||
/* Conditional branches read one 32-bit component = 4 bytes (TODO: multi branch??) */
|
||||
if (ins->compact_branch && ins->branch.conditional && (i == 0))
|
||||
return 0xF;
|
||||
|
||||
/* ALU ops act componentwise so we need to pay attention to
|
||||
* their mask. Texture/ldst does not so we don't clamp source
|
||||
* readmasks based on the writemask */
|
||||
unsigned qmask = (ins->type == TAG_ALU_4) ? ins->mask : ~0;
|
||||
|
||||
/* Handle dot products and things */
|
||||
if (ins->type == TAG_ALU_4 && !ins->compact_branch) {
|
||||
unsigned props = alu_opcode_props[ins->alu.op].props;
|
||||
|
||||
unsigned channel_override = GET_CHANNEL_COUNT(props);
|
||||
|
||||
if (channel_override)
|
||||
qmask = mask_of(channel_override);
|
||||
}
|
||||
|
||||
mask |= mir_bytemask_of_read_components_single(ins->swizzle[i], qmask, mir_srcsize(ins, i));
|
||||
mask |= mir_bytemask_of_read_components_index(ins, i);
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue