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

Author: Gert Wollny <[email protected]>
Date:   Tue Feb 28 17:55:13 2023 +0100

r600/sfn/tests: Add a test for the copy prop into a group

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21684>

---

 .../drivers/r600/sfn/tests/sfn_optimizer_test.cpp  | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/src/gallium/drivers/r600/sfn/tests/sfn_optimizer_test.cpp 
b/src/gallium/drivers/r600/sfn/tests/sfn_optimizer_test.cpp
index a21658d3906..3a421969a81 100644
--- a/src/gallium/drivers/r600/sfn/tests/sfn_optimizer_test.cpp
+++ b/src/gallium/drivers/r600/sfn/tests/sfn_optimizer_test.cpp
@@ -373,6 +373,52 @@ BLOCK_END
    check(sh, expect);
 };
 
+
+TEST_F(TestShaderFromNir, OptimizeIntoGroup)
+{
+   const char *input =
+R"(VS
+CHIPCLASS CAYMAN
+INPUT LOC:0 NAME:15
+OUTPUT LOC:0 NAME:0 MASK:15
+REGISTERS R0.x R1.x R2.x
+SHADER
+BLOCK_START
+  ALU MOV S4.x : R0.x {W}
+  ALU MOV S5.y : R1.x {W}
+  ALU MOV S6.z : R2.x {WL}
+  ALU_GROUP_BEGIN
+    ALU CUBE S7.x@chgr{s} : S6.z S5.y {W}
+    ALU CUBE S7.y@chgr{s} : S6.z S4.x {W}
+    ALU CUBE S7.z@chgr{s} : S4.x S6.z {W}
+    ALU CUBE S7.w@chgr{s} : S5.y S6.z {WL}
+  ALU_GROUP_END
+  EXPORT_DONE PARAM 0 S7.xyzw
+BLOCK_END)";
+
+   const char *expect =
+R"(VS
+CHIPCLASS CAYMAN
+INPUT LOC:0 NAME:15
+OUTPUT LOC:0 NAME:0 MASK:15
+REGISTERS R0.x R1.x R2.x
+SHADER
+BLOCK_START
+  ALU_GROUP_BEGIN
+    ALU CUBE S7.x@chgr{s} : R2.x@chan R1.x@chan {W}
+    ALU CUBE S7.y@chgr{s} : R2.x@chan R0.x@chan {W}
+    ALU CUBE S7.z@chgr{s} : R0.x@chan R2.x@chan {W}
+    ALU CUBE S7.w@chgr{s} : R1.x@chan R2.x@chan {WL}
+  ALU_GROUP_END
+  EXPORT_DONE PARAM 0 S7.xyzw
+BLOCK_END
+)";
+   auto sh = from_string(input);
+   optimize(*sh);
+   check(sh, expect);
+};
+
+
 void
 TestShaderFromNir::check(Shader *s, const char *expect_orig)
 {

Reply via email to