File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,16 @@ class SPIRVDecorateGeneric : public SPIRVAnnotationGeneric {
81
81
void setOwner (SPIRVDecorationGroup *Owner) { this ->Owner = Owner; }
82
82
83
83
SPIRVCapVec getRequiredCapability () const override {
84
- return getCapability (Dec);
84
+ switch (Dec) {
85
+ case DecorationBuiltIn: {
86
+ // Return the BuiltIn's capabilities.
87
+ BuiltIn BI = static_cast <BuiltIn>(Literals.back ());
88
+ return getCapability (BI);
89
+ }
90
+
91
+ default :
92
+ return getCapability (Dec);
93
+ }
85
94
}
86
95
87
96
SPIRVWord getRequiredSPIRVVersion () const override {
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 %s -triple spir -cl-std=CL2.0 -emit-llvm-bc -o %t.bc
2
+
3
+ // RUN: llvm-spirv %t.bc -o %t.spv
4
+ // RUN: spirv-val %t.spv
5
+ // RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
6
+ // RUN: llvm-spirv %t.spv -r -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM
7
+
8
+ // Taken from clang/lib/Headers/opencl-c{,-base}.h
9
+ // TODO: remove these and switch to -fdeclare-opencl-builtins
10
+ typedef unsigned int uint4 __attribute__((ext_vector_type (4 )));
11
+ uint4 __attribute__((overloadable )) get_sub_group_gt_mask (void );
12
+
13
+ // CHECK-SPIRV: Capability GroupNonUniformBallot
14
+ // CHECK-SPIRV: Decorate {{[0-9]+}} BuiltIn 4418
15
+
16
+ // CHECK-LLVM: test_mask
17
+ // CHECK-LLVM: call spir_func <4 x i32> @_Z21get_sub_group_gt_maskv()
18
+
19
+ kernel void test_mask (global uint4 * out )
20
+ {
21
+ * out = get_sub_group_gt_mask ();
22
+ }
You can’t perform that action at this time.
0 commit comments