summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-04-12 17:30:25 -0700
committerIan Romanick <[email protected]>2016-05-10 09:22:18 -0700
commit15e6a1a3be0df32aa3bbeaaf9ac8afac17b66d5a (patch)
tree6c6956c64d6a0575caec9967030ba1e9ffa511f6
parente46ac18ebec099d88a5c2c650ba09657b364ec4e (diff)
ir_to_mesa: Do not emit OPCODE_SLE or OPCODE_SGT
Nothing that consumes the output of this backend consumes them navtively. This is the way i915 has implemented these instructions since it began consuming GLSL. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/mesa/program/ir_to_mesa.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 35a68562001..c5b67ad706a 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1067,10 +1067,20 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
emit(ir, OPCODE_SLT, result_dst, op[0], op[1]);
break;
case ir_binop_greater:
- emit(ir, OPCODE_SGT, result_dst, op[0], op[1]);
+ /* Negating the operands (as opposed to switching the order of the
+ * operands) produces the correct result when both are +/-Inf.
+ */
+ op[0].negate = ~op[0].negate;
+ op[1].negate = ~op[1].negate;
+ emit(ir, OPCODE_SLT, result_dst, op[0], op[1]);
break;
case ir_binop_lequal:
- emit(ir, OPCODE_SLE, result_dst, op[0], op[1]);
+ /* Negating the operands (as opposed to switching the order of the
+ * operands) produces the correct result when both are +/-Inf.
+ */
+ op[0].negate = ~op[0].negate;
+ op[1].negate = ~op[1].negate;
+ emit(ir, OPCODE_SGE, result_dst, op[0], op[1]);
break;
case ir_binop_gequal:
emit(ir, OPCODE_SGE, result_dst, op[0], op[1]);