浏览代码

[spirv] Fix syntax error in legalization examples and renaming (#1589)

Lei Zhang 7 年之前
父节点
当前提交
0f7434808d

+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/0-copy-sbuf-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/00-copy-sbuf-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/1-copy-global-static-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/01-copy-global-static-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/2-write-global-static-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/02-write-global-static-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/3-copy-local-struct-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/03-copy-local-struct-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/4-copy-local-nested-struct-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/04-copy-local-nested-struct-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/5-func-param-sbuf-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/05-func-param-sbuf-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/6-func-param-rwsbuf-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/06-func-param-rwsbuf-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/7-func-ret-tmp-var-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/07-func-ret-tmp-var-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/8-func-ret-direct-ok.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/08-func-ret-direct-ok.hlsl


+ 0 - 0
tools/clang/test/CodeGenSPIRV/legal-examples/9-if-stmt-select-fail.hlsl → tools/clang/test/CodeGenSPIRV/legal-examples/09-if-stmt-select-fail.hlsl


+ 5 - 3
tools/clang/test/CodeGenSPIRV/legal-examples/12-switch-stmt-select-fail.hlsl

@@ -1,6 +1,9 @@
 // Run: %dxc -T cs_6_0 -E main -O3
 // Run: %dxc -T cs_6_0 -E main -O3
 
 
-// CHECK: error
+// TODO: This example is expected to trigger validation failure. The validator
+// is not checking it yet.
+
+// CHECK: OpPhi %_ptr_Uniform_type_StructuredBuffer_S %gSBuffer1 {{%\d+}} %gSBuffer2 {{%\d+}}
 
 
 struct S {
 struct S {
   float4 f;
   float4 f;
@@ -30,7 +33,6 @@ void main() {
     default:
     default:
       lSBuffer = gSBuffer2;
       lSBuffer = gSBuffer2;
       break;
       break;
-    }
-    gRWSBuffer[i] = lSBuffer[i];
   }
   }
+  gRWSBuffer[i] = lSBuffer[i];
 }
 }

+ 13 - 12
tools/clang/unittests/SPIRV/CodeGenSPIRVTest.cpp

@@ -1670,34 +1670,34 @@ TEST_F(FileTest, ComputeShaderGroupShared) {
 // === Legalization examples ===
 // === Legalization examples ===
 
 
 TEST_F(FileTest, LegalizationExample0) {
 TEST_F(FileTest, LegalizationExample0) {
-  runFileTest("legal-examples/0-copy-sbuf-ok.hlsl");
+  runFileTest("legal-examples/00-copy-sbuf-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample1) {
 TEST_F(FileTest, LegalizationExample1) {
-  runFileTest("legal-examples/1-copy-global-static-ok.hlsl");
+  runFileTest("legal-examples/01-copy-global-static-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample2) {
 TEST_F(FileTest, LegalizationExample2) {
-  runFileTest("legal-examples/2-write-global-static-ok.hlsl");
+  runFileTest("legal-examples/02-write-global-static-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample3) {
 TEST_F(FileTest, LegalizationExample3) {
-  runFileTest("legal-examples/3-copy-local-struct-ok.hlsl");
+  runFileTest("legal-examples/03-copy-local-struct-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample4) {
 TEST_F(FileTest, LegalizationExample4) {
-  runFileTest("legal-examples/4-copy-local-nested-struct-ok.hlsl");
+  runFileTest("legal-examples/04-copy-local-nested-struct-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample5) {
 TEST_F(FileTest, LegalizationExample5) {
-  runFileTest("legal-examples/5-func-param-sbuf-ok.hlsl");
+  runFileTest("legal-examples/05-func-param-sbuf-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample6) {
 TEST_F(FileTest, LegalizationExample6) {
-  runFileTest("legal-examples/6-func-param-rwsbuf-ok.hlsl");
+  runFileTest("legal-examples/06-func-param-rwsbuf-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample7) {
 TEST_F(FileTest, LegalizationExample7) {
-  runFileTest("legal-examples/7-func-ret-tmp-var-ok.hlsl");
+  runFileTest("legal-examples/07-func-ret-tmp-var-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample8) {
 TEST_F(FileTest, LegalizationExample8) {
-  runFileTest("legal-examples/8-func-ret-direct-ok.hlsl");
+  runFileTest("legal-examples/08-func-ret-direct-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample9) {
 TEST_F(FileTest, LegalizationExample9) {
-  runFileTest("legal-examples/9-if-stmt-select-fail.hlsl", Expect::ValFailure);
+  runFileTest("legal-examples/09-if-stmt-select-fail.hlsl", Expect::ValFailure);
 }
 }
 TEST_F(FileTest, LegalizationExample10) {
 TEST_F(FileTest, LegalizationExample10) {
   runFileTest("legal-examples/10-if-stmt-select-ok.hlsl");
   runFileTest("legal-examples/10-if-stmt-select-ok.hlsl");
@@ -1706,8 +1706,9 @@ TEST_F(FileTest, LegalizationExample11) {
   runFileTest("legal-examples/11-if-stmt-const-ok.hlsl");
   runFileTest("legal-examples/11-if-stmt-const-ok.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample12) {
 TEST_F(FileTest, LegalizationExample12) {
-  runFileTest("legal-examples/12-switch-stmt-select-fail.hlsl",
-              Expect::Failure);
+  // TODO: this is expected to trigger ValFailure! Validator is not
+  // checking this case yet.
+  runFileTest("legal-examples/12-switch-stmt-select-fail.hlsl");
 }
 }
 TEST_F(FileTest, LegalizationExample13) {
 TEST_F(FileTest, LegalizationExample13) {
   runFileTest("legal-examples/13-switch-stmt-const-ok.hlsl");
   runFileTest("legal-examples/13-switch-stmt-const-ok.hlsl");