diff options
author | Ian Romanick <[email protected]> | 2015-05-08 12:55:00 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-10-30 09:27:09 -0700 |
commit | 6403efbe7458d05cf117adb41c8a152ed6e28bdd (patch) | |
tree | 74c392361a08b0f04895ca667d828ac7083ad304 /src/compiler/glsl/ast_to_hir.cpp | |
parent | 34f7e761bc61d3086c1e4e42285c31678b256107 (diff) |
glsl: Remove ir_binop_greater and ir_binop_lequal expressions
NIR does not have these instructions. TGSI and Mesa IR both implement
them using < and >=, repsectively. Removing them deletes a bunch of
code and means I don't have to add code to the SPIR-V generator for
them.
v2: Rebase on 2+ years of change... and fix a major bug added in the
rebase.
text data bss dec hex filename
8255291 268856 294072 8818219 868e2b 32-bit i965_dri.so before
8254235 268856 294072 8817163 868a0b 32-bit i965_dri.so after
7815339 345592 420592 8581523 82f193 64-bit i965_dri.so before
7813995 345560 420592 8580147 82ec33 64-bit i965_dri.so after
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 6090ee92573..441404f86d3 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -1337,8 +1337,8 @@ ast_expression::do_hir(exec_list *instructions, ir_binop_lshift, ir_binop_rshift, ir_binop_less, - ir_binop_greater, - ir_binop_lequal, + ir_binop_less, /* This is correct. See the ast_greater case below. */ + ir_binop_gequal, /* This is correct. See the ast_lequal case below. */ ir_binop_gequal, ir_binop_all_equal, ir_binop_any_nequal, @@ -1487,6 +1487,15 @@ ast_expression::do_hir(exec_list *instructions, assert(type->is_error() || (type->is_boolean() && type->is_scalar())); + /* Like NIR, GLSL IR does not have opcodes for > or <=. Instead, swap + * the arguments and use < or >=. + */ + if (this->oper == ast_greater || this->oper == ast_lequal) { + ir_rvalue *const tmp = op[0]; + op[0] = op[1]; + op[1] = tmp; + } + result = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); error_emitted = type->is_error(); |