| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| 2 |
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fenable-matrix -emit-llvm -disable-llvm-optzns -o - %s | FileCheck %s |
| 3 |
|
| 4 |
// Check that we correctly deal with placeholder expressions. |
| 5 |
|
| 6 |
typedef double double4x2 __attribute__((matrix_type(4, 2))); |
| 7 |
typedef double double2x4 __attribute__((matrix_type(2, 4))); |
| 8 |
|
| 9 |
__attribute__((objc_root_class)) |
| 10 |
@interface DoubleMatrixValue |
| 11 |
@property double4x2 value; |
| 12 |
@end |
| 13 |
|
| 14 |
void test_transpose_placeholder_get(DoubleMatrixValue *m, double2x4 *r) { |
| 15 |
|
| 16 |
*r = __builtin_matrix_transpose(m.value); |
| 17 |
} |
| 18 |
|
| 19 |
typedef unsigned u3x4 __attribute__((matrix_type(3, 4))); |
| 20 |
typedef unsigned u4x3 __attribute__((matrix_type(4, 3))); |
| 21 |
|
| 22 |
__attribute__((objc_root_class)) |
| 23 |
@interface UnsignedMatrixValue |
| 24 |
@property u3x4 value; |
| 25 |
@end |
| 26 |
|
| 27 |
void test_transpose_placeholder_set(UnsignedMatrixValue *m, u4x3 *r) { |
| 28 |
|
| 29 |
m.value = __builtin_matrix_transpose(*r); |
| 30 |
} |
| 31 |
|
| 32 |
__attribute__((objc_root_class)) |
| 33 |
@interface PtrValue |
| 34 |
@property unsigned *value; |
| 35 |
@end |
| 36 |
|
| 37 |
__attribute__((objc_root_class)) |
| 38 |
@interface IntValue |
| 39 |
@property int value; |
| 40 |
@end |
| 41 |
|
| 42 |
void test_column_major_load(PtrValue *Ptr, IntValue *Stride) { |
| 43 |
// CHECK-LABEL: define{{.*}} void @test_column_major_load(ptr noundef %Ptr, ptr noundef %Stride) #4 { |
| 44 |
// CHECK: [[STRIDE:%.*]] = call i32 @objc_msgSend |
| 45 |
// CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 |
| 46 |
// CHECK: [[PTR:%.*]] = call ptr @objc_msgSend |
| 47 |
// CHECK-NEXT: call <12 x i32> @llvm.matrix.column.major.load.v12i32.i64(ptr align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 3, i32 4) |
| 48 |
|
| 49 |
u3x4 m = __builtin_matrix_column_major_load(Ptr.value, 3, 4, Stride.value); |
| 50 |
} |
| 51 |
|
| 52 |
void test_column_major_store(UnsignedMatrixValue *M, PtrValue *Ptr, IntValue *Stride) { |
| 53 |
// CHECK-LABEL: define{{.*}} void @test_column_major_store(ptr noundef %M, ptr noundef %Ptr, ptr noundef %Stride) #3 { |
| 54 |
// CHECK: [[M:%.*]] = call <12 x i32> @objc_msgSend |
| 55 |
// CHECK: [[PTR:%.*]] = call ptr @objc_msgSend |
| 56 |
// CHECK: [[IDX:%.*]] = call i32 @objc_msgSend |
| 57 |
// CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i64 |
| 58 |
// CHECK-NEXT: call void @llvm.matrix.column.major.store.v12i32.i64(<12 x i32> [[M]], ptr align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 3, i32 4) |
| 59 |
|
| 60 |
__builtin_matrix_column_major_store(M.value, Ptr.value, Stride.value); |
| 61 |
} |