File: OpDecorateString_UserSemantic_Builtin.spvasm

package info (click to toggle)
spirv-llvm-translator-14 14.0.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,640 kB
  • sloc: cpp: 47,664; lisp: 3,704; sh: 153; python: 43; makefile: 33
file content (45 lines) | stat: -rw-r--r-- 2,233 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
; REQUIRES: spirv-as
; RUN: spirv-as --target-env spv1.4 -o %t.spv %s
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r --spirv-target-env=CL2.0 %t.spv -o - | llvm-dis | FileCheck --check-prefix=CHECK-OCL %s
; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o - | llvm-dis | FileCheck --check-prefix=CHECK-SPV-IR %s

; Ensure that UserSemantic decorations on BuiltIn variables do not prevent successful translation.

; CHECK-OCL: call spir_func i64 @_Z13get_global_idj(i32 0)
; CHECK-SPV-IR: call spir_func i64 @_Z33__spirv_BuiltInGlobalInvocationIdi(i32 0)

               OpCapability Addresses
               OpCapability Linkage
               OpCapability Kernel
               OpCapability Int64
               OpMemoryModel Physical64 OpenCL
               OpEntryPoint Kernel %usersemantic_test "usersemantic_test" %global_id
               OpDecorate %global_id LinkageAttributes "global_id" Import
               OpDecorate %global_id Constant
               OpDecorate %global_id BuiltIn GlobalInvocationId
               ; Basic decoration:
               OpDecorateString %global_id UserSemantic "FOO"
               ; Duplicate decorations are allowed as long as the string is different.
               OpDecorateString %global_id UserSemantic "BAR"
               ; Try one more string with punctuation.
               OpDecorateString %global_id UserSemantic "FOO? BAR. BAZ!"
      %ulong = OpTypeInt 64 0
       %uint = OpTypeInt 32 0
    %v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
       %void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
          %9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
%global_id = OpVariable %_ptr_Input_v3ulong Input
%usersemantic_test = OpFunction %void None %9
        %dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
      %entry = OpLabel
      %index = OpLoad %v3ulong %global_id Aligned 32
       %call = OpCompositeExtract %ulong %index 0
       %conv = OpUConvert %uint %call
    %idxprom = OpSConvert %ulong %conv
   %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %idxprom
               OpStore %arrayidx %conv Aligned 4
               OpReturn
               OpFunctionEnd