aco: handle opsel in combine_constant_comparison_ordering
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22069>
This commit is contained in:
@@ -2472,9 +2472,8 @@ combine_constant_comparison_ordering(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||||||
Instruction* nan_test = follow_operand(ctx, instr->operands[0], true);
|
Instruction* nan_test = follow_operand(ctx, instr->operands[0], true);
|
||||||
Instruction* cmp = follow_operand(ctx, instr->operands[1], true);
|
Instruction* cmp = follow_operand(ctx, instr->operands[1], true);
|
||||||
|
|
||||||
if (!nan_test || !cmp || nan_test->isSDWA() || cmp->isSDWA())
|
if (!nan_test || !cmp || nan_test->isSDWA() || cmp->isSDWA() || nan_test->isDPP() ||
|
||||||
return false;
|
cmp->isDPP())
|
||||||
if (nan_test->isSDWA() || cmp->isSDWA())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
aco_opcode expected_nan_test = is_or ? aco_opcode::v_cmp_neq_f32 : aco_opcode::v_cmp_eq_f32;
|
aco_opcode expected_nan_test = is_or ? aco_opcode::v_cmp_neq_f32 : aco_opcode::v_cmp_eq_f32;
|
||||||
@@ -2497,17 +2496,15 @@ combine_constant_comparison_ordering(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||||||
if (prop_nan0 != prop_nan1)
|
if (prop_nan0 != prop_nan1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (nan_test->isVOP3()) {
|
|
||||||
VALU_instruction& vop3 = nan_test->valu();
|
VALU_instruction& vop3 = nan_test->valu();
|
||||||
if (vop3.neg[0] != vop3.neg[1] || vop3.abs[0] != vop3.abs[1] ||
|
if (vop3.neg[0] != vop3.neg[1] || vop3.abs[0] != vop3.abs[1] || vop3.opsel[0] != vop3.opsel[1])
|
||||||
vop3.opsel[0] != vop3.opsel[1])
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
int constant_operand = -1;
|
int constant_operand = -1;
|
||||||
for (unsigned i = 0; i < 2; i++) {
|
for (unsigned i = 0; i < 2; i++) {
|
||||||
if (cmp->operands[i].isTemp() &&
|
if (cmp->operands[i].isTemp() &&
|
||||||
original_temp_id(ctx, cmp->operands[i].getTemp()) == prop_nan0) {
|
original_temp_id(ctx, cmp->operands[i].getTemp()) == prop_nan0 &&
|
||||||
|
cmp->valu().opsel[i] == nan_test->valu().opsel[0]) {
|
||||||
constant_operand = !i;
|
constant_operand = !i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2518,24 +2515,16 @@ combine_constant_comparison_ordering(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||||||
uint64_t constant_value;
|
uint64_t constant_value;
|
||||||
if (!is_operand_constant(ctx, cmp->operands[constant_operand], bit_size, &constant_value))
|
if (!is_operand_constant(ctx, cmp->operands[constant_operand], bit_size, &constant_value))
|
||||||
return false;
|
return false;
|
||||||
if (is_constant_nan(constant_value, bit_size))
|
if (is_constant_nan(constant_value >> (cmp->valu().opsel[constant_operand] * 16), bit_size))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
aco_opcode new_op = is_or ? get_unordered(cmp->opcode) : get_ordered(cmp->opcode);
|
aco_opcode new_op = is_or ? get_unordered(cmp->opcode) : get_ordered(cmp->opcode);
|
||||||
Instruction* new_instr;
|
Instruction* new_instr = create_instruction<VALU_instruction>(new_op, cmp->format, 2, 1);
|
||||||
if (cmp->isVOP3()) {
|
new_instr->valu().neg = cmp->valu().neg;
|
||||||
VALU_instruction* new_vop3 =
|
new_instr->valu().abs = cmp->valu().abs;
|
||||||
create_instruction<VALU_instruction>(new_op, asVOP3(Format::VOPC), 2, 1);
|
new_instr->valu().clamp = cmp->valu().clamp;
|
||||||
VALU_instruction& cmp_vop3 = cmp->valu();
|
new_instr->valu().omod = cmp->valu().omod;
|
||||||
new_vop3->neg = cmp_vop3.neg;
|
new_instr->valu().opsel = cmp->valu().opsel;
|
||||||
new_vop3->abs = cmp_vop3.abs;
|
|
||||||
new_vop3->clamp = cmp_vop3.clamp;
|
|
||||||
new_vop3->omod = cmp_vop3.omod;
|
|
||||||
new_vop3->opsel = cmp_vop3.opsel;
|
|
||||||
new_instr = new_vop3;
|
|
||||||
} else {
|
|
||||||
new_instr = create_instruction<VALU_instruction>(new_op, Format::VOPC, 2, 1);
|
|
||||||
}
|
|
||||||
new_instr->operands[0] = copy_operand(ctx, cmp->operands[0]);
|
new_instr->operands[0] = copy_operand(ctx, cmp->operands[0]);
|
||||||
new_instr->operands[1] = copy_operand(ctx, cmp->operands[1]);
|
new_instr->operands[1] = copy_operand(ctx, cmp->operands[1]);
|
||||||
new_instr->definitions[0] = instr->definitions[0];
|
new_instr->definitions[0] = instr->definitions[0];
|
||||||
|
Reference in New Issue
Block a user