pco, pygen: add f{min,max} support

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33998>
This commit is contained in:
Simon Perretta
2024-12-06 19:39:51 +00:00
committed by Marge Bot
parent 1cd2bb58fb
commit dc6ea99fde
3 changed files with 76 additions and 0 deletions
+62
View File
@@ -1324,6 +1324,68 @@ group_map(O_SCMP,
]
)
group_map(O_FMIN,
hdr=(I_IGRP_HDR_MAIN, [
('oporg', 'p0_p1_p2'),
('olchk', OM_OLCHK),
('w1p', False),
('w0p', True),
('cc', OM_EXEC_CND),
('end', OM_END),
('atom', OM_ATOM),
('rpt', OM_RPT)
]),
enc_ops=[
('0', O_MBYP, ['ft0'], [SRC(0)]),
('1', O_MBYP, ['ft1'], [SRC(1)]),
('2_tst', O_TST, ['ftt', '_'], ['is1', 'is2'], [(OM_TST_OP_MAIN, 'less'), (OM_TST_TYPE_MAIN, 'f32'), (OM_PHASE2END, True)]),
('2_mov', O_MOVC, [DEST(0), '_'], ['ftt', 'ft0', 'is4', '_', '_'])
],
srcs=[
('s[0]', ('0', SRC(0)), 's0'),
('s[3]', ('1', SRC(0)), 's3'),
],
iss=[
('is[1]', 'ft0'),
('is[2]', 'ft1'),
('is[4]', 'ft1'),
],
dests=[
('w[0]', ('2_mov', DEST(0)), 'w0'),
]
)
group_map(O_FMAX,
hdr=(I_IGRP_HDR_MAIN, [
('oporg', 'p0_p1_p2'),
('olchk', OM_OLCHK),
('w1p', False),
('w0p', True),
('cc', OM_EXEC_CND),
('end', OM_END),
('atom', OM_ATOM),
('rpt', OM_RPT)
]),
enc_ops=[
('0', O_MBYP, ['ft0'], [SRC(0)]),
('1', O_MBYP, ['ft1'], [SRC(1)]),
('2_tst', O_TST, ['ftt', '_'], ['is1', 'is2'], [(OM_TST_OP_MAIN, 'greater'), (OM_TST_TYPE_MAIN, 'f32'), (OM_PHASE2END, True)]),
('2_mov', O_MOVC, [DEST(0), '_'], ['ftt', 'ft0', 'is4', '_', '_'])
],
srcs=[
('s[0]', ('0', SRC(0)), 's0'),
('s[3]', ('1', SRC(0)), 's3'),
],
iss=[
('is[1]', 'ft0'),
('is[2]', 'ft1'),
('is[4]', 'ft1'),
],
dests=[
('w[0]', ('2_mov', DEST(0)), 'w0'),
]
)
group_map(O_UVSW_WRITE,
hdr=(I_IGRP_HDR_MAIN, [
('oporg', 'be'),
+2
View File
@@ -341,6 +341,8 @@ O_DITRP_READ = hw_op('ditrp.read', [OM_EXEC_CND, OM_ITR_MODE, OM_SAT, OM_SCHED,
# Combination (> 1 instructions per group).
O_SCMP = hw_op('scmp', OM_ALU + [OM_TST_OP_MAIN], 1, 2, [], [[RM_ABS, RM_NEG], [RM_ABS, RM_NEG]])
O_FMIN = hw_op('fmin', OM_ALU, 1, 2, [], [[RM_ABS, RM_NEG], [RM_ABS, RM_NEG]])
O_FMAX = hw_op('fmax', OM_ALU, 1, 2, [], [[RM_ABS, RM_NEG], [RM_ABS, RM_NEG]])
# Pseudo-ops (unmapped).
O_NEG = pseudo_op('neg', OM_ALU, 1, 1)
+12
View File
@@ -849,6 +849,14 @@ static pco_instr *trans_alu(trans_ctx *tctx, nir_alu_instr *alu)
.pck_fmt = PCO_PCK_FMT_U32);
break;
case nir_op_fmin:
instr = pco_fmin(&tctx->b, dest, src[0], src[1]);
break;
case nir_op_fmax:
instr = pco_fmax(&tctx->b, dest, src[0], src[1]);
break;
case nir_op_pack_unorm_4x8:
instr = pco_pck(&tctx->b,
dest,
@@ -867,6 +875,10 @@ static pco_instr *trans_alu(trans_ctx *tctx, nir_alu_instr *alu)
instr = pco_trans_nir_vec(tctx, dest, num_srcs, src);
break;
case nir_op_mov:
instr = pco_mov(&tctx->b, dest, src[0]);
break;
default:
printf("Unsupported alu instruction: \"");
nir_print_instr(&alu->instr, stdout);