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

Author: Emma Anholt <[email protected]>
Date:   Mon Mar 28 15:57:32 2022 -0700

glsl: Delete unused EmitNoPow path.

This was last used with i915c, now lower_fpow covers this class of
lowering.

Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15623>

---

 src/compiler/glsl/ir_optimization.h      |  1 -
 src/compiler/glsl/lower_instructions.cpp | 27 ---------------------------
 src/compiler/glsl/opt_algebraic.cpp      |  2 +-
 src/mesa/main/consts_exts.h              |  1 -
 src/mesa/state_tracker/st_glsl_to_ir.cpp |  1 -
 5 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/src/compiler/glsl/ir_optimization.h 
b/src/compiler/glsl/ir_optimization.h
index ba8b1c485e5..b883c12bb18 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -37,7 +37,6 @@ struct gl_shader_program;
 #define SUB_TO_ADD_NEG     0x01
 #define FDIV_TO_MUL_RCP    0x02
 #define EXP_TO_EXP2        0x04
-#define POW_TO_EXP2        0x08
 #define LOG_TO_LOG2        0x10
 #define MOD_TO_FLOOR       0x20
 #define INT_DIV_TO_MUL_RCP 0x40
diff --git a/src/compiler/glsl/lower_instructions.cpp 
b/src/compiler/glsl/lower_instructions.cpp
index e69a6fc942f..92068686025 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -34,7 +34,6 @@
  * - DIV_TO_MUL_RCP
  * - INT_DIV_TO_MUL_RCP
  * - EXP_TO_EXP2
- * - POW_TO_EXP2
  * - LOG_TO_LOG2
  * - MOD_TO_FLOOR
  * - LDEXP_TO_ARITH
@@ -75,11 +74,6 @@
  * do have base 2 versions, so this pass converts exp and log to exp2
  * and log2 operations.
  *
- * POW_TO_EXP2:
- * -----------
- * Many older GPUs don't have an x**y instruction.  For these GPUs, convert
- * x**y to 2**(y * log2(x)).
- *
  * MOD_TO_FLOOR:
  * -------------
  * Breaks an ir_binop_mod expression down to (op0 - op1 * floor(op0 / op1))
@@ -146,7 +140,6 @@ private:
    void int_div_to_mul_rcp(ir_expression *);
    void mod_to_floor(ir_expression *);
    void exp_to_exp2(ir_expression *);
-   void pow_to_exp2(ir_expression *);
    void log_to_log2(ir_expression *);
    void ldexp_to_arith(ir_expression *);
    void dldexp_to_arith(ir_expression *);
@@ -288,21 +281,6 @@ lower_instructions_visitor::exp_to_exp2(ir_expression *ir)
    this->progress = true;
 }
 
-void
-lower_instructions_visitor::pow_to_exp2(ir_expression *ir)
-{
-   ir_expression *const log2_x =
-      new(ir) ir_expression(ir_unop_log2, ir->operands[0]->type,
-                           ir->operands[0]);
-
-   ir->operation = ir_unop_exp2;
-   ir->init_num_operands();
-   ir->operands[0] = new(ir) ir_expression(ir_binop_mul, ir->operands[1]->type,
-                                          ir->operands[1], log2_x);
-   ir->operands[1] = NULL;
-   this->progress = true;
-}
-
 void
 lower_instructions_visitor::log_to_log2(ir_expression *ir)
 {
@@ -1793,11 +1771,6 @@ lower_instructions_visitor::visit_leave(ir_expression 
*ir)
         mod_to_floor(ir);
       break;
 
-   case ir_binop_pow:
-      if (lowering(POW_TO_EXP2))
-        pow_to_exp2(ir);
-      break;
-
    case ir_binop_ldexp:
       if (lowering(LDEXP_TO_ARITH) && ir->type->is_float())
          ldexp_to_arith(ir);
diff --git a/src/compiler/glsl/opt_algebraic.cpp 
b/src/compiler/glsl/opt_algebraic.cpp
index 0749759f543..5dc602a447a 100644
--- a/src/compiler/glsl/opt_algebraic.cpp
+++ b/src/compiler/glsl/opt_algebraic.cpp
@@ -398,7 +398,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
          return op_expr[0]->operands[0];
       }
 
-      if (!options->EmitNoPow && op_expr[0]->operation == ir_binop_mul) {
+      if (op_expr[0]->operation == ir_binop_mul) {
          for (int log2_pos = 0; log2_pos < 2; log2_pos++) {
             ir_expression *log2_expr =
                op_expr[0]->operands[log2_pos]->as_expression();
diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h
index 5fa0f7e15ee..3143ec75c51 100644
--- a/src/mesa/main/consts_exts.h
+++ b/src/mesa/main/consts_exts.h
@@ -312,7 +312,6 @@ struct gl_shader_compiler_options
    GLboolean EmitNoLoops;
    GLboolean EmitNoCont;                  /**< Emit CONT opcode? */
    GLboolean EmitNoMainReturn;            /**< Emit CONT/RET opcodes? */
-   GLboolean EmitNoPow;                   /**< Emit POW opcodes? */
    GLboolean EmitNoSat;                   /**< Emit SAT opcodes? */
    GLboolean LowerCombinedClipCullDistance; /** Lower gl_ClipDistance and
                                               * gl_CullDistance together from
diff --git a/src/mesa/state_tracker/st_glsl_to_ir.cpp 
b/src/mesa/state_tracker/st_glsl_to_ir.cpp
index 1c2a2ed6f59..28c6de56de8 100644
--- a/src/mesa/state_tracker/st_glsl_to_ir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_ir.cpp
@@ -141,7 +141,6 @@ st_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
                          CARRY_TO_ARITH |
                          BORROW_TO_ARITH |
                          (have_dround ? 0 : DOPS_TO_DFRAC) |
-                         (options->EmitNoPow ? POW_TO_EXP2 : 0) |
                          (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0) 
|
                          (options->EmitNoSat ? SAT_TO_CLAMP : 0) |
                          (ctx->Const.ForceGLSLAbsSqrt ? SQRT_TO_ABS_SQRT : 0) |

Reply via email to