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 6typedef double double4x2 __attribute__((matrix_type(4, 2))); 7typedef double double2x4 __attribute__((matrix_type(2, 4))); 8 9__attribute__((objc_root_class)) 10@interface DoubleMatrixValue 11@property double4x2 value; 12@end 13 14void test_transpose_placeholder_get(DoubleMatrixValue *m, double2x4 *r) { 15 // CHECK-LABEL: define{{.*}} void @test_transpose_placeholder_get( 16 // CHECK: [[MATRIX:%.*]] = call <8 x double> bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to <8 x double> (i8*, i8*)*)( 17 // CHECK-NEXT: [[MT:%.*]] = call <8 x double> @llvm.matrix.transpose.v8f64(<8 x double> %call, i32 4, i32 2) 18 // CHECK-NEXT: [[R_ADDR:%.*]] = load [8 x double]*, [8 x double]** %r.addr, align 8 19 // CHECK-NEXT: [[R_ADDR_C:%.*]] = bitcast [8 x double]* [[R_ADDR]] to <8 x double>* 20 // CHECK-NEXT: store <8 x double> [[MT]], <8 x double>* [[R_ADDR_C]], align 8 21 // CHECK-NEXT: ret void 22 23 *r = __builtin_matrix_transpose(m.value); 24} 25 26typedef unsigned u3x4 __attribute__((matrix_type(3, 4))); 27typedef unsigned u4x3 __attribute__((matrix_type(4, 3))); 28 29__attribute__((objc_root_class)) 30@interface UnsignedMatrixValue 31@property u3x4 value; 32@end 33 34void test_transpose_placeholder_set(UnsignedMatrixValue *m, u4x3 *r) { 35 // CHECK-LABEL: define{{.*}} void @test_transpose_placeholder_set( 36 // CHECK: [[MATRIX:%.*]] = load <12 x i32>, <12 x i32>* {{.*}}, align 4 37 // CHECK-NEXT: [[MT:%.*]] = call <12 x i32> @llvm.matrix.transpose.v12i32(<12 x i32> [[MATRIX]], i32 4, i32 3) 38 // CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, <12 x i32>)*)(i8* {{.*}}, i8* {{.*}}, <12 x i32> [[MT]]) 39 // CHECK-NEXT: ret void 40 41 m.value = __builtin_matrix_transpose(*r); 42} 43 44__attribute__((objc_root_class)) 45@interface PtrValue 46@property unsigned *value; 47@end 48 49__attribute__((objc_root_class)) 50@interface IntValue 51@property int value; 52@end 53 54void test_column_major_load(PtrValue *Ptr, IntValue *Stride) { 55 // CHECK-LABEL: define{{.*}} void @test_column_major_load(%2* %Ptr, %3* %Stride) #4 { 56 // CHECK: [[STRIDE:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) 57 // CHECK-NEXT: [[STRIDE_EXT:%.*]] = sext i32 [[STRIDE]] to i64 58 // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) 59 // CHECK-NEXT: call <12 x i32> @llvm.matrix.column.major.load.v12i32(i32* align 4 [[PTR]], i64 [[STRIDE_EXT]], i1 false, i32 3, i32 4) 60 61 u3x4 m = __builtin_matrix_column_major_load(Ptr.value, 3, 4, Stride.value); 62} 63 64void test_column_major_store(UnsignedMatrixValue *M, PtrValue *Ptr, IntValue *Stride) { 65 // CHECK-LABEL: define{{.*}} void @test_column_major_store(%1* %M, %2* %Ptr, %3* %Stride) #3 { 66 // CHECK: [[M:%.*]] = call <12 x i32> bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to <12 x i32> (i8*, i8*)*) 67 // CHECK: [[PTR:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32* (i8*, i8*)*) 68 // CHECK: [[IDX:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*) 69 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[IDX]] to i64 70 // CHECK-NEXT: call void @llvm.matrix.column.major.store.v12i32(<12 x i32> [[M]], i32* align 4 [[PTR]], i64 [[IDX_EXT]], i1 false, i32 3, i32 4) 71 72 __builtin_matrix_column_major_store(M.value, Ptr.value, Stride.value); 73} 74