pan/midgard: Specialize mod checking by type when checking constants
Fixes inlining of integer constants. total quadwords in shared programs: 3585 -> 3568 (-0.47%) quadwords in affected programs: 625 -> 608 (-2.72%) helped: 13 HURT: 0 helped stats (abs) min: 1 max: 2 x̄: 1.31 x̃: 1 helped stats (rel) min: 1.27% max: 9.52% x̄: 3.84% x̃: 2.94% 95% mean confidence interval for quadwords value: -1.60 -1.02 95% mean confidence interval for quadwords %-change: -5.60% -2.07% Quadwords are helped. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
e823d33e77
commit
94e281b9e0
|
@ -390,6 +390,7 @@ void mir_print_instruction(midgard_instruction *ins);
|
|||
void mir_print_bundle(midgard_bundle *ctx);
|
||||
void mir_print_block(midgard_block *block);
|
||||
void mir_print_shader(compiler_context *ctx);
|
||||
bool mir_nontrivial_raw_mod(midgard_vector_alu_src src, bool is_int);
|
||||
bool mir_nontrivial_source2_mod(midgard_instruction *ins);
|
||||
bool mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask);
|
||||
bool mir_nontrivial_outmod(midgard_instruction *ins);
|
||||
|
|
|
@ -1902,7 +1902,8 @@ embedded_to_inline_constant(compiler_context *ctx)
|
|||
|
||||
/* We don't know how to handle these with a constant */
|
||||
|
||||
if (src->mod || src->half || src->rep_low || src->rep_high) {
|
||||
bool is_int = midgard_is_integer_op(ins->alu.op);
|
||||
if (mir_nontrivial_raw_mod(*src, is_int) || src->half || src->rep_low || src->rep_high) {
|
||||
DBG("Bailing inline constant...\n");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -108,14 +108,19 @@ mir_single_use(compiler_context *ctx, unsigned value)
|
|||
return mir_use_count(ctx, value) <= 1;
|
||||
}
|
||||
|
||||
bool
|
||||
mir_nontrivial_raw_mod(midgard_vector_alu_src src, bool is_int)
|
||||
{
|
||||
if (is_int)
|
||||
return src.mod == midgard_int_shift;
|
||||
else
|
||||
return src.mod;
|
||||
}
|
||||
|
||||
bool
|
||||
mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask)
|
||||
{
|
||||
/* abs or neg */
|
||||
if (!is_int && src.mod) return true;
|
||||
|
||||
/* Other int mods don't matter in isolation */
|
||||
if (is_int && src.mod == midgard_int_shift) return true;
|
||||
if (mir_nontrivial_raw_mod(src, is_int)) return true;
|
||||
|
||||
/* size-conversion */
|
||||
if (src.half) return true;
|
||||
|
@ -128,7 +133,6 @@ mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
mir_nontrivial_source2_mod(midgard_instruction *ins)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue