r600: Lower all bitfield ops on pre-EG
authorGert Wollny <gert.wollny@collabora.com>
Mon, 12 Dec 2022 15:58:38 +0000 (16:58 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 13 Dec 2022 09:04:53 +0000 (09:04 +0000)
Fixes:  4dff3ff005b47befd3e4a903b08d5b4bdbef6ae3
    nir/opt_algebraic: Optimize open coded bfm.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20283>

src/gallium/drivers/r600/r600_pipe_common.c
src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp

index d25708e..2d50283 100644 (file)
@@ -1357,8 +1357,6 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
                .lower_iabs = true,
                .lower_uadd_sat = true,
                .lower_usub_sat = true,
-               .lower_bitfield_extract = true,
-               .lower_bitfield_insert_to_bitfield_select = true,
                .has_fused_comp_and_csel = true,
                .lower_find_msb_to_reverse = true,
                .lower_to_scalar = true,
@@ -1375,10 +1373,17 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
        if (rscreen->info.family < CHIP_CEDAR)
                rscreen->nir_options.force_indirect_unrolling_sampler = true;
 
+   if (rscreen->info.gfx_level >= EVERGREEN) {
+      rscreen->nir_options.lower_bitfield_extract = true;
+               rscreen->nir_options.lower_bitfield_insert_to_bitfield_select = true;
+   }
+
        if (rscreen->info.gfx_level < EVERGREEN) {
                /* Pre-EG doesn't have these ALU ops */
                rscreen->nir_options.lower_bit_count = true;
                rscreen->nir_options.lower_bitfield_reverse = true;
+      rscreen->nir_options.lower_bitfield_insert_to_shifts = true;
+      rscreen->nir_options.lower_bitfield_extract_to_shifts = true;
        }
 
        if (rscreen->info.gfx_level < CAYMAN) {
index e0b8ba3..d7291f8 100644 (file)
@@ -480,7 +480,7 @@ uint8_t AluInstr::allowed_src_chan_mask() const
    }
    /* Each channel can only be loaded in one of three cycles,
     * so if a channel is already used three times, we can't
-    * add another source with this channel.
+    * add another source withthis channel.
     * Since we want to move away from one channel to another, it
     * is not important to know which is the old channel that will
     * be freed by the channel switch.*/