mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 13:40:16 +01:00
aco: better handle neg/abs of sgprs
isel/label_instruction currently doesn't create these but we should probably check anyway. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-By: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3081>
This commit is contained in:
parent
f29a5a205c
commit
21eafe30df
1 changed files with 3 additions and 2 deletions
|
|
@ -924,7 +924,8 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case aco_opcode::v_and_b32: /* abs */
|
case aco_opcode::v_and_b32: /* abs */
|
||||||
if (!instr->usesModifiers() && instr->operands[0].constantEquals(0x7FFFFFFF) && instr->operands[1].isTemp())
|
if (!instr->usesModifiers() && instr->operands[0].constantEquals(0x7FFFFFFF) &&
|
||||||
|
instr->operands[1].isTemp() && instr->operands[1].getTemp().type() == RegType::vgpr)
|
||||||
ctx.info[instr->definitions[0].tempId()].set_abs(instr->operands[1].getTemp());
|
ctx.info[instr->definitions[0].tempId()].set_abs(instr->operands[1].getTemp());
|
||||||
else
|
else
|
||||||
ctx.info[instr->definitions[0].tempId()].set_bitwise(instr.get());
|
ctx.info[instr->definitions[0].tempId()].set_bitwise(instr.get());
|
||||||
|
|
@ -933,7 +934,7 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
|
||||||
if (!instr->usesModifiers() && instr->operands[0].constantEquals(0x80000000u) && instr->operands[1].isTemp()) {
|
if (!instr->usesModifiers() && instr->operands[0].constantEquals(0x80000000u) && instr->operands[1].isTemp()) {
|
||||||
if (ctx.info[instr->operands[1].tempId()].is_neg()) {
|
if (ctx.info[instr->operands[1].tempId()].is_neg()) {
|
||||||
ctx.info[instr->definitions[0].tempId()].set_temp(ctx.info[instr->operands[1].tempId()].temp);
|
ctx.info[instr->definitions[0].tempId()].set_temp(ctx.info[instr->operands[1].tempId()].temp);
|
||||||
} else {
|
} else if (instr->operands[1].getTemp().type() == RegType::vgpr) {
|
||||||
if (ctx.info[instr->operands[1].tempId()].is_abs()) { /* neg(abs(x)) */
|
if (ctx.info[instr->operands[1].tempId()].is_abs()) { /* neg(abs(x)) */
|
||||||
instr->operands[1].setTemp(ctx.info[instr->operands[1].tempId()].temp);
|
instr->operands[1].setTemp(ctx.info[instr->operands[1].tempId()].temp);
|
||||||
instr->opcode = aco_opcode::v_or_b32;
|
instr->opcode = aco_opcode::v_or_b32;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue