summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2015-06-17 00:55:24 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:49 -0700
commit8be4b876c90192c3a5e6fcc9b526f43a3f7bfc11 (patch)
treeb096cf0c9488ff4edc3666ba1f11946067957aa2
parent84d4a9dc2ca3d98f19cc9125a5ff1ac1225f360d (diff)
i965/nir/vec4: Implement equality ops on vectors
Adds NIR ALU operations: * nir_op_ball_fequal2 * nir_op_ball_iequal2 * nir_op_ball_fequal3 * nir_op_ball_iequal3 * nir_op_ball_fequal4 * nir_op_ball_iequal4 Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 34a9f4fc46d..4e85b94723c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -922,6 +922,39 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
brw_conditional_for_nir_comparison(instr->op)));
break;
+ case nir_op_ball_fequal2:
+ case nir_op_ball_iequal2:
+ case nir_op_ball_fequal3:
+ case nir_op_ball_iequal3:
+ case nir_op_ball_fequal4:
+ case nir_op_ball_iequal4: {
+ dst_reg tmp = dst_reg(this, glsl_type::bool_type);
+
+ switch (instr->op) {
+ case nir_op_ball_fequal2:
+ case nir_op_ball_iequal2:
+ tmp.writemask = WRITEMASK_XY;
+ break;
+ case nir_op_ball_fequal3:
+ case nir_op_ball_iequal3:
+ tmp.writemask = WRITEMASK_XYZ;
+ break;
+ case nir_op_ball_fequal4:
+ case nir_op_ball_iequal4:
+ tmp.writemask = WRITEMASK_XYZW;
+ break;
+ default:
+ unreachable("not reached");
+ }
+
+ emit(CMP(tmp, op[0], op[1],
+ brw_conditional_for_nir_comparison(instr->op)));
+ emit(MOV(dst, src_reg(0)));
+ inst = emit(MOV(dst, src_reg(~0)));
+ inst->predicate = BRW_PREDICATE_ALIGN16_ALL4H;
+ break;
+ }
+
default:
unreachable("Unimplemented ALU operation");
}