pan/bit: Update f32->f16 convert test
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 31 Jul 2020 00:22:56 +0000 (20:22 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 31 Jul 2020 14:14:59 +0000 (10:14 -0400)
Needs a second argument to be consistent with the real IR and the
hardware instruction.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 8a4efe2d730 ("pan/bi: Pack second argument of F32_TO_F16")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6142>

src/panfrost/bifrost/test/bi_interpret.c
src/panfrost/bifrost/test/bi_test_pack.c

index 43777ca72f8b71d946cb2e3e8d8d4d3b5673e4cb..a8fadb3627e543e1370200625aa54cd8d6da1800 100644 (file)
@@ -489,13 +489,7 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
                         dest.i32 = bit_as_int32(ins->src_types[0], srcs[0], comp, ins->roundmode);
                 else if (ins->dest_type == nir_type_float16) {
                         dest.u16[0] = bit_as_float16(ins->src_types[0], srcs[0], ins->swizzle[0][0]);
-
-                        if (ins->src_types[0] == nir_type_float32) {
-                                /* TODO: Second argument */
-                                dest.u16[1] = 0;
-                        } else {
-                                dest.u16[1] = bit_as_float16(ins->src_types[0], srcs[0], ins->swizzle[0][1]);
-                        }
+                        dest.u16[1] = bit_as_float16(ins->src_types[0], srcs[0], ins->swizzle[0][1]);
                 } else if (ins->dest_type == nir_type_uint16) {
                         dest.u16[0] = bit_as_uint16(ins->src_types[0], srcs[0], ins->swizzle[0][0], ins->roundmode);
                         dest.u16[1] = bit_as_uint16(ins->src_types[0], srcs[0], ins->swizzle[0][1], ins->roundmode);
index 81bf0b022639bb81b1ec4008470c459b5b4ccae1..9a9f991ad72e8dc96f49081439a9e8ae80f600d4 100644 (file)
@@ -488,6 +488,13 @@ bit_convert_helper(struct panfrost_device *dev, unsigned from_size,
                         ins.swizzle[0][0] = cx;
                         ins.swizzle[0][1] = cy;
 
+                        if (to_size == 16 && from_size == 32) {
+                                ins.src_types[1] = ins.src_types[0];
+                                ins.src[1] = ins.src[0];
+                        } else {
+                                ins.src[1] = ins.src_types[1] = 0;
+                        }
+
                         bit_test_single(dev, &ins, input, FMA, debug);
                 }
         }