aco/optimizer: Add missing v_lshlrev condition to can_apply_extract.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 9 Jan 2023 19:57:05 +0000 (20:57 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 16 Jan 2023 19:27:39 +0000 (19:27 +0000)
This was already handled by apply_extract but missing from
can_apply_extract, therefore may not be properly applied everywhere.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17924>

src/amd/compiler/aco_optimizer.cpp

index 54d6a33..e73ea60 100644 (file)
@@ -1101,6 +1101,11 @@ can_apply_extract(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned idx, ssa_i
       return true;
    } else if (instr->opcode == aco_opcode::v_cvt_f32_u32 && sel.size() == 1 && !sel.sign_extend()) {
       return true;
+   } else if (instr->opcode == aco_opcode::v_lshlrev_b32 && instr->operands[0].isConstant() &&
+              sel.offset() == 0 &&
+              ((sel.size() == 2 && instr->operands[0].constantValue() >= 16u) ||
+               (sel.size() == 1 && instr->operands[0].constantValue() >= 24u))) {
+      return true;
    } else if (idx < 2 && can_use_SDWA(ctx.program->gfx_level, instr, true) &&
               (tmp.type() == RegType::vgpr || ctx.program->gfx_level >= GFX9)) {
       if (instr->isSDWA() && instr->sdwa().sel[idx] != SubdwordSel::dword)