Clang Project

clang_source_code/test/CodeGenOpenCL/address-spaces-mangling.cl
1// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes="ASMANG,ASMANG10" %s
2// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -faddress-space-map-mangling=yes -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes="ASMANG,ASMANG20" %s
3// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes="NOASMANG,NOASMANG10" %s
4// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -faddress-space-map-mangling=no -triple %itanium_abi_triple -emit-llvm -o - | FileCheck -check-prefixes="NOASMANG,NOASMANG20" %s
5
6// We check that the address spaces are mangled the same in both version of OpenCL
7// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
8// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
9
10// We can't name this f as private is equivalent to default
11// no specifier given address space so we get multiple definition
12// warnings, but we do want it for comparison purposes.
13__attribute__((overloadable))
14void ff(int *arg) { }
15// ASMANG10: @_Z2ffPi
16// ASMANG20: @_Z2ffPU3AS4i
17// NOASMANG10: @_Z2ffPU9CLprivatei
18// NOASMANG20: @_Z2ffPU9CLgenerici
19// OCL-20-DAG: @_Z2ffPU3AS4i
20// OCL-12-DAG: @_Z2ffPi
21
22__attribute__((overloadable))
23void f(private int *arg) { }
24// ASMANG: @_Z1fPi
25// NOASMANG: @_Z1fPU9CLprivatei
26// OCL-20-DAG: @_Z1fPi
27// OCL-12-DAG: @_Z1fPi
28
29__attribute__((overloadable))
30void f(global int *arg) { }
31// ASMANG: @_Z1fPU3AS1i
32// NOASMANG: @_Z1fPU8CLglobali
33// OCL-20-DAG: @_Z1fPU3AS1i
34// OCL-12-DAG: @_Z1fPU3AS1i
35
36__attribute__((overloadable))
37void f(local int *arg) { }
38// ASMANG: @_Z1fPU3AS3i
39// NOASMANG: @_Z1fPU7CLlocali
40// OCL-20-DAG: @_Z1fPU3AS3i
41// OCL-12-DAG: @_Z1fPU3AS3i
42
43__attribute__((overloadable))
44void f(constant int *arg) { }
45// ASMANG: @_Z1fPU3AS2i
46// NOASMANG: @_Z1fPU10CLconstanti
47// OCL-20-DAG: @_Z1fPU3AS2i
48// OCL-12-DAG: @_Z1fPU3AS2i
49
50#if __OPENCL_C_VERSION__ >= 200
51__attribute__((overloadable))
52void f(generic int *arg) { }
53// ASMANG20: @_Z1fPU3AS4i
54// NOASMANG20: @_Z1fPU9CLgenerici
55// OCL-20-DAG: @_Z1fPU3AS4i
56#endif
57