62 lines · plain
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py2// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fenable-matrix -emit-llvm -disable-llvm-optzns -o - %s | FileCheck %s3 4// Check that we correctly deal with placeholder expressions.5 6typedef double double4x2 __attribute__((matrix_type(4, 2)));7typedef double double2x4 __attribute__((matrix_type(2, 4)));8 9__attribute__((objc_root_class))10@interface DoubleMatrixValue11@property double4x2 value;12@end13 14void test_transpose_placeholder_get(DoubleMatrixValue *m, double2x4 *r) {15 16 *r = __builtin_matrix_transpose(m.value);17}18 19typedef unsigned u3x4 __attribute__((matrix_type(3, 4)));20typedef unsigned u4x3 __attribute__((matrix_type(4, 3)));21 22__attribute__((objc_root_class))23@interface UnsignedMatrixValue24@property u3x4 value;25@end26 27void 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 PtrValue34@property unsigned *value;35@end36 37__attribute__((objc_root_class))38@interface IntValue39@property int value;40@end41 42void 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_msgSend45 // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i6446 // CHECK: [[PTR:%.*]] = call ptr @objc_msgSend47 // 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 52void 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_msgSend55 // CHECK: [[PTR:%.*]] = call ptr @objc_msgSend56 // CHECK: [[IDX:%.*]] = call i32 @objc_msgSend57 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i6458 // 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}62