|
1 | | -// RUN: %clang_cc1 -triple x86_64-- -emit-llvm -x c %s -o - \ |
| 1 | +// RUN: %clang_cc1 -x c -triple x86_64-- -emit-llvm -x c %s -o - \ |
2 | 2 | // RUN: | FileCheck %s --check-prefix=X86 |
3 | | -// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 3 | +// RUN: %clang_cc1 -x c -triple amdgcn-amd-amdhsa -emit-llvm -x c %s -o - \ |
4 | 4 | // RUN: | FileCheck %s --check-prefix=AMDGCN |
5 | | -// RUN: %clang_cc1 -triple spirv64-- -emit-llvm -x c %s -o - \ |
| 5 | +// RUN: %clang_cc1 -x c -triple spirv64-- -emit-llvm -x c %s -o - \ |
6 | 6 | // RUN: | FileCheck %s --check-prefix=SPIRV |
7 | | -// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 7 | +// RUN: %clang_cc1 -x c -triple spirv64-amd-amdhsa -emit-llvm -x c %s -o - \ |
8 | 8 | // RUN: | FileCheck %s --check-prefix=SPIRV_AMD |
| 9 | +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -triple x86_64-- -emit-llvm -x c %s -o - \ |
| 10 | +// RUN: | FileCheck %s --check-prefix=X86 |
| 11 | +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -triple amdgcn-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 12 | +// RUN: | FileCheck %s --check-prefix=AMDGCN |
| 13 | +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -triple spirv64-- -emit-llvm -x c %s -o - \ |
| 14 | +// RUN: | FileCheck %s --check-prefix=SPIRV_CL |
| 15 | +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -triple spirv64-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 16 | +// RUN: | FileCheck %s --check-prefix=SPIRV_AMD_CL |
| 17 | +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 -triple x86_64-- -emit-llvm -x c %s -o - \ |
| 18 | +// RUN: | FileCheck %s --check-prefix=X86 |
| 19 | +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 -triple amdgcn-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 20 | +// RUN: | FileCheck %s --check-prefix=AMDGCN |
| 21 | +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 -triple spirv64-- -emit-llvm -x c %s -o - \ |
| 22 | +// RUN: | FileCheck %s --check-prefix=SPIRV_CL |
| 23 | +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 -triple spirv64-amd-amdhsa -emit-llvm -x c %s -o - \ |
| 24 | +// RUN: | FileCheck %s --check-prefix=SPIRV_AMD_CL |
9 | 25 |
|
10 | | -static __attribute__((__used__)) int foo = 42; |
| 26 | +#ifndef __OPENCL_C_VERSION__ |
| 27 | +#define __constant const |
| 28 | +#endif |
11 | 29 |
|
| 30 | +static __constant __attribute__((__used__)) int foo = 42; |
12 | 31 |
|
13 | | -// X86: @foo = internal global i32 42, align 4 |
| 32 | + |
| 33 | +// X86: @foo = internal constant i32 42 |
14 | 34 | // X86: @llvm.compiler.used = appending global [2 x ptr] [ptr @foo, ptr @bar], section "llvm.metadata" |
15 | | -//. |
16 | | -// AMDGCN: @foo = internal addrspace(1) global i32 42, align 4 |
17 | | -// AMDGCN: @llvm.compiler.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(1) @foo to ptr), ptr @bar], section "llvm.metadata" |
18 | | -//. |
19 | | -// SPIRV: @foo = internal global i32 42, align 4 |
| 35 | +// |
| 36 | +// AMDGCN: @foo = internal addrspace(4) constant i32 42 |
| 37 | +// AMDGCN: @llvm.compiler.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(4) @foo to ptr), ptr @bar], section "llvm.metadata" |
| 38 | +// |
| 39 | +// SPIRV: @foo = internal constant i32 42 |
20 | 40 | // SPIRV: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr @foo, ptr @bar], section "llvm.metadata" |
21 | | -//. |
22 | | -// SPIRV_AMD: @foo = internal addrspace(1) global i32 42, align 4 |
| 41 | +// |
| 42 | +// SPIRV_CL: @foo = internal addrspace(2) constant i32 42 |
| 43 | +// SPIRV_CL: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(2) @foo to ptr), ptr @bar], section "llvm.metadata" |
| 44 | +// |
| 45 | +// SPIRV_AMD: @foo = internal addrspace(1) constant i32 42 |
23 | 46 | // SPIRV_AMD: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(1) @foo to ptr), ptr addrspacecast (ptr addrspace(4) @bar to ptr)], section "llvm.metadata" |
24 | | -//. |
25 | | -// X86-LABEL: define internal void @bar( |
26 | | -// X86-SAME: ) #[[ATTR0:[0-9]+]] { |
27 | 47 | // |
28 | | -// AMDGCN-LABEL: define internal void @bar( |
29 | | -// AMDGCN-SAME: ) #[[ATTR0:[0-9]+]] { |
| 48 | +// SPIRV_AMD_CL: @foo = internal addrspace(2) constant i32 42 |
| 49 | +// SPIRV_AMD_CL: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(2) @foo to ptr), ptr addrspacecast (ptr addrspace(4) @bar to ptr)], section "llvm.metadata" |
| 50 | +// |
| 51 | +// X86: define internal void @bar() #{{[0-9]}} { |
| 52 | +// |
| 53 | +// AMDGCN: define internal void @bar() #{{[0-9]}} { |
| 54 | +// |
| 55 | +// SPIRV: define internal spir_func void @bar() #{{[0-9]}} { |
| 56 | +// |
| 57 | +// SPIRV_CL: define internal spir_func void @bar() #{{[0-9]}} { |
30 | 58 | // |
31 | | -// SPIRV-LABEL: define internal spir_func void @bar( |
32 | | -// SPIRV-SAME: ) #[[ATTR0:[0-9]+]] { |
| 59 | +// SPIRV_AMD: define internal spir_func void @bar() addrspace(4) #{{[0-9]}} { |
33 | 60 | // |
34 | | -// SPIRV_AMD-LABEL: define internal spir_func void @bar( |
35 | | -// SPIRV_AMD-SAME: ) addrspace(4) #[[ATTR0:[0-9]+]] { |
| 61 | +// SPIRV_AMD_CL: define internal spir_func void @bar() addrspace(4) #{{[0-9]}} { |
36 | 62 | // |
37 | 63 | static void __attribute__((__used__)) bar() { |
38 | 64 | } |
0 commit comments