Mesa (main): intel/compiler/test: Fix build with GCC 7

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 30 20:14:20 UTC 2021


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

Author: Henry Goffin <hgoffin at amazon.com>
Date:   Thu Dec 30 07:13:41 2021 +0000

intel/compiler/test: Fix build with GCC 7

Without this change, test_fs_scoreboard.cpp does not compile on GCC 7
due to the use of C99 initializers in a C++ source file.

Fixes: c847bfaaf5c ("intel/fs/gen12: Add tests for scoreboard pass")

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14349>

---

 src/intel/compiler/test_fs_scoreboard.cpp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/intel/compiler/test_fs_scoreboard.cpp b/src/intel/compiler/test_fs_scoreboard.cpp
index 56571e3efcf..3be887741ab 100644
--- a/src/intel/compiler/test_fs_scoreboard.cpp
+++ b/src/intel/compiler/test_fs_scoreboard.cpp
@@ -104,6 +104,14 @@ emit_SEND(const fs_builder &bld, const fs_reg &dst,
    return inst;
 }
 
+static tgl_swsb
+tgl_swsb_testcase(unsigned regdist, unsigned sbid, enum tgl_sbid_mode mode)
+{
+   tgl_swsb swsb = tgl_swsb_sbid(mode, sbid);
+   swsb.regdist = regdist;
+   return swsb;
+}
+
 bool operator ==(const tgl_swsb &a, const tgl_swsb &b)
 {
    return a.mode == b.mode &&
@@ -178,8 +186,7 @@ TEST_F(scoreboard_test, RAW_inorder_outoforder)
 
    EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
    EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
-   EXPECT_EQ(instruction(block0, 2)->sched,
-             (tgl_swsb { .regdist = 2, .sbid = 0, .mode = TGL_SBID_SET }));
+   EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
 }
 
 TEST_F(scoreboard_test, RAW_outoforder_inorder)
@@ -206,8 +213,7 @@ TEST_F(scoreboard_test, RAW_outoforder_inorder)
 
    EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_sbid(TGL_SBID_SET, 0));
    EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
-   EXPECT_EQ(instruction(block0, 2)->sched,
-             (tgl_swsb { .regdist = 1, .sbid = 0, .mode = TGL_SBID_DST }));
+   EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(1, 0, TGL_SBID_DST));
 }
 
 TEST_F(scoreboard_test, RAW_outoforder_outoforder)
@@ -292,8 +298,7 @@ TEST_F(scoreboard_test, WAR_inorder_outoforder)
 
    EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
    EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
-   EXPECT_EQ(instruction(block0, 2)->sched,
-             (tgl_swsb { .regdist = 2, .sbid = 0, .mode = TGL_SBID_SET }));
+   EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
 }
 
 TEST_F(scoreboard_test, WAR_outoforder_inorder)
@@ -405,8 +410,7 @@ TEST_F(scoreboard_test, WAW_inorder_outoforder)
 
    EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
    EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
-   EXPECT_EQ(instruction(block0, 2)->sched,
-             (tgl_swsb { .regdist = 2, .sbid = 0, .mode = TGL_SBID_SET }));
+   EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
 }
 
 TEST_F(scoreboard_test, WAW_outoforder_inorder)



More information about the mesa-commit mailing list