pco, pygen: expose enhanced logical ops with optional mask

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
Simon Perretta 2025-01-01 21:53:54 +00:00 committed by Marge Bot
parent 6d72ef6c0f
commit 97f167f227
4 changed files with 29 additions and 8 deletions

View file

@ -27,6 +27,7 @@ REF_MAP = enum_type('ref_map', [
('ft0', 'ft0'),
('ft1', 'ft1'),
('ft1_invert', '~ft1'),
('ft2', 'ft2'),
('fte', 'fte'),
@ -1258,15 +1259,27 @@ encode_map(O_BBYP0S1,
op_ref_maps=[('0', ['ft2'], ['s2'])]
)
encode_map(O_MSK_BBYP0S1,
encodings=[
(I_PHASE0_SRC, [
('count_src', 's2'),
('count_op', 'byp'),
('bitmask_src_op', 'msk'),
('shift1_op', 'byp')
])
],
op_ref_maps=[('0', ['ft0', 'ft1', 'ft2'], ['s0', 's1', 's2'])]
)
encode_map(O_LOGICAL,
encodings=[
(I_PHASE1, [
('mskb', False),
('mska', False),
('mskb', ('!pco_ref_is_null', SRC(2))),
('mska', ('!pco_ref_is_null', SRC(0))),
('logical_op', OM_LOGIOP),
])
],
op_ref_maps=[('1', ['ft4'], ['ft2', 's3'])]
op_ref_maps=[('1', ['ft4'], [['ft1', '_'], 'ft2', ['ft1_invert', '_'], 's3'])]
)
encode_map(O_SHIFT,
@ -2105,12 +2118,12 @@ group_map(O_LOGICAL,
('rpt', OM_RPT)
]),
enc_ops=[
('0', O_BBYP0S1, ['ft2'], [SRC(0)]),
('1', O_LOGICAL, [DEST(0)], ['ft2', SRC(1)], [(OM_LOGIOP, OM_LOGIOP)])
('0', O_BBYP0S1, ['ft2'], [SRC(1)]),
('1', O_LOGICAL, [DEST(0)], [SRC(0), 'ft2', SRC(2), SRC(3)], [(OM_LOGIOP, OM_LOGIOP)])
],
srcs=[
('s[2]', ('0', SRC(0)), 's2'),
('s[3]', ('1', SRC(1)), 's3')
('s[3]', ('1', SRC(3)), 's3')
],
dests=[('w[0]', ('1', DEST(0)), 'ft4')]
)

View file

@ -347,12 +347,13 @@ O_ATOMIC = hw_op('atomic', [OM_OLCHK, OM_EXEC_CND, OM_END, OM_ATOM_OP], 1, 2)
## Bitwise.
O_MOVI32 = hw_op('movi32', OM_ALU, 1, 1)
O_LOGICAL = hw_op('logical', OM_ALU + [OM_LOGIOP], 1, 2)
O_LOGICAL = hw_op('logical', OM_ALU + [OM_LOGIOP], 1, 4)
O_SHIFT = hw_op('shift', OM_ALU + [OM_SHIFTOP], 1, 3)
O_BBYP0BM = hw_direct_op('bbyp0bm', [], 2, 2)
O_BBYP0BM_IMM32 = hw_direct_op('bbyp0bm_imm32', [], 2, 2)
O_BBYP0S1 = hw_direct_op('bbyp0s1', [], 1, 1)
O_MSK_BBYP0S1 = hw_direct_op('msk_bbyp0s1', [], 3, 3)
## Control.
O_WOP = hw_op('wop')

View file

@ -1041,7 +1041,13 @@ static pco_instr *trans_logical(trans_ctx *tctx,
UNREACHABLE("");
}
return pco_logical(&tctx->b, dest, src0, src1, .logiop = logiop);
return pco_logical(&tctx->b,
dest,
pco_ref_null(),
src0,
pco_ref_null(),
src1,
.logiop = logiop);
}
/**

View file

@ -303,6 +303,7 @@ static inline bool ref_is_in_map(pco_ref ref, enum pco_ref_map ref_maps)
CHECK_IO(FT0, ref)
CHECK_IO(FT1, ref)
CHECK_IO(FT1_INVERT, ref)
CHECK_IO(FT2, ref)
CHECK_IO(FTE, ref)
CHECK_IO(FT3, ref)