Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGenOpenCL / overload.cl
blob589ab0a6fd3c267bce7e9bc842a491ad60f8ecec
1 // RUN: %clang_cc1 -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown %s | FileCheck %s
2 // RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space -emit-llvm -o - -triple spir-unknown-unknown %s | FileCheck %s
4 typedef short short4 __attribute__((ext_vector_type(4)));
6 // CHECK-DAG: declare spir_func <4 x i16> @_Z5clampDv4_sS_S_(<4 x i16> noundef, <4 x i16> noundef, <4 x i16> noundef)
7 short4 __attribute__ ((overloadable)) clamp(short4 x, short4 minval, short4 maxval);
8 // CHECK-DAG: declare spir_func <4 x i16> @_Z5clampDv4_sss(<4 x i16> noundef, i16 noundef signext, i16 noundef signext)
9 short4 __attribute__ ((overloadable)) clamp(short4 x, short minval, short maxval);
10 void __attribute__((overloadable)) foo(global int *a, global int *b);
11 void __attribute__((overloadable)) foo(generic int *a, generic int *b);
12 void __attribute__((overloadable)) bar(generic int *global *a, generic int *global *b);
13 void __attribute__((overloadable)) bar(generic int *generic *a, generic int *generic *b);
15 // Checking address space resolution
16 void kernel test1() {
17 global int *a = 0;
18 global int *b = 0;
19 generic int *c = 0;
20 local int *d = 0;
21 generic int *generic *gengen = 0;
22 generic int *local *genloc = 0;
23 generic int *global *genglob = 0;
24 // CHECK-DAG: call spir_func void @_Z3fooPU3AS1iS0_(ptr addrspace(1) noundef {{.*}}, ptr addrspace(1) noundef {{.*}})
25 foo(a, b);
26 // CHECK-DAG: call spir_func void @_Z3fooPU3AS4iS0_(ptr addrspace(4) noundef {{.*}}, ptr addrspace(4) noundef {{.*}})
27 foo(b, c);
28 // CHECK-DAG: call spir_func void @_Z3fooPU3AS4iS0_(ptr addrspace(4) noundef {{.*}}, ptr addrspace(4) noundef {{.*}})
29 foo(a, d);
31 // CHECK-DAG: call spir_func void @_Z3barPU3AS4PU3AS4iS2_(ptr addrspace(4) noundef {{.*}}, ptr addrspace(4) noundef {{.*}})
32 bar(gengen, genloc);
33 // CHECK-DAG: call spir_func void @_Z3barPU3AS4PU3AS4iS2_(ptr addrspace(4) noundef {{.*}}, ptr addrspace(4) noundef {{.*}})
34 bar(gengen, genglob);
35 // CHECK-DAG: call spir_func void @_Z3barPU3AS1PU3AS4iS2_(ptr addrspace(1) noundef {{.*}}, ptr addrspace(1) noundef {{.*}})
36 bar(genglob, genglob);
39 // Checking vector vs scalar resolution
40 void kernel test2() {
41 short4 e0=0;
43 // CHECK-DAG: call spir_func <4 x i16> @_Z5clampDv4_sss(<4 x i16> noundef {{.*}}, i16 noundef signext 0, i16 noundef signext 255)
44 clamp(e0, 0, 255);
45 // CHECK-DAG: call spir_func <4 x i16> @_Z5clampDv4_sS_S_(<4 x i16> noundef {{.*}}, <4 x i16> noundef {{.*}}, <4 x i16> noundef {{.*}})
46 clamp(e0, e0, e0);