Skip to content

Commit 9b82500

Browse files
committed
[Review] Add OpenCL 1.2 and 2.0 test cases
1 parent 3330535 commit 9b82500

File tree

1 file changed

+48
-22
lines changed

1 file changed

+48
-22
lines changed
Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,64 @@
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 - \
22
// 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 - \
44
// 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 - \
66
// 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 - \
88
// 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
925

10-
static __attribute__((__used__)) int foo = 42;
26+
#ifndef __OPENCL_C_VERSION__
27+
#define __constant const
28+
#endif
1129

30+
static __constant __attribute__((__used__)) int foo = 42;
1231

13-
// X86: @foo = internal global i32 42, align 4
32+
33+
// X86: @foo = internal constant i32 42
1434
// 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
2040
// 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
2346
// 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]+]] {
2747
//
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]}} {
3058
//
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]}} {
3360
//
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]}} {
3662
//
3763
static void __attribute__((__used__)) bar() {
3864
}

0 commit comments

Comments
 (0)