Module: Mesa
Branch: main
Commit: d57f5c9cac8dce2460b246405d2176e1e2a1ba05
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d57f5c9cac8dce2460b246405d2176e1e2a1ba05

Author: Georg Lehmann <[email protected]>
Date:   Tue Oct  4 15:44:16 2022 +0200

radv,aco: Lower uclz in NIR.

Signed-off-by: Georg Lehmann <[email protected]>
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18951>

---

 src/amd/compiler/aco_instruction_selection.cpp | 13 -------------
 src/amd/vulkan/radv_shader.c                   |  1 +
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index 74287e1609f..3a4268af5d4 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -1838,19 +1838,6 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
       }
       break;
    }
-   case nir_op_uclz: {
-      Temp src = get_alu_src(ctx, instr->src[0]);
-      if (src.regClass() == s1) {
-         Temp msb_rev = bld.sop1(aco_opcode::s_flbit_i32_b32, bld.def(s1), 
src);
-         bld.sop2(aco_opcode::s_min_u32, Definition(dst), Operand::c32(32u), 
msb_rev);
-      } else if (src.regClass() == v1) {
-         Temp msb_rev = bld.vop1(aco_opcode::v_ffbh_u32, bld.def(v1), src);
-         bld.vop2(aco_opcode::v_min_u32, Definition(dst), Operand::c32(32u), 
msb_rev);
-      } else {
-         isel_err(&instr->instr, "Unimplemented NIR instr bit size");
-      }
-      break;
-   }
    case nir_op_bitfield_reverse: {
       if (dst.regClass() == s1) {
          bld.sop1(aco_opcode::s_brev_b32, Definition(dst), get_alu_src(ctx, 
instr->src[0]));
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 21f465de94e..81daff18988 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -91,6 +91,7 @@ get_nir_options_for_stage(struct radv_physical_device 
*device, gl_shader_stage s
       .lower_iadd_sat = device->rad_info.gfx_level <= GFX8,
       .lower_hadd = true,
       .lower_mul_32x16 = true,
+      .lower_uclz = true,
       .has_fsub = true,
       .has_isub = true,
       .has_sdot_4x8 = device->rad_info.has_accelerated_dot_product,

Reply via email to