1; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s 2 3define <4 x float> @transpose(<4 x float> %m, i32 %arg) { 4; CHECK: assembly parsed, but does not verify as correct! 5; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 6; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 7; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 8; CHECK-NEXT: immarg operand has non-immediate parameter 9; CHECK-NEXT: i32 %arg 10; CHECK-NEXT: %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2) 11; CHECK-NEXT: immarg operand has non-immediate parameter 12; CHECK-NEXT: i32 %arg 13; CHECK-NEXT: %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg) 14 %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %m, i32 0, i32 0) 15 %result.1 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.0, i32 3, i32 2) 16 %result.2 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.1, i32 2, i32 1) 17 %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2) 18 %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg) 19 ret <4 x float> %result.4 20} 21 22define <4 x float> @multiply(<4 x float> %m, i32 %arg) { 23; CHECK-NEXT: First argument of a matrix operation does not match specified shape! 24; CHECK-NEXT: First argument of a matrix operation does not match specified shape! 25; CHECK-NEXT: Second argument of a matrix operation does not match specified shape! 26; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 27; CHECK-NEXT: immarg operand has non-immediate parameter 28; CHECK-NEXT: i32 %arg 29; CHECK-NEXT: %result.4 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.2, <4 x float> %m, i32 %arg, i32 2, i32 1) 30 %result.0 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %m, <4 x float> %m, i32 0, i32 0, i32 0) 31 %result.1 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.0, <4 x float> %m, i32 3, i32 2, i32 2) 32 %result.2 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.1, <4 x float> %m, i32 2, i32 2, i32 1) 33 %result.3 = call <3 x float> @llvm.matrix.multiply.v3f32.v4f32.v4f32(<4 x float> %result.2, <4 x float> %m, i32 2, i32 2, i32 2) 34 %result.4 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.2, <4 x float> %m, i32 %arg, i32 2, i32 1) 35 ret <4 x float> %result.4 36} 37 38define <4 x float> @column.major_load(ptr %m, ptr %n, i32 %arg) { 39; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 40; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 41; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 42; CHECK-NEXT: immarg operand has non-immediate parameter 43; CHECK-NEXT: i32 %arg 44; CHECK-NEXT: %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr %n, i64 2, i1 true, i32 3, i32 %arg) 45 %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 0, i1 false, i32 0, i32 0) 46 %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 2, i1 false, i32 1, i32 2) 47 %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr %n, i64 2, i1 true, i32 3, i32 3) 48 %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr %n, i64 2, i1 true, i32 3, i32 %arg) 49 ret <4 x float> %result.1 50} 51 52define void @column.major_store(ptr %m, ptr %n, i64 %arg) { 53; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 54; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 55; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 56; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! 57 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 0, i1 false, i32 0, i32 0) 58 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 2, i1 false, i32 1, i32 2) 59 call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, ptr %n, i64 2, i1 false, i32 3, i32 3) 60 call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, ptr %n, i64 %arg, i1 false, i32 3, i32 3) 61 ret void 62} 63 64define <4 x float> @transpose_mixed_types(<4 x float> %fvec, <4 x i32> %ivec, i32 %arg) { 65; 66; CHECK-NEXT: Intrinsic has incorrect argument type! 67; CHECK-NEXT: ptr @llvm.matrix.transpose.v4f32.v4i32 68; CHECK-NEXT: Intrinsic has incorrect argument type! 69; CHECK-NEXT: ptr @llvm.matrix.transpose.v4i32.v4f32 70; 71 %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32> %ivec, i32 0, i32 0) 72 %result.1 = call <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float> %result.0, i32 3, i32 2) 73 ret <4 x float> %result.0 74} 75 76define <4 x float> @multiply_mixed_types(<4 x i32> %ivec, <4 x float> %fvec, i32 %arg) { 77; 78; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! 79; CHECK-NEXT: ptr @llvm.matrix.multiply.v4i32.v4f32.v4f32 80; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! 81; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4i32.v4f32 82; CHECK-NEXT: Vector element type mismatch of the result and second operand vector! 83; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4f32.v4i32 84; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! 85; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4i32.v4i32 86; 87 %result.0 = call <4 x i32> @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float> %fvec, <4 x float> %fvec, i32 2, i32 2, i32 2) 88 %result.1 = call <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32> %result.0, <4 x float> %fvec, i32 2, i32 2, i32 2) 89 %result.2 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float> %fvec, <4 x i32> %ivec, i32 2, i32 2, i32 2) 90 %result.3 = call <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32> %ivec, <4 x i32> %ivec, i32 2, i32 2, i32 2) 91 ret <4 x float> %result.3 92} 93 94define void @column.major_store_non_int_float_type(ptr %m, ptr %n, i64 %arg) { 95; 96; CHECK-NEXT: Result type must be an integer or floating-point type! 97; CHECK-NEXT: ptr @llvm.matrix.column.major.store.v4p0.i64 98; 99 call void @llvm.matrix.column.major.store.v4p0.i64(<4 x ptr> zeroinitializer, ptr %n, i64 2, i1 false, i32 2, i32 2) 100 ret void 101} 102 103define <4 x float> @column.major_load_stride_too_small(ptr %m, i32 %arg) { 104; 105; CHECK-NEXT: Stride must be greater or equal than the number of rows! 106; CHECK-NEXT: ptr @llvm.matrix.column.major.load.v4f32.i64 107; 108 %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 1, i1 false, i32 2, i32 2) 109 ret <4 x float> %result.1 110} 111 112define void @column.major_store_stride_too_small(ptr %m, i64 %arg) { 113; 114; CHECK-NEXT: Stride must be greater or equal than the number of rows! 115; CHECK-NEXT: ptr @llvm.matrix.column.major.store.v4f32.i64 116; 117 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 1, i1 false, i32 2, i32 2) 118 ret void 119} 120 121declare <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr, i64, i1, i32, i32) 122declare <4 x float> @llvm.matrix.column.major.load.v4f32.p0(ptr, i64, i1, i32, i32) 123declare <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr, i64, i1, i32, i32) 124declare <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr, i64, i1, i32, i32) 125 126declare void @llvm.matrix.column.major.store.v4f32.i64(<4 x float>, ptr, i64, i1, i32, i32) 127declare void @llvm.matrix.column.major.store.v6f32.i64(<6 x float>, ptr, i64, i1, i32, i32) 128declare void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32>, ptr, i64, i1, i32, i32) 129declare void @llvm.matrix.column.major.store.v4f32.p0(<4 x float>, ptr, i64, i1, i32, i32) 130declare void @llvm.matrix.column.major.store.v4p0.i64(<4 x ptr>, ptr, i64, i1, i32, i32) 131 132declare <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float>, i32, i32) 133declare <4 x float> @llvm.matrix.transpose.v4f32(<4 x float>, i32, i32) 134declare <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32>, i32, i32) 135 136declare <4 x i32> @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) 137declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32>, <4 x float>, i32, i32, i32) 138declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float>, <4 x i32>, i32, i32, i32) 139declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32) 140declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) 141declare <3 x float> @llvm.matrix.multiply.v3f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) 142