glsl: drop sub to add neg lowering in GLSL IR
NIR opt algebraic does this for us so no need to have it implemented here also. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19112>
This commit is contained in:

committed by
Marge Bot

parent
a31c547206
commit
9f14c5dae2
@@ -2381,8 +2381,6 @@ do_common_optimization(exec_list *ir, bool linked,
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
OPT(lower_instructions, ir, SUB_TO_ADD_NEG);
|
||||
|
||||
if (linked) {
|
||||
OPT(do_function_inlining, ir);
|
||||
OPT(do_dead_functions, ir);
|
||||
|
@@ -34,7 +34,6 @@ struct gl_linked_shader;
|
||||
struct gl_shader_program;
|
||||
|
||||
/* Operations for lower_instructions() */
|
||||
#define SUB_TO_ADD_NEG 0x01
|
||||
#define LDEXP_TO_ARITH 0x80
|
||||
#define CARRY_TO_ARITH 0x100
|
||||
#define BORROW_TO_ARITH 0x200
|
||||
|
@@ -30,22 +30,11 @@
|
||||
* rather than in each driver backend.
|
||||
*
|
||||
* Currently supported transformations:
|
||||
* - SUB_TO_ADD_NEG
|
||||
* - LDEXP_TO_ARITH
|
||||
* - CARRY_TO_ARITH
|
||||
* - BORROW_TO_ARITH
|
||||
* - DOPS_TO_DFRAC
|
||||
*
|
||||
* SUB_TO_ADD_NEG:
|
||||
* ---------------
|
||||
* Breaks an ir_binop_sub expression down to add(op0, neg(op1))
|
||||
*
|
||||
* This simplifies expression reassociation, and for many backends
|
||||
* there is no subtract operation separate from adding the negation.
|
||||
* For backends with native subtract operations, they will probably
|
||||
* want to recognize add(op0, neg(op1)) or the other way around to
|
||||
* produce a subtract anyway.
|
||||
*
|
||||
* LDEXP_TO_ARITH:
|
||||
* -------------
|
||||
* Converts ir_binop_ldexp to arithmetic and bit operations for float sources.
|
||||
@@ -93,7 +82,6 @@ public:
|
||||
private:
|
||||
unsigned lower; /** Bitfield of which operations to lower */
|
||||
|
||||
void sub_to_add_neg(ir_expression *);
|
||||
void ldexp_to_arith(ir_expression *);
|
||||
void dldexp_to_arith(ir_expression *);
|
||||
void dfrexp_sig_to_arith(ir_expression *);
|
||||
@@ -140,16 +128,6 @@ lower_instructions(exec_list *instructions, unsigned what_to_lower)
|
||||
return v.progress;
|
||||
}
|
||||
|
||||
void
|
||||
lower_instructions_visitor::sub_to_add_neg(ir_expression *ir)
|
||||
{
|
||||
ir->operation = ir_binop_add;
|
||||
ir->init_num_operands();
|
||||
ir->operands[1] = new(ir) ir_expression(ir_unop_neg, ir->operands[1]->type,
|
||||
ir->operands[1], NULL);
|
||||
this->progress = true;
|
||||
}
|
||||
|
||||
void
|
||||
lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
|
||||
{
|
||||
@@ -1452,10 +1430,6 @@ lower_instructions_visitor::visit_leave(ir_expression *ir)
|
||||
if (ir->operands[0]->type->is_double())
|
||||
double_lrp(ir);
|
||||
break;
|
||||
case ir_binop_sub:
|
||||
if (lowering(SUB_TO_ADD_NEG))
|
||||
sub_to_add_neg(ir);
|
||||
break;
|
||||
|
||||
case ir_binop_ldexp:
|
||||
if (lowering(LDEXP_TO_ARITH) && ir->type->is_float())
|
||||
|
@@ -1318,7 +1318,7 @@ TESTS = [
|
||||
color *= borrow;
|
||||
}
|
||||
""",
|
||||
r'expression uint \+ \(var_ref x\) \(expression uint neg'),
|
||||
r'expression uint \- \(var_ref x\) \(var_ref y'),
|
||||
Test("imulExtended",
|
||||
"""
|
||||
#version 310 es
|
||||
|
@@ -21,7 +21,7 @@ traces:
|
||||
checksum: c377f21f7bfaca0c04983612e7c9a7bb
|
||||
gputest/pixmark-piano-v2.trace:
|
||||
gl-virgl:
|
||||
checksum: 495ae47d50672d095854765bdb2eedc5
|
||||
checksum: b284da2f0666e1b5fcdecbc3ab8e4270
|
||||
gputest/triangle-v2.trace:
|
||||
gl-virgl:
|
||||
checksum: 5f694874b15bcd7a3689b387c143590b
|
||||
@@ -30,7 +30,7 @@ traces:
|
||||
checksum: 32e8b627a33ad08d416dfdb804920371
|
||||
0ad/0ad-v2.trace:
|
||||
gl-virgl:
|
||||
checksum: 78007615359981f7035f26c5b7759229
|
||||
checksum: bf22fd7c3fc8baa7b0e9345728626d5f
|
||||
glmark2/buffer:update-fraction=0.5:update-dispersion=0.9:columns=200:update-method=map:interleave=false-v2.trace:
|
||||
gl-virgl:
|
||||
checksum: 040232e01e394a967dc3320bb9252870
|
||||
|
@@ -58,17 +58,17 @@ traces:
|
||||
checksum: f53ac20e17da91c0359c31f2fa3f401e
|
||||
0ad/0ad-v2.trace:
|
||||
gl-intel-apl:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
gl-intel-glk:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
gl-intel-amly:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
gl-intel-kbl:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
gl-intel-whl:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
gl-intel-cml:
|
||||
checksum: 45739401f068971e6e1052f10afe9f99
|
||||
checksum: e67b7a93bac02e41de0326419ee17a3e
|
||||
pathfinder/demo-v2.trace:
|
||||
gl-intel-apl:
|
||||
checksum: d9b33f0a2efe17c21b7933242afd9ec7
|
||||
@@ -198,17 +198,17 @@ traces:
|
||||
checksum: 29a7734de59f3745158596942d0fb2fe
|
||||
glmark2/bump:bump-render=height-v2.trace:
|
||||
gl-intel-apl:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
gl-intel-glk:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
gl-intel-amly:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
gl-intel-kbl:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
gl-intel-whl:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
gl-intel-cml:
|
||||
checksum: e299189c84a7005726554f7ca74611eb
|
||||
checksum: cefbfd68f02a1b776f2d314789c859f1
|
||||
glmark2/bump:bump-render=high-poly-v2.trace:
|
||||
gl-intel-apl:
|
||||
checksum: a6e89335a4443a80eaf7b1ae75575cac
|
||||
@@ -549,17 +549,17 @@ traces:
|
||||
checksum: 15d736a49c5457bdcf0abcfb9eb07890
|
||||
godot/Material Testers.x86_64_2020.04.08_13.38_frame799.rdc:
|
||||
gl-intel-apl:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gl-intel-glk:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gl-intel-amly:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gl-intel-kbl:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gl-intel-whl:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gl-intel-cml:
|
||||
checksum: ba5302821a4a4024ade9b98a191e80cc
|
||||
checksum: dbe1de4e2e812413f173ea6c423117ff
|
||||
gputest/pixmark-julia-fp32-v2.trace:
|
||||
gl-intel-apl:
|
||||
checksum: a5ec72a5da355dfcd689411f89164f0c
|
||||
|
Reference in New Issue
Block a user