pan/bi: Add CSEL.16 packing tests
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 16:32:28 +0000 (12:32 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 20:49:45 +0000 (16:49 -0400)
Passing but let's increase coverage.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5232>

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

index 7f18fbc55544c4a5f1c3bac127d0244bd5dde25f..43777ca72f8b71d946cb2e3e8d8d4d3b5673e4cb 100644 (file)
@@ -511,10 +511,24 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
 
         case BI_CSEL: {
                 bool direct = ins->cond == BI_COND_ALWAYS;
-                bool cond = direct ? srcs[0].u32 :
-                        bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], 0, 0);
+                unsigned sz = nir_alu_type_get_type_size(ins->src_types[0]);
+
+                if (sz == 32) {
+                        bool cond = direct ? srcs[0].u32 :
+                                bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], 0, 0);
+
+                        dest = cond ? srcs[2] : srcs[3];
+                } else if (sz == 16) {
+                        for (unsigned c = 0; c < 2; ++c) {
+                                bool cond = direct ? srcs[0].u16[c] :
+                                        bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], c, c);
+
+                                dest.u16[c] = cond ? srcs[2].u16[c] : srcs[3].u16[c];
+                        }
+                } else {
+                        unreachable("Remaining types todo");
+                }
 
-                dest = cond ? srcs[2] : srcs[3];
                 break;
         }
 
index 352a7794b511fc26561eeb7f3d598ea046988945..81bf0b022639bb81b1ec4008470c459b5b4ccae1 100644 (file)
@@ -585,7 +585,7 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug)
                 bit_icmp_helper(dev, input, sz, nir_type_int, debug);
         }
 
-        for (unsigned sz = 32; sz <= 32; sz *= 2)
+        for (unsigned sz = 16; sz <= 32; sz *= 2)
                 bit_csel_helper(dev, sz, (uint32_t *) input32, debug);
 
         float special[4] = { 0.9 };