Revert "aco: Combine v_cvt_u32_f32 with insert to v_cvt_pk_u8_f32."

This reverts commit 6d02054047.

v_cvt_pk_u8_f32 returns 0xff instead of v_cvt_u32_f32 & 0xff if the input is
larger than 255.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8128

Cc: mesa-stable
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20829>
(cherry picked from commit e527f686ca)
This commit is contained in:
Georg Lehmann 2023-01-21 17:08:03 +01:00 committed by Dylan Baker
parent 14ecd96183
commit 01ff451d34
2 changed files with 10 additions and 19 deletions

View file

@ -58,7 +58,7 @@
"description": "Revert \"aco: Combine v_cvt_u32_f32 with insert to v_cvt_pk_u8_f32.\"",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -623,15 +623,15 @@ can_apply_sgprs(opt_ctx& ctx, aco_ptr<Instruction>& instr)
}
void
to_VOP3(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned add_operands = 0)
to_VOP3(opt_ctx& ctx, aco_ptr<Instruction>& instr)
{
if (instr->isVOP3())
return;
aco_ptr<Instruction> tmp = std::move(instr);
Format format = asVOP3(tmp->format);
instr.reset(create_instruction<VOP3_instruction>(
tmp->opcode, format, tmp->operands.size() + add_operands, tmp->definitions.size()));
instr.reset(create_instruction<VOP3_instruction>(tmp->opcode, format, tmp->operands.size(),
tmp->definitions.size()));
std::copy(tmp->operands.cbegin(), tmp->operands.cend(), instr->operands.begin());
for (unsigned i = 0; i < instr->definitions.size(); i++) {
instr->definitions[i] = tmp->definitions[i];
@ -3412,22 +3412,13 @@ apply_insert(opt_ctx& ctx, aco_ptr<Instruction>& instr)
SubdwordSel sel = parse_insert(def_info.instr);
assert(sel);
if (instr->opcode == aco_opcode::v_cvt_u32_f32 && instr->format == Format::VOP1 &&
!sel.sign_extend() && sel.size() == 1) {
to_VOP3(ctx, instr, 2);
instr->format = Format::VOP3;
instr->opcode = aco_opcode::v_cvt_pk_u8_f32;
instr->operands[1] = Operand::c32(sel.offset());
instr->operands[2] = Operand::zero();
} else {
if (!can_use_SDWA(ctx.program->gfx_level, instr, true))
return false;
if (!can_use_SDWA(ctx.program->gfx_level, instr, true))
return false;
to_SDWA(ctx, instr);
if (instr->sdwa().dst_sel.size() != 4)
return false;
static_cast<SDWA_instruction*>(instr.get())->dst_sel = sel;
}
to_SDWA(ctx, instr);
if (instr->sdwa().dst_sel.size() != 4)
return false;
static_cast<SDWA_instruction*>(instr.get())->dst_sel = sel;
instr->definitions[0].swapTemp(def_info.instr->definitions[0]);
ctx.info[instr->definitions[0].tempId()].label = 0;