| 1 |
//RUN: %clang_cc1 %s -triple spir -emit-llvm -O0 -o - | FileCheck %s |
| 2 |
|
| 3 |
typedef int int2 __attribute__((ext_vector_type(2))); |
| 4 |
typedef int int4 __attribute__((ext_vector_type(4))); |
| 5 |
typedef long long2 __attribute__((ext_vector_type(2))); |
| 6 |
|
| 7 |
//CHECK-LABEL: define{{.*}} spir_func void @_Z3barPU3AS1Dv2_i |
| 8 |
void bar(global int2 *in) { |
| 9 |
//CHECK: bitcast <2 x i32> %{{[0-9]+}} to i64 |
| 10 |
auto l = reinterpret_cast<long>(in[0]); |
| 11 |
//CHECK: bitcast i64 %{{[0-9]+}} to <2 x i32> |
| 12 |
auto i2 = reinterpret_cast<int2>(l); |
| 13 |
|
| 14 |
__private short s1; |
| 15 |
// CHECK: %{{[0-9]+}} = load i16, ptr %s1, align 2 |
| 16 |
// CHECK-NEXT: store i16 %{{[0-9]+}}, ptr %s2, align 2 |
| 17 |
auto s2 = reinterpret_cast<__private short>(s1); |
| 18 |
// CHECK: %{{[0-9]+}} = load i16, ptr %s1, align 2 |
| 19 |
// CHECK-NEXT: store i16 %{{[0-9]+}}, ptr %s3, align 2 |
| 20 |
auto s3 = reinterpret_cast<decltype(s1)>(s1); |
| 21 |
// CHECK: %{{[0-9]+}} = load i16, ptr %s1, align 2 |
| 22 |
// CHECK-NEXT: store i16 %{{[0-9]+}}, ptr %s4, align 2 |
| 23 |
auto s4 = reinterpret_cast<__global short>(s1); |
| 24 |
|
| 25 |
int4 i4; |
| 26 |
//CHECK: bitcast <4 x i32> %{{[0-9]+}} to <2 x i64> |
| 27 |
auto l2 = reinterpret_cast<long2>(i4); |
| 28 |
} |