pan/bit: Add BI_TABLE test
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 14 Apr 2020 19:25:27 +0000 (15:25 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 17 Apr 2020 20:25:36 +0000 (16:25 -0400)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>

src/panfrost/bifrost/test/bi_test_pack.c

index b68d10a07c919b49ceb41a4b63e0dc873591b747..088492524cb1129bca0b403ec76f365548adfa12 100644 (file)
@@ -286,6 +286,21 @@ bit_special_helper(struct panfrost_device *dev,
         }
 }
 
+static void
+bit_table_helper(struct panfrost_device *dev, uint32_t *input, enum bit_debug debug)
+{
+        bi_instruction ins = bit_ins(BI_TABLE, 1, nir_type_float, 32);
+
+        for (enum bi_table_op op = 0; op <= BI_TABLE_LOG2_U_OVER_U_1_LOW; ++op) {
+                ins.op.table = op;
+
+                if (!bit_test_single(dev, &ins, input, false, debug)) {
+                        fprintf(stderr, "FAIL: table.%s\n",
+                                        bi_table_op_name(op));
+                }
+        }
+}
+
 static void
 bit_frexp_helper(struct panfrost_device *dev, uint32_t *input, enum bit_debug debug)
 {
@@ -400,6 +415,8 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug)
         float special[4] = { 0.9 };
         uint32_t special16[4] = { _mesa_float_to_half(special[0]) | (_mesa_float_to_half(0.2) << 16) };
 
+        bit_table_helper(dev, (uint32_t *) special, debug);
+
         for (unsigned sz = 16; sz <= 32; sz *= 2) {
                 uint32_t *input =
                         (sz == 16) ? special16 :