Skip to content

Commit b4044d2

Browse files
authored
[lit] [SPIRV} Copy legal-examples to lit (#5320)
Copy SPIRV tests under legal-examples and modify to work with lit. This is first PR for moving SPIRV test to lit. The reason to copy instead of moving the tests is to make sure not lost coverage before all tests switch to lit. And update all tests in one PR will be a PR with 1000 files.
1 parent 93555aa commit b4044d2

26 files changed

Lines changed: 115 additions & 185 deletions

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

Lines changed: 0 additions & 20 deletions
This file was deleted.

tools/clang/test/CodeGenSPIRV/legal-examples/02-write-global-static-ok.hlsl

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
2+
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
6+
// CHECK-NEXT: OpStore [[ptr]] [[val]]
7+
8+
struct S {
9+
float4 f;
10+
};
11+
12+
int i;
13+
14+
StructuredBuffer<S> gSBuffer;
15+
RWStructuredBuffer<S> gRWSBuffer;
16+
17+
[numthreads(1, 1, 1)]
18+
void main() {
19+
gRWSBuffer[i] = gSBuffer[i];
20+
}

tools/clang/test/CodeGenSPIRV/legal-examples/01-copy-global-static-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/01-copy-global-static-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
2+
3+
// CHECK: [[val:%[0-9]+]] = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
4+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_v4float %gRWSBuffer
5+
// CHECK-NEXT: OpStore [[ptr]] [[val]]
6+
7+
struct S {
8+
float4 f;
9+
};
10+
11+
int i;
12+
13+
RWStructuredBuffer<S> gRWSBuffer;
14+
15+
static RWStructuredBuffer<S> sRWSBuffer = gRWSBuffer;
16+
17+
[numthreads(1,1,1)]
18+
void main() {
19+
sRWSBuffer[i].f = 0.0;
20+
}

tools/clang/test/CodeGenSPIRV/legal-examples/03-copy-local-struct-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/03-copy-local-struct-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {

tools/clang/test/CodeGenSPIRV/legal-examples/04-copy-local-nested-struct-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/04-copy-local-nested-struct-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {

tools/clang/test/CodeGenSPIRV/legal-examples/05-func-param-sbuf-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/05-func-param-sbuf-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {

tools/clang/test/CodeGenSPIRV/legal-examples/06-func-param-rwsbuf-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/06-func-param-rwsbuf-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {

tools/clang/test/CodeGenSPIRV/legal-examples/07-func-ret-tmp-var-ok.hlsl renamed to tools/clang/test/CodeGenSPIRV_Lit/legal-examples/07-func-ret-tmp-var-ok.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T cs_6_0 -E main -O3
1+
// RUN: %dxc -T cs_6_0 -E main -O3 -Vd %s -spirv | FileCheck %s
22

3-
// CHECK: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4-
// CHECK-NEXT: [[val:%\d+]] = OpLoad %S [[ptr]]
5-
// CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
3+
// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gSBuffer
4+
// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %S [[ptr]]
5+
// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_S %gRWSBuffer
66
// CHECK-NEXT: OpStore [[ptr]] [[val]]
77

88
struct S {

0 commit comments

Comments
 (0)