From a8013644a1e7d13e2a3164beb5f387195f797e36 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 1 Aug 2023 11:55:12 -0400 Subject: [PATCH] nir: Drop nir_alu_src::{negate,abs} MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Reviewed-by: Marek Olšák Part-of: --- src/amd/llvm/ac_nir_to_llvm.c | 2 -- src/asahi/compiler/agx_compile.c | 1 - src/broadcom/compiler/nir_to_vir.c | 3 --- src/compiler/nir/nir.c | 18 +---------------- src/compiler/nir/nir.h | 23 +--------------------- src/compiler/nir/nir_builder.h | 1 - src/compiler/nir/nir_clone.c | 2 -- src/compiler/nir/nir_instr_set.c | 12 +---------- src/compiler/nir/nir_legacy.c | 2 -- src/compiler/nir/nir_loop_analyze.c | 3 --- src/compiler/nir/nir_move_vec_src_uses_to_dest.c | 4 ---- src/compiler/nir/nir_opt_constant_folding.c | 3 --- src/compiler/nir/nir_opt_if.c | 2 -- src/compiler/nir/nir_opt_offsets.c | 4 +--- src/compiler/nir/nir_opt_vectorize.c | 7 ------- src/compiler/nir/nir_search.c | 8 -------- src/compiler/nir/nir_validate.c | 3 --- src/freedreno/ir3/ir3_compiler_nir.c | 6 ------ src/gallium/auxiliary/gallivm/lp_bld_nir.c | 2 -- src/gallium/auxiliary/nir/nir_to_tgsi.c | 1 - src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c | 6 ------ .../etnaviv/etnaviv_nir_lower_source_mods.c | 4 ++-- src/gallium/drivers/lima/ir/gp/nir.c | 1 - src/gallium/drivers/vc4/vc4_program.c | 3 --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 3 --- src/intel/compiler/brw_fs_nir.cpp | 8 -------- src/intel/compiler/brw_nir_opt_peephole_ffma.c | 1 - src/intel/compiler/brw_vec4_nir.cpp | 4 ---- src/microsoft/compiler/nir_to_dxil.c | 3 --- src/nouveau/codegen/nv50_ir_from_nir.cpp | 4 ---- src/panfrost/compiler/bifrost_compile.c | 3 --- 31 files changed, 6 insertions(+), 141 deletions(-) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index a54be16..0cb9ef3 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -99,8 +99,6 @@ static LLVMValueRef get_alu_src(struct ac_nir_context *ctx, nir_alu_src src, value = LLVMBuildShuffleVector(ctx->ac.builder, value, value, swizzle, ""); } } - assert(!src.negate); - assert(!src.abs); return value; } diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index f04f705..c680555 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -1163,7 +1163,6 @@ agx_alu_src_index(agx_builder *b, nir_alu_src src) assert(bitsize == 1 || bitsize == 8 || bitsize == 16 || bitsize == 32 || bitsize == 64); - assert(!(src.negate || src.abs)); assert(channel < comps); return agx_extract_nir_src(b, src.src, channel); diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index b50bbab..e516b58 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -883,9 +883,6 @@ ntq_get_alu_src(struct v3d_compile *c, nir_alu_instr *instr, struct qreg r = ntq_get_src(c, instr->src[src].src, instr->src[src].swizzle[0]); - assert(!instr->src[src].abs); - assert(!instr->src[src].negate); - return r; }; diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 0215836..d3804c4 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -508,8 +508,6 @@ nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src, nir_alu_instr *instr) { nir_src_copy(&dest->src, &src->src, instr ? &instr->instr : NULL); - dest->abs = src->abs; - dest->negate = src->negate; for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) dest->swizzle[i] = src->swizzle[i]; } @@ -524,7 +522,6 @@ nir_alu_src_is_trivial_ssa(const nir_alu_instr *alu, unsigned srcn) unsigned num_components = nir_ssa_alu_instr_src_components(alu, srcn); return src->src.is_ssa && (src->src.ssa->num_components == num_components) && - !src->abs && !src->negate && (memcmp(src->swizzle, trivial_swizzle, num_components) == 0); } @@ -681,7 +678,6 @@ static void alu_src_init(nir_alu_src *src) { src_init(&src->src); - src->abs = src->negate = false; for (int i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i) src->swizzle[i] = i; } @@ -2870,19 +2866,7 @@ nir_variable *nir_get_binding_variable(nir_shader *shader, nir_binding binding) bool nir_alu_instr_is_copy(nir_alu_instr *instr) { - - if (instr->op == nir_op_mov) { - return !instr->src[0].abs && - !instr->src[0].negate; - } else if (nir_op_is_vec(instr->op)) { - for (unsigned i = 0; i < instr->dest.dest.ssa.num_components; i++) { - if (instr->src[i].abs || instr->src[i].negate) - return false; - } - return true; - } else { - return false; - } + return (instr->op == nir_op_mov) || nir_op_is_vec(instr->op); } nir_ssa_scalar diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 81036ed..db0e894 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1182,25 +1182,6 @@ typedef struct { nir_src src; /** - * \name input modifiers - */ - /*@{*/ - /** - * For inputs interpreted as floating point, flips the sign bit. For - * inputs interpreted as integers, performs the two's complement negation. - */ - bool negate; - - /** - * Clears the sign bit for floating point values, and computes the integer - * absolute value for integers. Note that the negate modifier acts after - * the absolute value modifier, therefore if both are set then all inputs - * will become negative. - */ - bool abs; - /*@}*/ - - /** * For each input component, says which component of the register it is * chosen from. * @@ -1493,9 +1474,7 @@ typedef struct nir_op_info { uint8_t input_sizes[NIR_ALU_MAX_INPUTS]; /** - * The type of vector that each input takes. Note that negate and - * absolute value are only allowed on inputs with int or float type and - * behave differently on the two. + * The type of vector that each input takes. */ nir_alu_type input_types[NIR_ALU_MAX_INPUTS]; diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index ffbc474..2719caf 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -498,7 +498,6 @@ nir_vec_scalars(nir_builder *build, nir_ssa_scalar *comp, unsigned num_component static inline nir_ssa_def * nir_mov_alu(nir_builder *build, nir_alu_src src, unsigned num_components) { - assert(!src.abs && !src.negate); if (src.src.is_ssa && src.src.ssa->num_components == num_components) { bool any_swizzles = false; for (unsigned i = 0; i < num_components; i++) { diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 7eb2170..1c6b36c 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -229,8 +229,6 @@ clone_alu(clone_state *state, const nir_alu_instr *alu) for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) { __clone_src(state, &nalu->instr, &nalu->src[i].src, &alu->src[i].src); - nalu->src[i].negate = alu->src[i].negate; - nalu->src[i].abs = alu->src[i].abs; memcpy(nalu->src[i].swizzle, alu->src[i].swizzle, sizeof(nalu->src[i].swizzle)); } diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 4d493be..5ebecc4 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -96,9 +96,6 @@ hash_src(uint32_t hash, const nir_src *src) static uint32_t hash_alu_src(uint32_t hash, const nir_alu_src *src, unsigned num_components) { - hash = HASH(hash, src->abs); - hash = HASH(hash, src->negate); - for (unsigned i = 0; i < num_components; i++) hash = HASH(hash, src->swizzle[i]); @@ -434,10 +431,7 @@ nir_alu_srcs_negative_equal(const nir_alu_instr *alu1, } #endif - if (alu1->src[src1].abs != alu2->src[src2].abs) - return false; - - bool parity = alu1->src[src1].negate != alu2->src[src2].negate; + bool parity = false; /* Handling load_const instructions is tricky. */ @@ -521,10 +515,6 @@ bool nir_alu_srcs_equal(const nir_alu_instr *alu1, const nir_alu_instr *alu2, unsigned src1, unsigned src2) { - if (alu1->src[src1].abs != alu2->src[src2].abs || - alu1->src[src1].negate != alu2->src[src2].negate) - return false; - for (unsigned i = 0; i < nir_ssa_alu_instr_src_components(alu1, src1); i++) { if (alu1->src[src1].swizzle[i] != alu2->src[src2].swizzle[i]) return false; diff --git a/src/compiler/nir/nir_legacy.c b/src/compiler/nir/nir_legacy.c index 639fa42..f53f23b 100644 --- a/src/compiler/nir/nir_legacy.c +++ b/src/compiler/nir/nir_legacy.c @@ -100,8 +100,6 @@ chase_source_mod(nir_ssa_def **ssa, nir_op op, uint8_t *swizzle) nir_legacy_alu_src nir_legacy_chase_alu_src(const nir_alu_src *src, bool fuse_fabs) { - assert(!src->abs && "source modifiers must be ALU"); - assert(!src->negate && "source modifiers must be ALU"); assert(src->src.is_ssa && "registers lowered to intrinsics"); if (src->src.ssa->parent_instr->type == nir_instr_type_alu) { diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 9b7bdd4..d647f36 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -813,9 +813,6 @@ try_eval_const_alu(nir_const_value *dest, nir_alu_instr *alu, return false; } } - - /* We shouldn't have any source modifiers in the optimization loop. */ - assert(!alu->src[i].abs && !alu->src[i].negate); } if (bit_size == 0) diff --git a/src/compiler/nir/nir_move_vec_src_uses_to_dest.c b/src/compiler/nir/nir_move_vec_src_uses_to_dest.c index c46035c..10cc37b 100644 --- a/src/compiler/nir/nir_move_vec_src_uses_to_dest.c +++ b/src/compiler/nir/nir_move_vec_src_uses_to_dest.c @@ -90,10 +90,6 @@ move_vec_src_uses_to_dest_block(nir_block *block) if (!vec->src[i].src.is_ssa) continue; - /* We can't rewrite a source if it has modifiers */ - if (vec->src[i].abs || vec->src[i].negate) - continue; - srcs_remaining |= 1 << i; } diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index 29e2dde..eb56e5c 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -75,9 +75,6 @@ try_fold_alu(nir_builder *b, nir_alu_instr *alu) j++) { src[i][j] = load_const->value[alu->src[i].swizzle[j]]; } - - /* We shouldn't have any source modifiers in the optimization loop. */ - assert(!alu->src[i].abs && !alu->src[i].negate); } if (bit_size == 0) diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c index f62d047..5a81357 100644 --- a/src/compiler/nir/nir_opt_if.c +++ b/src/compiler/nir/nir_opt_if.c @@ -1191,8 +1191,6 @@ clone_alu_and_replace_src_defs(nir_builder *b, const nir_alu_instr *alu, for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) { nalu->src[i].src = nir_src_for_ssa(src_defs[i]); - nalu->src[i].negate = alu->src[i].negate; - nalu->src[i].abs = alu->src[i].abs; memcpy(nalu->src[i].swizzle, alu->src[i].swizzle, sizeof(nalu->src[i].swizzle)); } diff --git a/src/compiler/nir/nir_opt_offsets.c b/src/compiler/nir/nir_opt_offsets.c index 025d311..ff35958 100644 --- a/src/compiler/nir/nir_opt_offsets.c +++ b/src/compiler/nir/nir_opt_offsets.c @@ -45,9 +45,7 @@ try_extract_const_addition(nir_builder *b, nir_ssa_scalar val, opt_offsets_state nir_alu_instr *alu = nir_instr_as_alu(val.def->parent_instr); if (alu->op != nir_op_iadd || !alu->src[0].src.is_ssa || - !alu->src[1].src.is_ssa || - alu->src[0].negate || alu->src[0].abs || - alu->src[1].negate || alu->src[1].abs) + !alu->src[1].src.is_ssa) return val; nir_ssa_scalar src[2] = { diff --git a/src/compiler/nir/nir_opt_vectorize.c b/src/compiler/nir/nir_opt_vectorize.c index 56dce8e..b7b6491 100644 --- a/src/compiler/nir/nir_opt_vectorize.c +++ b/src/compiler/nir/nir_opt_vectorize.c @@ -52,8 +52,6 @@ static uint32_t hash_alu_src(uint32_t hash, const nir_alu_src *src, uint32_t num_components, uint32_t max_vec) { - assert(!src->abs && !src->negate); - /* hash whether a swizzle accesses elements beyond the maximum * vectorization factor: * For example accesses to .x and .y are considered different variables @@ -97,11 +95,6 @@ static bool alu_srcs_equal(const nir_alu_src *src1, const nir_alu_src *src2, uint32_t max_vec) { - assert(!src1->abs); - assert(!src1->negate); - assert(!src2->abs); - assert(!src2->negate); - uint32_t mask = ~(max_vec - 1); if ((src1->swizzle[0] & mask) != (src2->swizzle[0] & mask)) return false; diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 86f608f..f906aa7 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -262,8 +262,6 @@ match_value(const nir_algebraic_table *table, if (state->variables[var->variable].src.ssa != instr->src[src].src.ssa) return false; - assert(!instr->src[src].abs && !instr->src[src].negate); - for (unsigned i = 0; i < num_components; ++i) { if (state->variables[var->variable].swizzle[i] != new_swizzle[i]) return false; @@ -285,8 +283,6 @@ match_value(const nir_algebraic_table *table, state->variables_seen |= (1 << var->variable); state->variables[var->variable].src = instr->src[src].src; - state->variables[var->variable].abs = false; - state->variables[var->variable].negate = false; for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i) { if (i < num_components) @@ -470,8 +466,6 @@ construct_value(nir_builder *build, nir_alu_src val; val.src = nir_src_for_ssa(&alu->dest.dest.ssa); - val.negate = false; - val.abs = false, memcpy(val.swizzle, identity_swizzle, sizeof val.swizzle); return val; @@ -522,8 +516,6 @@ construct_value(nir_builder *build, nir_alu_src val; val.src = nir_src_for_ssa(cval); - val.negate = false; - val.abs = false, memset(val.swizzle, 0, sizeof val.swizzle); return val; diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 6a5e9ca..c0edc59 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -170,9 +170,6 @@ validate_alu_src(nir_alu_instr *instr, unsigned index, validate_state *state) { nir_alu_src *src = &instr->src[index]; - if (instr->op == nir_op_mov) - assert(!src->abs && !src->negate); - unsigned num_components = nir_src_num_components(src->src); for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) { validate_assert(state, src->swizzle[i] < NIR_MAX_VEC_COMPONENTS); diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 044d9f7..bb833a1 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -401,9 +401,6 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu) for (int i = 0; i < info->num_inputs; i++) { nir_alu_src *asrc = &alu->src[i]; - compile_assert(ctx, !asrc->abs); - compile_assert(ctx, !asrc->negate); - src[i] = ir3_get_src(ctx, &asrc->src)[asrc->swizzle[0]]; if (!src[i]) src[i] = create_immed_typed(ctx->block, 0, dst_type); @@ -438,9 +435,6 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu) unsigned chan = ffs(alu->dest.write_mask) - 1; nir_alu_src *asrc = &alu->src[i]; - compile_assert(ctx, !asrc->abs); - compile_assert(ctx, !asrc->negate); - src[i] = ir3_get_src(ctx, &asrc->src)[asrc->swizzle[chan]]; bs[i] = nir_src_bit_size(asrc->src); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c index be4c14a..5a0a60a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c @@ -232,8 +232,6 @@ get_alu_src(struct lp_build_nir_context *bld_base, nir_alu_src src, unsigned num_components) { - assert(!src.negate); - assert(!src.abs); assert(num_components >= 1); assert(num_components <= 4); diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index 862655a..e095a60 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -565,7 +565,6 @@ ntt_extract_const_src_offset(nir_src *src) if (alu->op == nir_op_iadd) { for (int i = 0; i < 2; i++) { - assert(!alu->src[i].negate && !alu->src[i].abs); nir_const_value *v = nir_src_as_const_value(alu->src[i].src); if (v != NULL) { *src = alu->src[1 - i].src; diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index 437324b..2ff7207 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -502,9 +502,6 @@ emit_alu(struct etna_compile *c, nir_alu_instr * alu) nir_alu_src *asrc = &alu->src[i]; hw_src src; - assert(!asrc->negate); - assert(!asrc->abs); - src = src_swizzle(get_src(c, &asrc->src), ALU_SWIZ(asrc)); src = src_swizzle(src, dst_swiz); @@ -717,9 +714,6 @@ insert_vec_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) nir_alu_instr *mov = nir_alu_instr_create(shader, nir_op_mov); nir_alu_src_copy(&mov->src[0], &vec->src[start_idx], mov); - assert(!vec->src[start_idx].negate); - assert(!vec->src[start_idx].abs); - mov->src[0].swizzle[0] = vec->src[start_idx].swizzle[0]; if (is_src_mod_neg(&vec->instr, start_idx)) diff --git a/src/gallium/drivers/etnaviv/etnaviv_nir_lower_source_mods.c b/src/gallium/drivers/etnaviv/etnaviv_nir_lower_source_mods.c index 702d0b4..0eae2e7 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_nir_lower_source_mods.c +++ b/src/gallium/drivers/etnaviv/etnaviv_nir_lower_source_mods.c @@ -88,9 +88,9 @@ nir_lower_to_source_mods_instr(nir_builder *b, nir_instr *instr, alu_src_consume_abs(instr, i); /* Apply modifiers from the parent source */ - if (parent->src[0].negate || is_src_mod_neg(&parent->instr, 0)) + if (is_src_mod_neg(&parent->instr, 0)) alu_src_consume_negate(instr, i); - if (parent->src[0].abs || is_src_mod_abs(&parent->instr, 0)) + if (is_src_mod_abs(&parent->instr, 0)) alu_src_consume_abs(instr, i); for (int j = 0; j < 4; ++j) { diff --git a/src/gallium/drivers/lima/ir/gp/nir.c b/src/gallium/drivers/lima/ir/gp/nir.c index 1f1451e..0088ec1 100644 --- a/src/gallium/drivers/lima/ir/gp/nir.c +++ b/src/gallium/drivers/lima/ir/gp/nir.c @@ -181,7 +181,6 @@ static bool gpir_emit_alu(gpir_block *block, nir_instr *ni) for (int i = 0; i < num_child; i++) { nir_alu_src *src = instr->src + i; - node->children_negate[i] = src->negate; gpir_node *child = gpir_node_find(block, &src->src, src->swizzle[0]); node->children[i] = child; diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 0e34464..113d36d 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -281,9 +281,6 @@ ntq_get_alu_src(struct vc4_compile *c, nir_alu_instr *instr, struct qreg r = ntq_get_src(c, instr->src[src].src, instr->src[src].swizzle[0]); - assert(!instr->src[src].abs); - assert(!instr->src[src].negate); - return r; }; diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index a7be604..45d4319 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -1399,9 +1399,6 @@ get_src(struct ntv_context *ctx, nir_src *src, nir_alu_type *atype) static SpvId get_alu_src_raw(struct ntv_context *ctx, nir_alu_instr *alu, unsigned src, nir_alu_type *atype) { - assert(!alu->src[src].negate); - assert(!alu->src[src].abs); - SpvId def = get_src(ctx, &alu->src[src].src, atype); unsigned used_channels = 0; diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 68f7359e..c8d3f57 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -647,10 +647,6 @@ fs_visitor::prepare_alu_destination_and_sources(const fs_builder &bld, nir_dest_bit_size(instr->dest.dest))); for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) { - /* We don't lower to source modifiers so they should not exist. */ - assert(!instr->src[i].abs); - assert(!instr->src[i].negate); - op[i] = get_nir_src(instr->src[i].src); op[i].type = brw_type_for_nir_type(devinfo, (nir_alu_type)(nir_op_infos[instr->op].input_types[i] | @@ -4074,11 +4070,7 @@ fs_visitor::try_rebuild_resource(const brw::fs_builder &bld, nir_ssa_def *resour if (!alu->src[0].src.is_ssa || !alu->src[1].src.is_ssa || - alu->src[0].negate || - alu->src[0].abs || alu->src[0].swizzle[0] != 0 || - alu->src[1].negate || - alu->src[1].abs || alu->src[1].swizzle[0] != 0) break; diff --git a/src/intel/compiler/brw_nir_opt_peephole_ffma.c b/src/intel/compiler/brw_nir_opt_peephole_ffma.c index 8dc59b8..c31a726 100644 --- a/src/intel/compiler/brw_nir_opt_peephole_ffma.c +++ b/src/intel/compiler/brw_nir_opt_peephole_ffma.c @@ -65,7 +65,6 @@ get_mul_for_src(nir_alu_src *src, unsigned num_components, uint8_t *swizzle, bool *negate, bool *abs) { uint8_t swizzle_tmp[NIR_MAX_VEC_COMPONENTS]; - assert(src->src.is_ssa && !src->abs && !src->negate); nir_instr *instr = src->src.ssa->parent_instr; if (instr->type != nir_instr_type_alu) diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index fb2fa8e..11fc00e 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -1089,10 +1089,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) src_reg op[4]; for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) { - /* We don't lower to source modifiers, so they shouldn't exist. */ - assert(!instr->src[i].abs); - assert(!instr->src[i].negate); - nir_alu_type src_type = (nir_alu_type) (nir_op_infos[instr->op].input_types[i] | nir_src_bit_size(instr->src[i].src)); diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 9844bc6..cfaa1cc 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -2255,9 +2255,6 @@ get_src(struct ntd_context *ctx, nir_src *src, unsigned chan, static const struct dxil_value * get_alu_src(struct ntd_context *ctx, nir_alu_instr *alu, unsigned src) { - assert(!alu->src[src].abs); - assert(!alu->src[src].negate); - unsigned chan = alu->src[src].swizzle[0]; return get_src(ctx, &alu->src[src].src, chan, nir_op_infos[alu->op].input_types[src]); diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp b/src/nouveau/codegen/nv50_ir_from_nir.cpp index 8ca211a..4de1693 100644 --- a/src/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp @@ -710,10 +710,6 @@ Converter::convert(nir_ssa_def *def) Value* Converter::getSrc(nir_alu_src *src, uint8_t component) { - if (src->abs || src->negate) { - ERROR("modifiers currently not supported on nir_alu_src\n"); - assert(false); - } return getSrc(&src->src, src->swizzle[component]); } diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 37ab72a..fbf06bb 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -1764,9 +1764,6 @@ bi_emit_load_const(bi_builder *b, nir_load_const_instr *instr) static bi_index bi_alu_src_index(bi_builder *b, nir_alu_src src, unsigned comps) { - /* we don't lower modifiers until the backend */ - assert(!(src.negate || src.abs)); - unsigned bitsize = nir_src_bit_size(src.src); /* the bi_index carries the 32-bit (word) offset separate from the -- 2.7.4