1 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | FileCheck %s -check-prefixes=COMMON,PTR
2 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - -DREF | FileCheck %s -check-prefixes=COMMON,REF
12 //COMMON: @glob ={{.*}} addrspace(1) global i32
14 //PTR: @glob_p ={{.*}} addrspace(1) global ptr addrspace(4) addrspacecast (ptr addrspace(1) @glob to ptr addrspace(4))
15 //REF: @glob_p ={{.*}} addrspace(1) constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @glob to ptr addrspace(4))
16 int PTR glob_p = ADR(glob);
18 //COMMON: @_ZZ3fooi{{P|R}}U3AS4iE6loc_st = internal addrspace(1) global i32
19 //PTR: @_ZZ3fooiPU3AS4iE8loc_st_p = internal addrspace(1) global ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZZ3fooiPU3AS4iE6loc_st to ptr addrspace(4))
20 //REF: @_ZZ3fooiRU3AS4iE8loc_st_p = internal addrspace(1) constant ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZZ3fooiRU3AS4iE6loc_st to ptr addrspace(4))
21 //COMMON: @loc_ext_p = external addrspace(1) {{global|constant}} ptr addrspace(4)
22 //COMMON: @loc_ext = external addrspace(1) global i32
24 //COMMON: define{{.*}} spir_func noundef i32 @_Z3fooi{{P|R}}U3AS4i(i32 noundef %par, ptr addrspace(4){{.*}} %par_p)
25 int foo(int par, int PTR par_p){
26 //COMMON: %loc = alloca i32
28 //COMMON: %loc_p = alloca ptr addrspace(4)
29 //COMMON: %loc_p_const = alloca ptr
30 //COMMON: [[GAS:%[._a-z0-9]*]] ={{.*}} addrspacecast ptr %loc to ptr addrspace(4)
31 //COMMON: store ptr addrspace(4) [[GAS]], ptr %loc_p
32 int PTR loc_p = ADR(loc);
33 //COMMON: store ptr %loc, ptr %loc_p_const
34 const __private int PTR loc_p_const = ADR(loc);
36 // CHECK directives for the following code are located above.
38 static int PTR loc_st_p = ADR(loc_st);
40 extern int PTR loc_ext_p;