pan/bit: Use swizzle helper for round
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 4 May 2020 18:09:39 +0000 (14:09 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 4 May 2020 18:45:15 +0000 (18:45 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4890>

src/panfrost/bifrost/test/bi_test_pack.c

index 69b9f695e7703d306657b41c1475e72b4a1bd2e9..2f02db12c9b43e69923ef790a785910cbe6cd74f 100644 (file)
@@ -346,15 +346,11 @@ bit_round_helper(struct panfrost_device *dev, uint32_t *input, unsigned sz, bool
         bi_instruction ins = bit_ins(BI_ROUND, 1, nir_type_float, sz);
 
         for (enum bifrost_roundmode mode = 0; mode <= 3; ++mode) {
-                for (unsigned swizzle = 0; swizzle < (sz == 16 ? 4 : 1); ++swizzle) {
-                        if (sz == 16) {
-                                for (unsigned i = 0; i < 2; ++i)
-                                        ins.swizzle[0][i] = ((swizzle >> i) & 1) ? 1 : 0;
-                        }
-
-                        ins.roundmode = mode;
-                        bit_test_single(dev, &ins, input, FMA, debug);
-                }
+        BIT_FOREACH_SWIZZLE(swz, 1, sz) {
+                bit_apply_swizzle(&ins, swz, 1, sz);
+                ins.roundmode = mode;
+                bit_test_single(dev, &ins, input, FMA, debug);
+        }
         }
 }