mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
pan/mdg: Implement i/umul_high
As imul with a .hi modifier, which implies a 64-bit computation. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6516>
This commit is contained in:
parent
fd41dece39
commit
3e2cb21e53
2 changed files with 15 additions and 1 deletions
|
|
@ -881,6 +881,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
|
|||
ALU_CASE(iadd, iadd);
|
||||
ALU_CASE(isub, isub);
|
||||
ALU_CASE(imul, imul);
|
||||
ALU_CASE(imul_high, imul);
|
||||
ALU_CASE(umul_high, imul);
|
||||
|
||||
/* Zero shoved as second-arg */
|
||||
ALU_CASE(iabs, iabsdiff);
|
||||
|
|
@ -1059,7 +1061,9 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
|
|||
unsigned outmod = 0;
|
||||
bool is_int = midgard_is_integer_op(op);
|
||||
|
||||
if (midgard_is_integer_out_op(op)) {
|
||||
if (instr->op == nir_op_umul_high || instr->op == nir_op_imul_high) {
|
||||
outmod = midgard_outmod_int_high;
|
||||
} else if (midgard_is_integer_out_op(op)) {
|
||||
outmod = midgard_outmod_int_wrap;
|
||||
} else if (instr->op == nir_op_fsat) {
|
||||
outmod = midgard_outmod_sat;
|
||||
|
|
@ -2392,6 +2396,13 @@ max_bitsize_for_alu(midgard_instruction *ins)
|
|||
break;
|
||||
}
|
||||
|
||||
/* High implies computing at a higher bitsize, e.g umul_high of 32-bit
|
||||
* requires computing at 64-bit */
|
||||
if (midgard_is_integer_out_op(ins->op) && ins->outmod == midgard_outmod_int_high) {
|
||||
max_bitsize *= 2;
|
||||
assert(max_bitsize <= 64);
|
||||
}
|
||||
|
||||
return max_bitsize;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,6 +212,9 @@ mir_is_scalar(midgard_instruction *ains)
|
|||
if (ains->src[1] != ~0)
|
||||
could_scalar &= (sz1 == 16) || (sz1 == 32);
|
||||
|
||||
if (midgard_is_integer_out_op(ains->op) && ains->outmod != midgard_outmod_int_wrap)
|
||||
return false;
|
||||
|
||||
return could_scalar;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue