Debian Codegraph @

llvm/test/CodeGen/SPIRV/transcoding/builtin_vars.ll

raw
1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
6
7 ; CHECK: OpDecorate %[[#Id:]] BuiltIn GlobalLinearId
8 ; CHECK: %[[#Id:]] = OpVariable %[[#]]
9
10 @__spirv_BuiltInGlobalLinearId = external addrspace(1) global i32
11
12 define spir_kernel void @f(ptr addrspace(1) nocapture %order) {
13 entry:
14 %0 = load i32, ptr addrspace(4) addrspacecast (ptr addrspace(1) @__spirv_BuiltInGlobalLinearId to ptr addrspace(4)), align 4
15 ;; Need to store the result somewhere, otherwise the access to GlobalLinearId
16 ;; may be removed.
17 store i32 %0, ptr addrspace(1) %order, align 4
18 ret void
19 }