diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 0a0efc6503f..70b2294d822 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -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); diff --git a/src/asahi/compiler/agx_opcodes.py b/src/asahi/compiler/agx_opcodes.py index c86463f742c..191396d3013 100644 --- a/src/asahi/compiler/agx_opcodes.py +++ b/src/asahi/compiler/agx_opcodes.py @@ -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, _),