blob: d4e24b4f051ba4f544c289962b0f250d4a8879d2 [file] [log] [blame]
Yaxun Liuc8acb4f2016-08-04 19:35:17 +00001// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn--amdhsa %s | FileCheck --check-prefix=AMDGCN %s
2// RUN: %clang_cc1 -emit-llvm -o - -triple spir-unknown-unknown %s | FileCheck --check-prefix=SPIR %s
3
4#ifdef __AMDGCN__
5
6constant int* convert(image2d_t img) {
Yaxun Liu651bd732018-02-13 18:01:21 +00007 // AMDGCN: bitcast %opencl.image2d_ro_t addrspace(4)* %img to i32 addrspace(4)*
Yaxun Liuc8acb4f2016-08-04 19:35:17 +00008 return __builtin_astype(img, constant int*);
9}
10
11#else
12
13global int* convert(image2d_t img) {
14 // SPIR: bitcast %opencl.image2d_ro_t addrspace(1)* %img to i32 addrspace(1)*
15 return __builtin_astype(img, global int*);
16}
17
18#endif