Pretty straightforward for the moment. Ideally these would be fused into
csel/branches but that will come a bit later.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>
case nir_op_isub:
return BI_ISUB;
+ case nir_op_flt:
+ case nir_op_fge:
+ case nir_op_feq:
+ case nir_op_fne:
+ case nir_op_ilt:
+ case nir_op_ige:
+ case nir_op_ieq:
+ case nir_op_ine:
+ return BI_CMP;
+
case nir_op_bcsel:
return BI_CSEL;
}
}
+static enum bi_cond
+bi_cond_for_nir(nir_op op)
+{
+ switch (op) {
+ case nir_op_flt:
+ case nir_op_ilt:
+ return BI_COND_LT;
+ case nir_op_fge:
+ case nir_op_ige:
+ return BI_COND_GE;
+ case nir_op_feq:
+ case nir_op_ieq:
+ return BI_COND_EQ;
+ case nir_op_fne:
+ case nir_op_ine:
+ return BI_COND_NE;
+ default:
+ unreachable("Invalid compare");
+ }
+}
+
static void
emit_alu(bi_context *ctx, nir_alu_instr *instr)
{
case nir_op_fcos:
alu.op.special = BI_SPECIAL_FCOS;
break;
+ case nir_op_flt:
+ case nir_op_ilt:
+ case nir_op_fge:
+ case nir_op_ige:
+ case nir_op_feq:
+ case nir_op_ieq:
+ case nir_op_fne:
+ case nir_op_ine:
+ alu.op.compare = bi_cond_for_nir(instr->op);
+ break;
default:
break;
}