nir: add bounds_agx opcode

used to facilitate bounds checking optimization

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
Alyssa Rosenzweig 2024-09-19 13:15:54 -04:00 committed by Marge Bot
parent b1e5e73011
commit 6287c8251d

View file

@ -1361,6 +1361,13 @@ opcode("imadshl_agx", 0, tint, [0, 0, 0, 0], [tint, tint, tint, tint], False,
opcode("imsubshl_agx", 0, tint, [0, 0, 0, 0], [tint, tint, tint, tint], False,
"", f"(src0 * src1) - (src2 << src3)")
# Bounds check instruction.
#
# Sources: <data, end offset, bounds>
opcode("bounds_agx", 0, tint, [0, 0, 0],
[tint, tint, tint], False,
"", "src1 <= src2 ? src0 : 0")
binop_convert("interleave_agx", tuint32, tuint16, "", """
dst = 0;
for (unsigned bit = 0; bit < 16; bit++) {