brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · c38d3ed Raw
32 lines · plain
1// RUN: %clang_cc1 %s -triple "spir64-unknown-unknown" -cl-opt-disable -ffake-address-space-map -emit-llvm -o - | FileCheck %s2 3// CHECK: @array ={{.*}} addrspace({{[0-9]+}}) constant4__constant float array[2] = {0.0f, 1.0f};5 6kernel void test(global float *out) {7  *out = array[0];8}9 10// Test that we don't use directly initializers for const aggregates11// but create a copy in the original address space (unless a variable itself is12// in the constant address space).13 14void foo(constant int* p, constant const int *p1, const int *p2, const int *p3);15// CHECK: @k.arr1 = internal addrspace(2) constant [3 x i32] [i32 1, i32 2, i32 3]16// CHECK: @__const.k.arr2 = private unnamed_addr addrspace(2) constant [3 x i32] [i32 4, i32 5, i32 6]17// CHECK: @__const.k.arr3 = private unnamed_addr addrspace(2) constant [3 x i32] [i32 7, i32 8, i32 9]18// CHECK: @k.var1 = internal addrspace(2) constant i32 119kernel void k(void) {20  // CHECK-NOT: %arr1 = alloca [3 x i32]21  constant const int arr1[] = {1, 2, 3};22  // CHECK: %arr2 = alloca [3 x i32]23  const int arr2[] = {4, 5, 6};24  // CHECK: %arr3 = alloca [3 x i32]25  int arr3[] = {7, 8, 9};26 27  constant int var1 = 1;28  29  // CHECK: call spir_func void @foo(ptr addrspace(2) noundef @k.var1, ptr addrspace(2) noundef @k.arr130  foo(&var1, arr1, arr2, arr3);31}32