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

Author: Timothy Arceri <[email protected]>
Date:   Mon Oct 17 21:36:41 2022 +1100

glsl: always do {CARRY,BORROW}_TO_ARITH lowering

The only caller always sets these so here we just remove the
option to disable it.

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19112>

---

 src/compiler/glsl/ir_optimization.h      |  2 --
 src/compiler/glsl/lower_instructions.cpp | 23 ++++-------------------
 src/mesa/state_tracker/st_glsl_to_ir.cpp |  2 --
 3 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/src/compiler/glsl/ir_optimization.h 
b/src/compiler/glsl/ir_optimization.h
index 9a050418962..feb55936e58 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -35,8 +35,6 @@ struct gl_shader_program;
 
 /* Operations for lower_instructions() */
 #define LDEXP_TO_ARITH     0x80
-#define CARRY_TO_ARITH     0x100
-#define BORROW_TO_ARITH    0x200
 #define DOPS_TO_DFRAC      0x800
 #define DFREXP_DLDEXP_TO_ARITH    0x1000
 #define BIT_COUNT_TO_MATH         0x02000
diff --git a/src/compiler/glsl/lower_instructions.cpp 
b/src/compiler/glsl/lower_instructions.cpp
index 1a9f7482812..15087191572 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -31,8 +31,6 @@
  *
  * Currently supported transformations:
  * - LDEXP_TO_ARITH
- * - CARRY_TO_ARITH
- * - BORROW_TO_ARITH
  * - DOPS_TO_DFRAC
  *
  * LDEXP_TO_ARITH:
@@ -44,14 +42,6 @@
  * Converts ir_binop_ldexp, ir_unop_frexp_sig, and ir_unop_frexp_exp to
  * arithmetic and bit ops for double arguments.
  *
- * CARRY_TO_ARITH:
- * ---------------
- * Converts ir_carry into (x + y) < x.
- *
- * BORROW_TO_ARITH:
- * ----------------
- * Converts ir_borrow into (x < y).
- *
  * DOPS_TO_DFRAC:
  * --------------
  * Converts double trunc, ceil, floor, round to fract
@@ -1259,11 +1249,8 @@ 
lower_instructions_visitor::find_msb_to_float_cast(ir_expression *ir)
 ir_expression *
 lower_instructions_visitor::_carry(operand a, operand b)
 {
-   if (lowering(CARRY_TO_ARITH))
-      return i2u(b2i(less(add(a, b),
-                          a.val->clone(ralloc_parent(a.val), NULL))));
-   else
-      return carry(a, b);
+   return i2u(b2i(less(add(a, b),
+                       a.val->clone(ralloc_parent(a.val), NULL))));
 }
 
 void
@@ -1449,13 +1436,11 @@ lower_instructions_visitor::visit_leave(ir_expression 
*ir)
       break;
 
    case ir_binop_carry:
-      if (lowering(CARRY_TO_ARITH))
-         carry_to_arith(ir);
+      carry_to_arith(ir);
       break;
 
    case ir_binop_borrow:
-      if (lowering(BORROW_TO_ARITH))
-         borrow_to_arith(ir);
+      borrow_to_arith(ir);
       break;
 
    case ir_unop_trunc:
diff --git a/src/mesa/state_tracker/st_glsl_to_ir.cpp 
b/src/mesa/state_tracker/st_glsl_to_ir.cpp
index 2d27c1f7417..3f81880f457 100644
--- a/src/mesa/state_tracker/st_glsl_to_ir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_ir.cpp
@@ -86,8 +86,6 @@ link_shader(struct gl_context *ctx, struct gl_shader_program 
*prog)
       lower_instructions(ir,
                          (have_ldexp ? 0 : LDEXP_TO_ARITH) |
                          (have_dfrexp ? 0 : DFREXP_DLDEXP_TO_ARITH) |
-                         CARRY_TO_ARITH |
-                         BORROW_TO_ARITH |
                          (have_dround ? 0 : DOPS_TO_DFRAC) |
                          (ctx->Const.ForceGLSLAbsSqrt ? SQRT_TO_ABS_SQRT : 0) |
                          /* Assume that if ARB_gpu_shader5 is not supported

Reply via email to