aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/bi_pack.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-27 19:06:28 -0400
committerMarge Bot <[email protected]>2020-03-31 01:12:26 +0000
commit57a8e6e8d0e52f7be6b187bb4ac5112341515f91 (patch)
treeb398645335eef367ef0d894e83b65fcca61669c9 /src/panfrost/bifrost/bi_pack.c
parent499e97b5196632de4a2c4e461e849df2897ae14b (diff)
pan/bi: Handle standard FMA conversions
These are plain old 1-sources so they're easy to start with. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
Diffstat (limited to 'src/panfrost/bifrost/bi_pack.c')
-rw-r--r--src/panfrost/bifrost/bi_pack.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 83f27be6a76..cac1ef5f31f 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -609,9 +609,11 @@ bi_pack_fma_convert(bi_instruction *ins, struct bi_registers *regs)
{
nir_alu_type from_base = nir_alu_type_get_base_type(ins->src_types[0]);
unsigned from_size = nir_alu_type_get_type_size(ins->src_types[0]);
+ bool from_unsigned = from_base == nir_type_uint;
nir_alu_type to_base = nir_alu_type_get_base_type(ins->dest_type);
unsigned to_size = nir_alu_type_get_type_size(ins->dest_type);
+ bool to_unsigned = to_base == nir_type_uint;
/* Sanity check */
assert((from_base != to_base) || (from_size != to_size));
@@ -620,14 +622,21 @@ bi_pack_fma_convert(bi_instruction *ins, struct bi_registers *regs)
if (from_size == 16 && to_size == 16) {
/* f2i_i2f16 */
} else if (from_size == 32 && to_size == 32) {
+ unsigned op = 0;
+
if (from_base == nir_type_float) {
- /* float32_to_int */
+ op = BIFROST_FMA_FLOAT32_TO_INT(to_unsigned);
} else {
- /* int_to_float32 */
+ op = BIFROST_FMA_INT_TO_FLOAT32(from_unsigned);
}
+
+ return bi_pack_fma_1src(ins, regs, op);
} else if (from_size == 16 && to_size == 32) {
+ bool from_y = ins->swizzle[0][0];
+
if (from_base == nir_type_float) {
- /* float16_to_32 */
+ return bi_pack_fma_1src(ins, regs,
+ BIFROST_FMA_FLOAT16_TO_32(from_y));
} else {
/* int16_to_32 */
}