aco/lower_to_hw: optimize split 64bit constant copies
Foz-DB Navi21: Totals from 3209 (4.04% of 79395) affected shaders: Instrs: 6502065 -> 6496612 (-0.08%) CodeSize: 35578300 -> 35556596 (-0.06%) Latency: 66092924 -> 66092668 (-0.00%); split: -0.00%, +0.00% InvThroughput: 16968953 -> 16968900 (-0.00%); split: -0.00%, +0.00% SClause: 198651 -> 198647 (-0.00%) Copies: 597323 -> 591872 (-0.91%) SALU: 930918 -> 925467 (-0.59%) Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29422>
This commit is contained in:
@@ -1776,6 +1776,23 @@ handle_operands(std::map<PhysReg, copy_operation>& copy_map, lower_context* ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* optimize constant copies to aligned sgpr pair that's otherwise unused. */
|
||||
if (it->first <= exec && (it->first % 2) == 0 && it->second.bytes == 4 &&
|
||||
it->second.op.isConstant() && !it->second.is_used) {
|
||||
PhysReg reg_hi = it->first.advance(4);
|
||||
std::map<PhysReg, copy_operation>::iterator other = copy_map.find(reg_hi);
|
||||
if (other != copy_map.end() && other->second.bytes == 4 && other->second.op.isConstant() &&
|
||||
!other->second.is_used) {
|
||||
uint64_t constant =
|
||||
it->second.op.constantValue64() | (other->second.op.constantValue64() << 32);
|
||||
copy_constant_sgpr(bld, Definition(it->first, s2), constant);
|
||||
copy_map.erase(it);
|
||||
copy_map.erase(other);
|
||||
it = copy_map.begin();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* find portions where the target reg is not used as operand for any other copy */
|
||||
if (it->second.is_used) {
|
||||
if (it->second.op.isConstant() || skip_partial_copies) {
|
||||
|
Reference in New Issue
Block a user