diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 0ac051a8aa3..8dfd33bd739 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -3130,6 +3130,13 @@ optimizations += [ ('bcsel', a, ('pack_half_2x16_rtz_split', b, d), ('pack_half_2x16_rtz_split', c, e))), (('pack_half_2x16_rtz_split', ('b2f', 'a@1'), ('b2f', a)), ('bcsel', a, 0x3c003c00, 0)), + + (('pack_32_2x16_split', 'a(is_undef)', ('bcsel', b, '#c', d)), + ('bcsel', b, ('pack_32_2x16_split', 0, c), ('pack_32_2x16_split', a, d)), + 'true', TestStatus.UNSUPPORTED), + (('pack_32_2x16_split', 'a(is_undef)', ('bcsel', b, c, '#d')), + ('bcsel', b, ('pack_32_2x16_split', a, c), ('pack_32_2x16_split', 0, d)), + 'true', TestStatus.UNSUPPORTED), ] # Some operations such as iadd have the property that the bottom N bits of the diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 0307a02a30c..1d2340fda24 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -1079,4 +1079,11 @@ is_created_as_float(const nir_search_state *state, const nir_alu_instr *instr, u return nir_alu_type_get_base_type(output_type) == nir_type_float; } +static inline bool +is_undef(const nir_search_state *state, const nir_alu_instr *instr, unsigned src, + UNUSED unsigned num_components, UNUSED const uint8_t *swizzle) +{ + return nir_src_is_undef(instr->src[src].src); +} + #endif /* _NIR_SEARCH_ */