| 1 | // RUN: %clang_cc1 -emit-llvm -triple "spir-unknown-unknown" -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,SPIR %s |
| 2 | // RUN: %clang_cc1 -emit-llvm -triple amdgcn-amd-amdhsa -O0 -cl-std=CL2.0 -o - %s | FileCheck -check-prefixes=CHECK,AMDGCN %s |
| 3 | |
| 4 | constant int sz0 = 5; |
| 5 | // SPIR: @sz0 = addrspace(2) constant i32 5 |
| 6 | // AMDGCN: @sz0 = addrspace(4) constant i32 5 |
| 7 | const global int sz1 = 16; |
| 8 | // CHECK: @sz1 = addrspace(1) constant i32 16 |
| 9 | const constant int sz2 = 8; |
| 10 | // SPIR: @sz2 = addrspace(2) constant i32 8 |
| 11 | // AMDGCN: @sz2 = addrspace(4) constant i32 8 |
| 12 | // CHECK: @testvla.vla2 = internal addrspace(3) global [8 x i16] undef |
| 13 | |
| 14 | kernel void testvla() |
| 15 | { |
| 16 | int vla0[sz0]; |
| 17 | // SPIR: %vla0 = alloca [5 x i32] |
| 18 | // SPIR-NOT: %vla0 = alloca [5 x i32]{{.*}}addrspace |
| 19 | // AMDGCN: %vla0 = alloca [5 x i32]{{.*}}addrspace(5) |
| 20 | char vla1[sz1]; |
| 21 | // SPIR: %vla1 = alloca [16 x i8] |
| 22 | // SPIR-NOT: %vla1 = alloca [16 x i8]{{.*}}addrspace |
| 23 | // AMDGCN: %vla1 = alloca [16 x i8]{{.*}}addrspace(5) |
| 24 | local short vla2[sz2]; |
| 25 | } |
| 26 | |