summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2015-04-17 17:58:35 +0200
committerJason Ekstrand <[email protected]>2015-08-03 09:40:49 -0700
commitb9c41affcf67f30d7f6c74c17ea34bc42756d56d (patch)
tree88a29ec234ae2beb2d7c3cc19046eb0ab74d5467 /src
parentdae6025e8efdfb759458a3243c8cd1588f485135 (diff)
i965/nir: Add utility method for comparisons
This method returns the brw_conditional_mod value used when emitting comparative ALU operations. It could be moved to brw_nir in the future to reuse it in fs_nir backend. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp39
1 files changed, 39 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 6ae387a8852..77df2842e6e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -652,6 +652,45 @@ brw_swizzle_for_nir_swizzle(uint8_t swizzle[4])
return BRW_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
}
+static enum brw_conditional_mod
+brw_conditional_for_nir_comparison(nir_op op)
+{
+ switch (op) {
+ case nir_op_flt:
+ case nir_op_ilt:
+ case nir_op_ult:
+ return BRW_CONDITIONAL_L;
+
+ case nir_op_fge:
+ case nir_op_ige:
+ case nir_op_uge:
+ return BRW_CONDITIONAL_GE;
+
+ case nir_op_feq:
+ case nir_op_ieq:
+ 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:
+ return BRW_CONDITIONAL_Z;
+
+ case nir_op_fne:
+ case nir_op_ine:
+ case nir_op_bany_fnequal2:
+ case nir_op_bany_inequal2:
+ case nir_op_bany_fnequal3:
+ case nir_op_bany_inequal3:
+ case nir_op_bany_fnequal4:
+ case nir_op_bany_inequal4:
+ return BRW_CONDITIONAL_NZ;
+
+ default:
+ unreachable("not reached: bad operation for comparison");
+ }
+}
+
void
vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
{