freedreno/ir3: fold const conversion into consumer
A sequence like: (nop3)cov.f32f16 hr0.x, c0.x mul.f hr4.y, hr1.z, hr0.x can be turned into: mul.f hr4.y, hr1.z, hc0.x Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3737>
This commit is contained in:
committed by
Kristian H. Kristensen
parent
5e2012d5c7
commit
3eca6d9ce1
@@ -695,6 +695,25 @@ static inline bool is_same_type_mov(struct ir3_instruction *instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* A move from const, which changes size but not type, can also be
|
||||
* folded into dest instruction in some cases.
|
||||
*/
|
||||
static inline bool is_const_mov(struct ir3_instruction *instr)
|
||||
{
|
||||
if (instr->opc != OPC_MOV)
|
||||
return false;
|
||||
|
||||
if (!(instr->regs[1]->flags & IR3_REG_CONST))
|
||||
return false;
|
||||
|
||||
type_t src_type = instr->cat1.src_type;
|
||||
type_t dst_type = instr->cat1.dst_type;
|
||||
|
||||
return (type_float(src_type) && type_float(dst_type)) ||
|
||||
(type_uint(src_type) && type_uint(dst_type)) ||
|
||||
(type_sint(src_type) && type_sint(dst_type));
|
||||
}
|
||||
|
||||
static inline bool is_alu(struct ir3_instruction *instr)
|
||||
{
|
||||
return (1 <= opc_cat(instr->opc)) && (opc_cat(instr->opc) <= 3);
|
||||
|
||||
@@ -463,7 +463,7 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (is_same_type_mov(src) &&
|
||||
} else if ((is_same_type_mov(src) || is_const_mov(src)) &&
|
||||
/* cannot collapse const/immed/etc into meta instrs: */
|
||||
!is_meta(instr)) {
|
||||
/* immed/const/etc cases, which require some special handling: */
|
||||
|
||||
Reference in New Issue
Block a user