Mesa (main): pan/bi: Don't use funny round modes in tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 18:25:32 UTC 2022


Module: Mesa
Branch: main
Commit: 24d072fd6afcc93b36d48c48b6f61c95834ffedb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=24d072fd6afcc93b36d48c48b6f61c95834ffedb

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sun Feb 27 14:46:15 2022 -0500

pan/bi: Don't use funny round modes in tests

To prepare for defeaturing round modes, replace uses of round-to-positive with
round-to-even in our unit tests. This doesn't meaningfully impact test coverage;
there is no way to generate that round mode.

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

---

 src/panfrost/bifrost/test/test-constant-fold.cpp | 12 -----------
 src/panfrost/bifrost/test/test-optimizer.cpp     | 27 +++++++++++-------------
 2 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/src/panfrost/bifrost/test/test-constant-fold.cpp b/src/panfrost/bifrost/test/test-constant-fold.cpp
index 941c3e02648..660e7793d1a 100644
--- a/src/panfrost/bifrost/test/test-constant-fold.cpp
+++ b/src/panfrost/bifrost/test/test-constant-fold.cpp
@@ -171,18 +171,6 @@ TEST_F(ConstantFold, LimitedShiftsForTexturing)
    EXPECT_NOT_FOLD(I);
 }
 
-TEST_F(ConstantFold, LimitedRoundingForTexturing)
-{
-   bi_index reg = bi_register(0);
-
-   EXPECT_FOLD(bi_f32_to_u32_to(b, reg, bi_imm_f32(15.0), BI_ROUND_NONE), 15);
-   EXPECT_FOLD(bi_f32_to_u32_to(b, reg, bi_imm_f32(15.9), BI_ROUND_NONE), 15);
-   EXPECT_FOLD(bi_f32_to_u32_to(b, reg, bi_imm_f32(-20.4), BI_ROUND_NONE), 0);
-
-   EXPECT_NOT_FOLD(bi_f32_to_u32_to(b, reg, bi_imm_f32(-20.4), BI_ROUND_RTP));
-   EXPECT_NOT_FOLD(bi_f32_to_u32_to(b, reg, bi_imm_f32(-20.4), BI_ROUND_RTZ));
-}
-
 TEST_F(ConstantFold, NonConstantSourcesCannotBeFolded)
 {
    bi_index reg = bi_register(0);
diff --git a/src/panfrost/bifrost/test/test-optimizer.cpp b/src/panfrost/bifrost/test/test-optimizer.cpp
index 76082733e09..80b81597786 100644
--- a/src/panfrost/bifrost/test/test-optimizer.cpp
+++ b/src/panfrost/bifrost/test/test-optimizer.cpp
@@ -75,17 +75,14 @@ TEST_F(Optimizer, FusedFABSNEG)
    CASE(bi_fadd_f32_to(b, reg, bi_fabsneg_f32(b, x), y, BI_ROUND_NONE),
         bi_fadd_f32_to(b, reg, x, y, BI_ROUND_NONE));
 
-   CASE(bi_fadd_f32_to(b, reg, bi_fabsneg_f32(b, negabsx), y, BI_ROUND_RTP),
-        bi_fadd_f32_to(b, reg, negabsx, y, BI_ROUND_RTP));
-
    CASE(bi_fmin_f32_to(b, reg, bi_fabsneg_f32(b, negabsx), bi_neg(y)),
         bi_fmin_f32_to(b, reg, negabsx, bi_neg(y)));
 }
 
 TEST_F(Optimizer, FusedFABSNEGForFP16)
 {
-   CASE(bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, negabsx), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, negabsx, y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, negabsx), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, negabsx, y, BI_ROUND_NONE));
 
    CASE(bi_fmin_v2f16_to(b, reg, bi_fabsneg_v2f16(b, negabsx), bi_neg(y)),
         bi_fmin_v2f16_to(b, reg, negabsx, bi_neg(y)));
@@ -165,20 +162,20 @@ TEST_F(Optimizer, AvoidFADD_V2F16WithEqualSourcesAbsAbsAndClamp)
 
 TEST_F(Optimizer, SwizzlesComposedForFP16)
 {
-   CASE(bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, bi_swz_16(negabsx, true, false)), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, bi_swz_16(negabsx, true, false), y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, bi_swz_16(negabsx, true, false)), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, bi_swz_16(negabsx, true, false), y, BI_ROUND_NONE));
 
-   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, negabsx), true, false), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, bi_swz_16(negabsx, true, false), y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, negabsx), true, false), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, bi_swz_16(negabsx, true, false), y, BI_ROUND_NONE));
 
-   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_swz_16(negabsx, true, false)), true, false), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, negabsx, y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_swz_16(negabsx, true, false)), true, false), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, negabsx, y, BI_ROUND_NONE));
 
-   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_half(negabsx, false)), true, false), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, bi_half(negabsx, false), y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_half(negabsx, false)), true, false), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, bi_half(negabsx, false), y, BI_ROUND_NONE));
 
-   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_half(negabsx, true)), true, false), y, BI_ROUND_RTP),
-        bi_fadd_v2f16_to(b, reg, bi_half(negabsx, true), y, BI_ROUND_RTP));
+   CASE(bi_fadd_v2f16_to(b, reg, bi_swz_16(bi_fabsneg_v2f16(b, bi_half(negabsx, true)), true, false), y, BI_ROUND_NONE),
+        bi_fadd_v2f16_to(b, reg, bi_half(negabsx, true), y, BI_ROUND_NONE));
 }
 
 TEST_F(Optimizer, PreserveWidens)



More information about the mesa-commit mailing list