summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-05-26 03:16:37 +0000
committerAlyssa Rosenzweig <[email protected]>2019-05-26 03:16:37 +0000
commit659aa3dd6519f64379e91ca97fe184434fd7fdee (patch)
tree4b7e4bfa8d5b283d1b2dd73eb7992054db51b927 /src/gallium/drivers/panfrost
parent1dc593e9b9318a73b49792435776faba02562806 (diff)
panfrost/midgard: Implement fneg/fabs/fsat
Fix a regression I inadvertently caused by acking typeless movs before implementing/pushing this *whistles* Nothing to see here, move along folks. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard_compile.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index d8d37513b8b..048389dd8db 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -864,6 +864,11 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
ALU_CASE(b32any_inequal3, ibany_neq);
ALU_CASE(b32any_inequal4, ibany_neq);
+ /* Source mods will be shoved in later */
+ ALU_CASE(fabs, fmov);
+ ALU_CASE(fneg, fmov);
+ ALU_CASE(fsat, fmov);
+
/* For greater-or-equal, we lower to less-or-equal and flip the
* arguments */
@@ -928,6 +933,9 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
midgard_is_integer_out_op(op) ? midgard_outmod_int :
instr->dest.saturate ? midgard_outmod_sat : midgard_outmod_none;
+ if (instr->op == nir_op_fsat)
+ outmod = midgard_outmod_sat;
+
/* fmax(a, 0.0) can turn into a .pos modifier as an optimization */
if (instr->op == nir_op_fmax) {
@@ -977,6 +985,18 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
assert(0);
}
+ /* These were lowered to a move, so apply the corresponding mod */
+
+ if (instr->op == nir_op_fneg || instr->op == nir_op_fabs) {
+ nir_alu_src *s = nirmods[quirk_flipped_r24];
+
+ if (instr->op == nir_op_fneg)
+ s->negate = !s->negate;
+
+ if (instr->op == nir_op_fabs)
+ s->abs = !s->abs;
+ }
+
bool is_int = midgard_is_integer_op(op);
midgard_vector_alu alu = {