1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry cs1 -o - %s -ast-dump -verify | FileCheck -DSHADERFN=cs1 -check-prefix=CHECK-ENV %s
2 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry cs2 -o - %s -ast-dump -verify | FileCheck -DSHADERFN=cs2 -check-prefix=CHECK-ENV %s
3 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -x hlsl -hlsl-entry cs3 -o - %s -ast-dump -verify | FileCheck -DSHADERFN=cs3 -check-prefix=CHECK-ENV %s
4 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -ast-dump -verify | FileCheck -check-prefix=CHECK-LIB %s
6 // expected-no-diagnostics
8 // CHECK-ENV: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} [[SHADERFN]] 'void ()'
9 // CHECK-ENV: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} [[SHADERFN]] 'void ()'
10 // CHECK-ENV-NEXT: CompoundStmt 0x
11 // CHECK-ENV-NEXT: HLSLNumThreadsAttr 0x
12 // CHECK-ENV-NEXT: HLSLShaderAttr 0x{{.*}} Implicit Compute
14 [numthreads(1,1,1)] void cs1() {}
15 [numthreads(1,1,1)] void cs2();
17 [numthreads(1,1,1)] void cs3();
18 [numthreads(1,1,1)] void cs3() {}
20 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s1 'void ()'
21 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s1 'void ()'
22 // CHECK-LIB-NEXT: CompoundStmt 0x
23 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Compute
24 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
26 [shader("compute"), numthreads(1,1,1)] void s1() {}
28 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s2 'void ()'
29 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s2 'void ()'
30 // CHECK-LIB-NEXT: CompoundStmt 0x
31 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Compute
32 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
33 [shader("compute")] void s2();
34 [shader("compute"), numthreads(1,1,1)] void s2() {}
36 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s3 'void ()'
37 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s3 'void ()'
38 // CHECK-LIB-NEXT: CompoundStmt 0x
39 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Compute
40 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
41 [numthreads(1,1,1)] void s3();
42 [shader("compute"), numthreads(1,1,1)] void s3() {}
44 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s4 'void ()'
45 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s4 'void ()'
46 // CHECK-LIB-NEXT: CompoundStmt 0x
47 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Compute
48 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
49 [shader("compute"), numthreads(1,1,1)] void s4();
50 [shader("compute")][numthreads(1,1,1)] void s4() {}
52 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s5 'void ()'
53 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s5 'void ()'
54 // CHECK-LIB-NEXT: CompoundStmt 0x
55 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Inherited Compute
56 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
57 [shader("compute"), numthreads(1,1,1)] void s5();
60 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s6 'void ()'
61 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s6 'void ()'
62 // CHECK-LIB-NEXT: CompoundStmt 0x
63 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
64 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Compute
65 [shader("compute"), numthreads(1,1,1)] void s6();
66 [shader("compute")] void s6() {}
68 // CHECK-LIB: FunctionDecl [[PROTO:0x[0-9a-f]+]] {{.*}} s7 'void ()'
69 // CHECK-LIB: FunctionDecl 0x{{.*}} prev [[PROTO]] {{.*}} s7 'void ()'
70 // CHECK-LIB-NEXT: CompoundStmt 0x
71 // CHECK-LIB-NEXT: HLSLShaderAttr 0x{{.*}} Inherited Compute
72 // CHECK-LIB-NEXT: HLSLNumThreadsAttr 0x
73 [shader("compute"), numthreads(1,1,1)] void s7();
74 [numthreads(1,1,1)] void s7() {}