aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c61
-rw-r--r--src/panfrost/bifrost/bifrost_nir_algebraic.py5
2 files changed, 39 insertions, 27 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index f3f5f08f11d..1b08e7b433c 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -328,6 +328,11 @@ emit_load_const(bi_context *ctx, nir_load_const_instr *instr)
bi_emit(ctx, move);
}
+#define BI_CASE_CMP(op) \
+ case op##8: \
+ case op##16: \
+ case op##32: \
+
static enum bi_class
bi_class_for_nir_alu(nir_op op)
{
@@ -339,17 +344,19 @@ bi_class_for_nir_alu(nir_op op)
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:
+ BI_CASE_CMP(nir_op_flt)
+ BI_CASE_CMP(nir_op_fge)
+ BI_CASE_CMP(nir_op_feq)
+ BI_CASE_CMP(nir_op_fne)
+ BI_CASE_CMP(nir_op_ilt)
+ BI_CASE_CMP(nir_op_ige)
+ BI_CASE_CMP(nir_op_ieq)
+ BI_CASE_CMP(nir_op_ine)
return BI_CMP;
- case nir_op_bcsel:
+ case nir_op_b8csel:
+ case nir_op_b16csel:
+ case nir_op_b32csel:
return BI_CSEL;
case nir_op_i2i8:
@@ -408,17 +415,20 @@ static enum bi_cond
bi_cond_for_nir(nir_op op)
{
switch (op) {
- case nir_op_flt:
- case nir_op_ilt:
+ BI_CASE_CMP(nir_op_flt)
+ BI_CASE_CMP(nir_op_ilt)
return BI_COND_LT;
- case nir_op_fge:
- case nir_op_ige:
+
+ BI_CASE_CMP(nir_op_fge)
+ BI_CASE_CMP(nir_op_ige)
return BI_COND_GE;
- case nir_op_feq:
- case nir_op_ieq:
+
+ BI_CASE_CMP(nir_op_feq)
+ BI_CASE_CMP(nir_op_ieq)
return BI_COND_EQ;
- case nir_op_fne:
- case nir_op_ine:
+
+ BI_CASE_CMP(nir_op_fne)
+ BI_CASE_CMP(nir_op_ine)
return BI_COND_NE;
default:
unreachable("Invalid compare");
@@ -523,14 +533,14 @@ 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:
+ BI_CASE_CMP(nir_op_flt)
+ BI_CASE_CMP(nir_op_ilt)
+ BI_CASE_CMP(nir_op_fge)
+ BI_CASE_CMP(nir_op_ige)
+ BI_CASE_CMP(nir_op_feq)
+ BI_CASE_CMP(nir_op_ieq)
+ BI_CASE_CMP(nir_op_fne)
+ BI_CASE_CMP(nir_op_ine)
alu.op.compare = bi_cond_for_nir(instr->op);
break;
default:
@@ -835,6 +845,7 @@ bi_optimize_nir(nir_shader *nir)
} while (progress);
NIR_PASS(progress, nir, nir_opt_algebraic_late);
+ NIR_PASS(progress, nir, nir_lower_bool_to_int32);
NIR_PASS(progress, nir, bifrost_nir_lower_algebraic_late);
NIR_PASS(progress, nir, nir_lower_alu_to_scalar, NULL, NULL);
NIR_PASS(progress, nir, nir_lower_load_const_to_scalar);
diff --git a/src/panfrost/bifrost/bifrost_nir_algebraic.py b/src/panfrost/bifrost/bifrost_nir_algebraic.py
index 1fb49b1c690..ca89ce29f37 100644
--- a/src/panfrost/bifrost/bifrost_nir_algebraic.py
+++ b/src/panfrost/bifrost/bifrost_nir_algebraic.py
@@ -38,8 +38,9 @@ algebraic_late = [
(('ineg', a), ('isub', 0, a)),
]
-for sz in ('16', '32', '64'):
- algebraic_late += [(('b2f' + sz, 'a@1'), ('bcsel', a, 1.0, 0.0))]
+for isz in ('8', '16', '32'):
+ for osz in ('16', '32', '64'):
+ algebraic_late += [(('b2f' + osz, 'a@' + isz), ('b' + isz + 'csel', a, 1.0, 0.0))]
# Midgard is able to type convert down by only one "step" per instruction; if
# NIR wants more than one step, we need to break up into multiple instructions