Mesa (master): pan/bit: Add round tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 1 00:49:38 UTC 2020


Module: Mesa
Branch: master
Commit: d04be375ccdd5612f07689f9c883c4e8c3f159c3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d04be375ccdd5612f07689f9c883c4e8c3f159c3

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Apr 30 18:15:23 2020 -0400

pan/bit: Add round tests

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

---

 src/panfrost/bifrost/test/bi_test_pack.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index f8ae55c6e37..ba9828cffe0 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -358,6 +358,21 @@ bit_frexp_helper(struct panfrost_device *dev, uint32_t *input, enum bit_debug de
         }
 }
 
+static void
+bit_round_helper(struct panfrost_device *dev, uint32_t *input, unsigned sz, bool FMA, enum bit_debug debug)
+{
+        bi_instruction ins = bit_ins(BI_ROUND, 1, nir_type_float, sz);
+
+        for (enum bifrost_roundmode mode = 0; mode <= 3; ++mode) {
+                ins.roundmode = mode;
+
+                if (!bit_test_single(dev, &ins, input, FMA, debug)) {
+                        fprintf(stderr, "FAIL: round.%u.%u\n",
+                                        sz, mode);
+                }
+        }
+}
+
 static void
 bit_reduce_helper(struct panfrost_device *dev, uint32_t *input, enum bit_debug debug)
 {
@@ -569,6 +584,7 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug)
 
                 bit_fmod_helper(dev, BI_ADD, sz, true, input, debug, 0);
                 bit_fmod_helper(dev, BI_ADD, sz, false, input, debug, 0);
+                bit_round_helper(dev, (uint32_t *) input32, sz, true, debug);
 
                 bit_fmod_helper(dev, BI_MINMAX, sz, false, input, debug, BI_MINMAX_MIN);
                 bit_fmod_helper(dev, BI_MINMAX, sz, false, input, debug, BI_MINMAX_MAX);



More information about the mesa-commit mailing list