diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
| commit | 45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch) | |
| tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/CodeGenOpenCL | |
| parent | 7e86edd64bfae4e324224452e4ea879b3371a4bd (diff) | |
Notes
Diffstat (limited to 'test/CodeGenOpenCL')
| -rw-r--r-- | test/CodeGenOpenCL/address-spaces.cl | 54 | ||||
| -rw-r--r-- | test/CodeGenOpenCL/bool_cast.cl | 27 |
2 files changed, 64 insertions, 17 deletions
diff --git a/test/CodeGenOpenCL/address-spaces.cl b/test/CodeGenOpenCL/address-spaces.cl index e030c77d3e01..68fa02dadb26 100644 --- a/test/CodeGenOpenCL/address-spaces.cl +++ b/test/CodeGenOpenCL/address-spaces.cl @@ -1,27 +1,47 @@ -// RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefix=CL20 -void f__p(__private int *arg) { } -// CHECK: i32* nocapture %arg +// CHECK: i32* %arg +void f__p(__private int *arg) {} -void f__g(__global int *arg) { } -// CHECK: i32 addrspace(1)* nocapture %arg +// CHECK: i32 addrspace(1)* %arg +void f__g(__global int *arg) {} -void f__l(__local int *arg) { } -// CHECK: i32 addrspace(2)* nocapture %arg +// CHECK: i32 addrspace(2)* %arg +void f__l(__local int *arg) {} -void f__c(__constant int *arg) { } -// CHECK: i32 addrspace(3)* nocapture %arg +// CHECK: i32 addrspace(3)* %arg +void f__c(__constant int *arg) {} +// CHECK: i32* %arg +void fp(private int *arg) {} -void fp(private int *arg) { } -// CHECK: i32* nocapture %arg +// CHECK: i32 addrspace(1)* %arg +void fg(global int *arg) {} -void fg(global int *arg) { } -// CHECK: i32 addrspace(1)* nocapture %arg +// CHECK: i32 addrspace(2)* %arg +void fl(local int *arg) {} -void fl(local int *arg) { } -// CHECK: i32 addrspace(2)* nocapture %arg +// CHECK: i32 addrspace(3)* %arg +void fc(constant int *arg) {} -void fc(constant int *arg) { } -// CHECK: i32 addrspace(3)* nocapture %arg +#ifdef CL20 +int i; +// CL20-DAG: @i = common addrspace(1) global i32 0 +int *ptr; +// CL20-DAG: @ptr = common addrspace(1) global i32 addrspace(4)* null +#endif +// CHECK: i32* %arg +// CL20-DAG: i32 addrspace(4)* %arg +void f(int *arg) { + + int i; +// CHECK: %i = alloca i32, +// CL20-DAG: %i = alloca i32, + +#ifdef CL20 + static int ii; +// CL20-DAG: @f.ii = internal addrspace(1) global i32 0 +#endif +} diff --git a/test/CodeGenOpenCL/bool_cast.cl b/test/CodeGenOpenCL/bool_cast.cl new file mode 100644 index 000000000000..d63431b1b7ca --- /dev/null +++ b/test/CodeGenOpenCL/bool_cast.cl @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -O0 | FileCheck %s + +typedef unsigned char uchar4 __attribute((ext_vector_type(4))); +typedef unsigned int int4 __attribute((ext_vector_type(4))); + +void kernel ker() { + bool t = true; + int4 vec4 = (int4)t; +// CHECK: {{%.*}} = load i8, i8* %t, align 1 +// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1 +// CHECK: {{%.*}} = sext i1 {{%.*}} to i32 +// CHECK: {{%.*}} = insertelement <4 x i32> undef, i32 {{%.*}}, i32 0 +// CHECK: {{%.*}} = shufflevector <4 x i32> {{%.*}}, <4 x i32> undef, <4 x i32> zeroinitializer +// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* %vec4, align 16 + int i = (int)t; +// CHECK: {{%.*}} = load i8, i8* %t, align 1 +// CHECK: {{%.*}} = trunc i8 {{%.*}} to i1 +// CHECK: {{%.*}} = zext i1 {{%.*}} to i32 +// CHECK: store i32 {{%.*}}, i32* %i, align 4 + + uchar4 vc; + vc = (uchar4)true; +// CHECK: store <4 x i8> <i8 -1, i8 -1, i8 -1, i8 -1>, <4 x i8>* %vc, align 4 + unsigned char c; + c = (unsigned char)true; +// CHECK: store i8 1, i8* %c, align 1 +} |
