Skip to content

Commit cb477ce

Browse files
committed
add DXIL & basic access tests
1 parent 8d4c31a commit cb477ce

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clang_cc1 -triple spirv-pc-vulkan-compute -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s
2+
3+
struct S {
4+
uint value;
5+
};
6+
// CHECK: %struct.S = type { i32 }
7+
8+
[[vk::push_constant]] S buffer;
9+
// CHECK: @buffer = external hidden addrspace(13) externally_initialized global %struct.S, align 1
10+
11+
[numthreads(1, 1, 1)]
12+
void main() {
13+
uint32_t v = buffer.value;
14+
// CHECK: %[[#REG:]] = load i32, ptr addrspace(13) @buffer, align 1
15+
// CHECK: store i32 %[[#REG]], ptr %v, align 4
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-compute -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s
2+
3+
struct S {
4+
uint value;
5+
};
6+
// CHECK: %struct.S = type { i32 }
7+
8+
[[vk::push_constant]] S buffer;
9+
// When targeting DXIL, the attribute is ignored, meaning this variable
10+
// is part of the implicit cbuffer.
11+
// CHECK: @buffer = external hidden addrspace(2) global %struct.S, align 1
12+
13+
[numthreads(1, 1, 1)]
14+
void main() {
15+
uint32_t v = buffer.value;
16+
// CHECK: %[[#REG:]] = load i32, ptr addrspace(2) @buffer, align 1
17+
// CHECK: store i32 %[[#REG]], ptr %v, align 4
18+
}

0 commit comments

Comments
 (0)