From 9ab8d70fa628e689b53695170eca8dca5b16b447 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 1 Nov 2024 10:34:43 -0400 Subject: [PATCH] nir: add ilea_agx/ulea_agx opcodes to facilitate address mode lowering. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Karol Herbst 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 372728c9f92..564ab540e59 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -1347,6 +1347,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)") +# Address arithmetic instructions: extend, shift, and add +# Shift must be a small constant. +opcode("ilea_agx", 0, tuint64, [0, 0, 0], [tuint64, tint32, tuint32], False, + "", f"src0 + (((int64_t)src1) << src2)") +opcode("ulea_agx", 0, tuint64, [0, 0, 0], [tuint64, tuint32, tuint32], False, + "", f"src0 + (((uint64_t)src1) << src2)") + # Bounds check instruction. # # Sources: