agx: Implement unary math ops

Implement nir_op_bitfield_reverse, nir_op_bit_count, and
nir_op_ufind_msb. These map to native instructions.  With appropriate
integer render target and multiple render target support, passes:

   dEQP-GLES31.functional.shaders.builtin_functions.integer.bitfieldreverse.*vertex
   dEQP-GLES31.functional.shaders.builtin_functions.integer.bitfieldreverse.*fragment
   dEQP-GLES31.functional.shaders.builtin_functions.integer.bitcount.*vertex
   dEQP-GLES31.functional.shaders.builtin_functions.integer.bitcount.*fragment
   dEQP-GLES31.functional.shaders.builtin_functions.integer.findLSB.*vertex
   dEQP-GLES31.functional.shaders.builtin_functions.integer.findLSB.*fragment
   dEQP-GLES31.functional.shaders.builtin_functions.integer.findMSB.*vertex
   dEQP-GLES31.functional.shaders.builtin_functions.integer.findMSB.*fragment

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19590>
This commit is contained in:
Alyssa Rosenzweig
2022-10-23 20:50:17 -04:00
committed by Marge Bot
parent 44ccdca768
commit ededb108d9
2 changed files with 14 additions and 0 deletions
+3
View File
@@ -871,6 +871,9 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
UNOP(mov, mov);
UNOP(u2u16, mov);
UNOP(u2u32, mov);
UNOP(bitfield_reverse, bitrev);
UNOP(bit_count, popcount);
UNOP(ufind_msb, ffs);
UNOP(inot, not);
BINOP(iand, and);
BINOP(ior, or);
+11
View File
@@ -148,6 +148,13 @@ def funop(name, opcode):
0x3F | L | (((1 << 14) - 1) << 28), 6, _),
srcs = 1, is_float = True)
def iunop(name, opcode):
assert(opcode < 4)
op(name, (0x3E | (opcode << 26),
0x7F | L | (((1 << 14) - 1) << 26),
6, _),
srcs = 1)
# Listing of opcodes
funop("floor", 0b000000)
funop("srsqrt", 0b000001)
@@ -163,6 +170,10 @@ funop("ceil", 0b010000)
funop("trunc", 0b100000)
funop("roundeven", 0b110000)
iunop("bitrev", 0b01)
iunop("popcount", 0b10)
iunop("ffs", 0b11)
op("fadd",
encoding_16 = (0x26 | L, 0x3F | L, 6, _),
encoding_32 = (0x2A | L, 0x3F | L, 6, _),