zink: support more nir opcodes
authorKarol Herbst <kherbst@redhat.com>
Tue, 19 Sep 2023 12:44:26 +0000 (14:44 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sat, 14 Oct 2023 01:01:16 +0000 (01:01 +0000)
There are sadly no SPIRV variants for hadd or iadd_sat we can use, so
lower those.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24839>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
src/gallium/drivers/zink/zink_compiler.c

index d1f26cb..b2080f6 100644 (file)
@@ -1834,6 +1834,7 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
    UNOP(nir_op_f2f64, SpvOpFConvert)
    UNOP(nir_op_bitfield_reverse, SpvOpBitReverse)
    UNOP(nir_op_bit_count, SpvOpBitCount)
+   UNOP(nir_op_fisnormal, SpvOpIsNormal)
 #undef UNOP
 
    case nir_op_f2f16_rtz:
index 57e8e4f..d2061e4 100644 (file)
@@ -1210,6 +1210,8 @@ zink_screen_init_compiler(struct zink_screen *screen)
       .lower_flrp32 = true,
       .lower_fpow = true,
       .lower_fsat = true,
+      .lower_hadd = true,
+      .lower_iadd_sat = true,
       .lower_extract_byte = true,
       .lower_extract_word = true,
       .lower_insert_byte = true,