| // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -fenable-matrix -emit-llvm -disable-llvm-optzns -o - %s | FileCheck %s |
| |
| // Check that we correctly deal with placeholder expressions. |
| |
| typedef double double4x2 __attribute__((matrix_type(4, 2))); |
| typedef double double2x4 __attribute__((matrix_type(2, 4))); |
| |
| __attribute__((objc_root_class)) |
| @interface DoubleMatrixValue |
| @property double4x2 value; |
| @end |
| |
| void test_transpose_placeholder_get(DoubleMatrixValue *m, double2x4 *r) { |
| |
| *r = __builtin_matrix_transpose(m.value); |
| } |
| |
| typedef unsigned u3x4 __attribute__((matrix_type(3, 4))); |
| typedef unsigned u4x3 __attribute__((matrix_type(4, 3))); |
| |
| __attribute__((objc_root_class)) |
| @interface UnsignedMatrixValue |
| @property u3x4 value; |
| @end |
| |
| void test_transpose_placeholder_set(UnsignedMatrixValue *m, u4x3 *r) { |
| |
| m.value = __builtin_matrix_transpose(*r); |
| } |
| |
| __attribute__((objc_root_class)) |
| @interface PtrValue |
| @property unsigned *value; |
| @end |
| |
| __attribute__((objc_root_class)) |
| @interface IntValue |
| @property int value; |
| @end |
| |
| void test_column_major_load(PtrValue *Ptr, IntValue *Stride) { |
| // CHECK-LABEL: define{{.*}} void @test_column_major_load(%2* noundef %Ptr, %3* noundef %Stride) #4 { |
| // CHECK: [[STRIDE:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) |
| // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 |
| // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) |
| // CHECK-NEXT: call <12 x i32> @llvm.matrix.column.major.load.v12i32.i64(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 3, i32 4) |
| |
| u3x4 m = __builtin_matrix_column_major_load(Ptr.value, 3, 4, Stride.value); |
| } |
| |
| void test_column_major_store(UnsignedMatrixValue *M, PtrValue *Ptr, IntValue *Stride) { |
| // CHECK-LABEL: define{{.*}} void @test_column_major_store(%1* noundef %M, %2* noundef %Ptr, %3* noundef %Stride) #3 { |
| // CHECK: [[M:%.*]] = call <12 x i32> bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to <12 x i32> (i8*, i8*)*) |
| // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) |
| // CHECK: [[IDX:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) |
| // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i64 |
| // CHECK-NEXT: call void @llvm.matrix.column.major.store.v12i32.i64(<12 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 3, i32 4) |
| |
| __builtin_matrix_column_major_store(M.value, Ptr.value, Stride.value); |
| } |