| 1 |
; REQUIRES: spirv-as |
| 2 |
; RUN: spirv-as --target-env spv1.4 -o %t.spv %s |
| 3 |
; RUN: spirv-val %t.spv |
| 4 |
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s |
| 5 |
|
| 6 |
; SPIR-V |
| 7 |
; Version: 1.4 |
| 8 |
; Generator: Khronos LLVM/SPIR-V Translator; 14 |
| 9 |
; Bound: 44 |
| 10 |
; Schema: 0 |
| 11 |
OpCapability Addresses |
| 12 |
OpCapability Linkage |
| 13 |
OpCapability Kernel |
| 14 |
OpCapability Int64 |
| 15 |
OpMemoryModel Physical64 OpenCL |
| 16 |
OpEntryPoint Kernel %kernel "test" |
| 17 |
OpMemberDecorateString %struct 0 UserSemantic "foo" |
| 18 |
; CHECK: [[STR:@[0-9_.]+]] = {{.*}}foo |
| 19 |
; Note: this is checking for an annotation on an instantiation of the structure, |
| 20 |
; which is different than an annotation on the structure type. |
| 21 |
; CHECK: call ptr @llvm.ptr.annotation.p0.p0(ptr %{{.*}}, ptr [[STR]], ptr undef, i32 undef, ptr undef) |
| 22 |
%uint = OpTypeInt 32 0 |
| 23 |
%uint_0 = OpConstant %uint 0 |
| 24 |
%void = OpTypeVoid |
| 25 |
%kernel_sig = OpTypeFunction %void %uint |
| 26 |
%struct = OpTypeStruct %uint |
| 27 |
%ptr_struct = OpTypePointer Function %struct |
| 28 |
%ptr_uint = OpTypePointer Function %uint |
| 29 |
%kernel = OpFunction %void None %kernel_sig |
| 30 |
%a = OpFunctionParameter %uint |
| 31 |
%entry = OpLabel |
| 32 |
%s = OpVariable %ptr_struct Function |
| 33 |
%add = OpIAdd %uint %a %a |
| 34 |
%x = OpInBoundsPtrAccessChain %ptr_uint %s %uint_0 %uint_0 |
| 35 |
OpStore %x %add Aligned 4 |
| 36 |
OpReturn |
| 37 |
OpFunctionEnd |