| 1 |
// RUN: %clang_cc1 -cl-std=clc++ -emit-llvm-bc -triple spir -O0 %s -o %t.bc |
| 2 |
// RUN: llvm-spirv %t.bc -o %t.spv |
| 3 |
// RUN: spirv-val %t.spv |
| 4 |
// RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 5 |
// RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM |
| 6 |
// RUN: not llvm-spirv %t.bc --spirv-max-version=1.0 2>&1 | FileCheck %s --check-prefix=CHECK-SPV10 |
| 7 |
|
| 8 |
class Something { |
| 9 |
public: |
| 10 |
Something(int a) : v(a) {} |
| 11 |
int v; |
| 12 |
}; |
| 13 |
|
| 14 |
Something g(33); |
| 15 |
|
| 16 |
void kernel work(global int *out) { |
| 17 |
*out = g.v; |
| 18 |
} |
| 19 |
|
| 20 |
// CHECK-SPIRV: EntryPoint 6 [[work:[0-9]+]] "work" |
| 21 |
// CHECK-SPIRV-NOT: ExecutionMode [[work]] 33 |
| 22 |
// CHECK-SPIRV: EntryPoint 6 [[ctor:[0-9]+]] "_GLOBAL__sub_I_global_ctor.cl" |
| 23 |
// CHECK-SPIRV: ExecutionMode [[ctor]] 33 |
| 24 |
|
| 25 |
// CHECK-LLVM: llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @[[CTORNAME:_GLOBAL__sub_I[^ ]+]], ptr null } |
| 26 |
// CHECK-LLVM: define spir_kernel void @[[CTORNAME]] |
| 27 |
|
| 28 |
// CHECK-SPV10: Feature requires SPIR-V 1.1 or greater: Initializer/Finalizer Execution Mode |