diff --git a/src/compiler/glsl/lower_instructions.cpp b/src/compiler/glsl/lower_instructions.cpp index 16d691ea595..b657f5a4289 100644 --- a/src/compiler/glsl/lower_instructions.cpp +++ b/src/compiler/glsl/lower_instructions.cpp @@ -89,8 +89,6 @@ private: void dldexp_to_arith(ir_expression *); void dfrexp_sig_to_arith(ir_expression *); void dfrexp_exp_to_arith(ir_expression *); - void carry_to_arith(ir_expression *); - void borrow_to_arith(ir_expression *); void double_dot_to_fma(ir_expression *); void double_lrp(ir_expression *); void dceil_to_dfrac(ir_expression *); @@ -580,44 +578,6 @@ lower_instructions_visitor::dfrexp_exp_to_arith(ir_expression *ir) this->progress = true; } -void -lower_instructions_visitor::carry_to_arith(ir_expression *ir) -{ - /* Translates - * ir_binop_carry x y - * into - * sum = ir_binop_add x y - * bcarry = ir_binop_less sum x - * carry = ir_unop_b2i bcarry - */ - - ir_rvalue *x_clone = ir->operands[0]->clone(ir, NULL); - ir->operation = ir_unop_i2u; - ir->init_num_operands(); - ir->operands[0] = b2i(less(add(ir->operands[0], ir->operands[1]), x_clone)); - ir->operands[1] = NULL; - - this->progress = true; -} - -void -lower_instructions_visitor::borrow_to_arith(ir_expression *ir) -{ - /* Translates - * ir_binop_borrow x y - * into - * bcarry = ir_binop_less x y - * carry = ir_unop_b2i bcarry - */ - - ir->operation = ir_unop_i2u; - ir->init_num_operands(); - ir->operands[0] = b2i(less(ir->operands[0], ir->operands[1])); - ir->operands[1] = NULL; - - this->progress = true; -} - void lower_instructions_visitor::double_dot_to_fma(ir_expression *ir) { @@ -1467,14 +1427,6 @@ lower_instructions_visitor::visit_leave(ir_expression *ir) dfrexp_sig_to_arith(ir); break; - case ir_binop_carry: - carry_to_arith(ir); - break; - - case ir_binop_borrow: - borrow_to_arith(ir); - break; - case ir_unop_trunc: if (lowering(DOPS_TO_DFRAC) && ir->type->is_double()) dtrunc_to_dfrac(ir); diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index 479bdf891c9..ba1dbc03a80 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -3656,6 +3656,8 @@ ntt_fix_nir_options(struct pipe_screen *screen, struct nir_shader *s, !options->lower_flrp64 || !options->lower_fmod || !options->lower_rotate || + !options->lower_uadd_carry || + !options->lower_usub_borrow || !options->lower_uadd_sat || !options->lower_usub_sat || !options->lower_uniforms_to_ubo || @@ -3674,6 +3676,8 @@ ntt_fix_nir_options(struct pipe_screen *screen, struct nir_shader *s, new_options->lower_flrp64 = true; new_options->lower_fmod = true; new_options->lower_rotate = true; + new_options->lower_uadd_carry = true; + new_options->lower_usub_borrow = true; new_options->lower_uadd_sat = true; new_options->lower_usub_sat = true; new_options->lower_uniforms_to_ubo = true; @@ -4030,6 +4034,8 @@ static const nir_shader_compiler_options nir_to_tgsi_compiler_options = { .lower_fmod = true, .lower_rotate = true, .lower_uniforms_to_ubo = true, + .lower_uadd_carry = true, + .lower_usub_borrow = true, .lower_uadd_sat = true, .lower_usub_sat = true, .lower_vector_cmp = true, diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index b51312a8348..26b30f60b98 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -42,6 +42,7 @@ etna_compiler_create(const char *renderer, const struct etna_specs *specs) .fuse_ffma32 = true, .fuse_ffma64 = true, .lower_uadd_carry = true, + .lower_usub_borrow = true, .lower_mul_high = true, .lower_bitops = true, .lower_all_io_to_temps = true, diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 51b045afbd2..d25708ed209 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -1334,6 +1334,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, .lower_isign = true, .lower_fsign = true, .lower_fmod = true, + .lower_uadd_carry = true, + .lower_usub_borrow = true, .lower_extract_byte = true, .lower_extract_word = true, .lower_insert_byte = true, diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index c59c4d5ae63..8e1299692da 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -338,6 +338,7 @@ zink_screen_init_compiler(struct zink_screen *screen) .lower_mul_high = true, .lower_rotate = true, .lower_uadd_carry = true, + .lower_usub_borrow = true, .lower_uadd_sat = true, .lower_usub_sat = true, .lower_vector_cmp = true, diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 8f46a526fa6..ed3cb0613e4 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -115,6 +115,7 @@ nir_options = { .lower_usub_sat = true, .lower_iadd_sat = true, .lower_uadd_carry = true, + .lower_usub_borrow = true, .lower_mul_high = true, .lower_rotate = true, .lower_pack_half_2x16 = true, diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h index 5d1f3fcb1d5..bced01dde9c 100644 --- a/src/panfrost/midgard/midgard_compile.h +++ b/src/panfrost/midgard/midgard_compile.h @@ -55,6 +55,8 @@ static const nir_shader_compiler_options midgard_nir_options = { .lower_find_lsb = true, .lower_ifind_msb = true, .lower_fdph = true, + .lower_uadd_carry = true, + .lower_usub_borrow = true, /* TODO: We have native ops to help here, which we'll want to look into * eventually */