nak,nir: Add 32-bit nir_op_lea_nv and use it

Changes code size by -0.80% on shaderdb.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32517>
This commit is contained in:
Mel Henning
2024-11-15 15:56:46 -05:00
committed by Marge Bot
parent 54fcc63d3e
commit 0470643047
5 changed files with 51 additions and 0 deletions
+5
View File
@@ -1412,6 +1412,11 @@ opcode("prmt_nv", 0, tuint32, [0, 0, 0], [tuint32, tuint32, tuint32],
dst |= ((uint32_t)x) << i * 8;
}""")
# Address arithmetic instructions: shift and add
# Shift must be a constant.
opcode("lea_nv", 0, tuint32, [0, 0, 0], [tuint32, tuint32, tuint32], False,
"", "src0 + (src1 << (src2 % bit_size))")
# 24b multiply into 32b result (with sign extension)
binop("imul24", tint32, _2src_commutative + associative,
"(((int32_t)src0 << 8) >> 8) * (((int32_t)src1 << 8) >> 8)")