aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/bifrost_compile.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-06-02 19:29:25 -0400
committerMarge Bot <[email protected]>2020-06-03 17:35:10 +0000
commit1b09c6993dc1b1113ff508d158504af90607aa18 (patch)
tree3043962d0dfc4708999d1a5166e687df16acaa80 /src/panfrost/bifrost/bifrost_compile.c
parent8a4efe2d730cc61d42eefffd01ee0ae4f853ec0c (diff)
pan/bi: Passthrough second argument of F32_TO_F16
At the NIR level this is a second vector source of the first (only) argument; at the BIR level this is a pair of scalars. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5307>
Diffstat (limited to 'src/panfrost/bifrost/bifrost_compile.c')
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index cb6595a9de8..96ceb78cf07 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -834,6 +834,26 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
case nir_op_ixor:
alu.op.bitwise = BI_BITWISE_XOR;
break;
+
+ case nir_op_f2f16:
+ case nir_op_i2i16:
+ case nir_op_u2u16: {
+ if (nir_src_bit_size(instr->src[0].src) != 32)
+ break;
+
+ /* Should have been const folded */
+ assert(!nir_src_is_const(instr->src[0].src));
+
+ alu.src_types[1] = alu.src_types[0];
+ alu.src[1] = alu.src[0];
+
+ unsigned last = nir_dest_num_components(instr->dest.dest) - 1;
+ assert(last <= 1);
+
+ alu.swizzle[1][0] = instr->src[0].swizzle[last];
+ break;
+ }
+
default:
break;
}