File: GlobalVarAddrspace.ll

package info (click to toggle)
spirv-llvm-translator-21 21.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 17,620 kB
  • sloc: cpp: 47,835; ansic: 6,283; lisp: 3,878; sh: 162; python: 58; makefile: 42
file content (26 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (9)
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
;
; This test case checks that LLVM -> SPIR-V translation produces valid
; SPIR-V module, where a global variable, defined with non-default
; address space, have correct non-function storage class.
;
; No additional checks are needed in addition to simple translation
; to SPIR-V. In case of an error newly produced SPIR-V module validation
; would fail due to spirv-val that detects problematic SPIR-V code from
; translator and reports it as the following error:
;
; "Variables can not have a function[7] storage class outside of a function".
;
;
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64-unknown-unknown"

@G = addrspace(1) global i1 true

define spir_func i1 @f(i1 %0) {
 store i1 %0, ptr addrspace(1) @G, align 1
 ret i1 %0
}