From 6287c8251d2fbb654e1b3320a81e1e5ec321a5e7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 19 Sep 2024 13:15:54 -0400 Subject: [PATCH] nir: add bounds_agx opcode used to facilitate bounds checking optimization Signed-off-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opcodes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index e2d0333ed73..dd1d3165f9e 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -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: +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++) {