aco/builder: use 24bit mul if low bits of imm are zero

Foz-DB Navi31:
Totals from 39 (0.05% of 79395) affected shaders:
Instrs: 62712 -> 62696 (-0.03%)
CodeSize: 330096 -> 329896 (-0.06%)
Latency: 192747 -> 192561 (-0.10%)
InvThroughput: 34078 -> 33889 (-0.55%)
VALU: 38979 -> 38963 (-0.04%)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28223>
This commit is contained in:
Georg Lehmann
2024-03-17 12:53:33 +01:00
committed by Marge Bot
parent b48a101d8f
commit 0c57340c23

View File

@@ -417,6 +417,11 @@ public:
Result v_mul_imm(Definition dst, Temp tmp, uint32_t imm, bool tmpu24=false, bool tmpi24=false)
{
assert(tmp.type() == RegType::vgpr);
/* Assume 24bit if high 8 bits of tmp don't impact the result. */
if ((imm & 0xff) == 0) {
tmpu24 = true;
tmpi24 = true;
}
tmpu24 &= imm <= 0xffffffu;
tmpi24 &= imm <= 0x7fffffu || imm >= 0xff800000u;
bool has_lshl_add = program->gfx_level >= GFX9;