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 <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Ian Romanick
2015-05-08 12:55:00 -07:00
parent 34f7e761bc
commit 6403efbe74
14 changed files with 39 additions and 116 deletions
+16 -7
View File
@@ -744,7 +744,8 @@ private:
ir_expression_operation opcode,
const glsl_type *return_type,
const glsl_type *param0_type,
const glsl_type *param1_type);
const glsl_type *param1_type,
bool swap_operands = false);
#define B0(X) ir_function_signature *_##X();
#define B1(X) ir_function_signature *_##X(const glsl_type *);
@@ -3634,12 +3635,18 @@ builtin_builder::binop(builtin_available_predicate avail,
ir_expression_operation opcode,
const glsl_type *return_type,
const glsl_type *param0_type,
const glsl_type *param1_type)
const glsl_type *param1_type,
bool swap_operands)
{
ir_variable *x = in_var(param0_type, "x");
ir_variable *y = in_var(param1_type, "y");
MAKE_SIG(return_type, avail, 2, x, y);
body.emit(ret(expr(opcode, x, y)));
if (swap_operands)
body.emit(ret(expr(opcode, y, x)));
else
body.emit(ret(expr(opcode, x, y)));
return sig;
}
@@ -4972,16 +4979,18 @@ ir_function_signature *
builtin_builder::_lessThanEqual(builtin_available_predicate avail,
const glsl_type *type)
{
return binop(avail, ir_binop_lequal,
glsl_type::bvec(type->vector_elements), type, type);
return binop(avail, ir_binop_gequal,
glsl_type::bvec(type->vector_elements), type, type,
true);
}
ir_function_signature *
builtin_builder::_greaterThan(builtin_available_predicate avail,
const glsl_type *type)
{
return binop(avail, ir_binop_greater,
glsl_type::bvec(type->vector_elements), type, type);
return binop(avail, ir_binop_less,
glsl_type::bvec(type->vector_elements), type, type,
true);
}
ir_function_signature *