From a2d37a51846fc748833b744076098a5ea002ab00 Mon Sep 17 00:00:00 2001 From: David Tweed Date: Thu, 10 Jan 2013 10:42:08 +0000 Subject: [PATCH] r172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified version of a test by Joey Gouly to use attributes to materialise the unsupported types and test vector shifts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172053 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenOpenCL/shifts.cl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/CodeGenOpenCL/shifts.cl b/test/CodeGenOpenCL/shifts.cl index 51be668ae0..015a77711a 100644 --- a/test/CodeGenOpenCL/shifts.cl +++ b/test/CodeGenOpenCL/shifts.cl @@ -26,3 +26,32 @@ long positiveShift64(long a,long b) { //CHECK-NEXT: ret i64 [[E64]] return e; } + +typedef __attribute__((ext_vector_type(4))) int int4; + +//CHECK: @vectorVectorTest +int4 vectorVectorTest(int4 a,int4 b) { + //CHECK: [[VM:%.+]] = and <4 x i32> %b, + //CHECK-NEXT: [[VC:%.+]] = shl <4 x i32> %a, [[VM]] + int4 c = a << b; + //CHECK-NEXT: [[VF:%.+]] = add <4 x i32> [[VC]], + int4 d = {1, 1, 1, 1}; + int4 e = {33, 34, -28, -29}; + int4 f = c + (d << e); + //CHECK-NEXT: ret <4 x i32> [[VF]] + return f; +} + +//CHECK: @vectorScalarTest +int4 vectorScalarTest(int4 a,int b) { + //CHECK: [[SP0:%.+]] = insertelement <4 x i32> undef, i32 %b, i32 0 + //CHECK: [[SP1:%.+]] = shufflevector <4 x i32> [[SP0]], <4 x i32> undef, <4 x i32> zeroinitializer + //CHECK: [[VSM:%.+]] = and <4 x i32> [[SP1]], + //CHECK-NEXT: [[VSC:%.+]] = shl <4 x i32> %a, [[VSM]] + int4 c = a << b; + //CHECK-NEXT: [[VSF:%.+]] = add <4 x i32> [[VSC]], + int4 d = {1, 1, 1, 1}; + int4 f = c + (d << 34); + //CHECK-NEXT: ret <4 x i32> [[VSF]] + return f; +} -- 2.50.1