159 lines · plain
1; RUN: not opt -S %s 2>&1 | FileCheck %s2 3define <4 x float> @transpose(<4 x float> %m, i32 %arg) {4; CHECK: Result of a matrix operation does not fit in the returned vector!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: immarg operand has non-immediate parameter8; CHECK-NEXT: i32 %arg9; CHECK-NEXT: %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2)10; CHECK-NEXT: immarg operand has non-immediate parameter11; CHECK-NEXT: i32 %arg12; CHECK-NEXT: %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg)13 %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %m, i32 0, i32 0)14 %result.1 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.0, i32 3, i32 2)15 %result.2 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.1, i32 2, i32 1)16 %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2)17 %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg)18 ret <4 x float> %result.419}20 21define <4 x float> @multiply(<4 x float> %m, i32 %arg) {22; CHECK-NEXT: First argument of a matrix operation does not match specified shape!23; CHECK-NEXT: First argument of a matrix operation does not match specified shape!24; CHECK-NEXT: Second argument of a matrix operation does not match specified shape!25; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!26; CHECK-NEXT: immarg operand has non-immediate parameter27; CHECK-NEXT: i32 %arg28; 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)29 %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)30 %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)31 %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)32 %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)33 %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)34 ret <4 x float> %result.435}36 37define <4 x float> @column.major_load(ptr %m, ptr %n, i32 %arg) {38; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!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: immarg operand has non-immediate parameter42; CHECK-NEXT: i32 %arg43; 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)44 %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 0, i1 false, i32 0, i32 0)45 %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 2, i1 false, i32 1, i32 2)46 %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr %n, i64 2, i1 true, i32 3, i32 3)47 %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr %n, i64 2, i1 true, i32 3, i32 %arg)48 ret <4 x float> %result.149}50 51define void @column.major_store(ptr %m, ptr %n, i64 %arg) {52; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!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 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 0, i1 false, i32 0, i32 0)57 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 2, i1 false, i32 1, i32 2)58 call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, ptr %n, i64 2, i1 false, i32 3, i32 3)59 call void @llvm.matrix.column.major.store.v6f32.i64(<6 x float> zeroinitializer, ptr %n, i64 %arg, i1 false, i32 3, i32 3)60 ret void61}62 63define <4 x float> @transpose_mixed_types(<4 x float> %fvec, <4 x i32> %ivec, i32 %arg) {64;65; CHECK-NEXT: Intrinsic has incorrect argument type!66; CHECK-NEXT: ptr @llvm.matrix.transpose.v4f32.v4i3267; CHECK-NEXT: Intrinsic has incorrect argument type!68; CHECK-NEXT: ptr @llvm.matrix.transpose.v4i32.v4f3269;70 %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32> %ivec, i32 0, i32 0)71 %result.1 = call <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float> %result.0, i32 3, i32 2)72 ret <4 x float> %result.073}74 75define <4 x float> @multiply_mixed_types(<4 x i32> %ivec, <4 x float> %fvec, i32 %arg) {76;77; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!78; CHECK-NEXT: ptr @llvm.matrix.multiply.v4i32.v4f32.v4f3279; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!80; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4i32.v4f3281; CHECK-NEXT: Vector element type mismatch of the result and second operand vector!82; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4f32.v4i3283; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!84; CHECK-NEXT: ptr @llvm.matrix.multiply.v4f32.v4i32.v4i3285;86 %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)87 %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)88 %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)89 %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)90 ret <4 x float> %result.391}92 93define void @column.major_store_non_int_float_type(ptr %m, ptr %n, i64 %arg) {94;95; CHECK-NEXT: Result type must be an integer or floating-point type!96; CHECK-NEXT: ptr @llvm.matrix.column.major.store.v4p0.i6497;98 call void @llvm.matrix.column.major.store.v4p0.i64(<4 x ptr> zeroinitializer, ptr %n, i64 2, i1 false, i32 2, i32 2)99 ret void100}101 102define <4 x float> @column.major_load_stride_too_small(ptr %m, i32 %arg) {103;104; CHECK-NEXT: Stride must be greater or equal than the number of rows!105; CHECK-NEXT: ptr @llvm.matrix.column.major.load.v4f32.i64106;107 %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr %m, i64 1, i1 false, i32 2, i32 2)108 ret <4 x float> %result.1109}110 111define void @column.major_store_stride_too_small(ptr %m, i64 %arg) {112;113; CHECK-NEXT: Stride must be greater or equal than the number of rows!114; CHECK-NEXT: ptr @llvm.matrix.column.major.store.v4f32.i64115;116 call void @llvm.matrix.column.major.store.v4f32.i64(<4 x float> zeroinitializer, ptr %m, i64 1, i1 false, i32 2, i32 2)117 ret void118}119 120define <4 x float> @column.major_load_stride_i128(ptr %m, i32 %arg) {121; CHECK-NEXT: Stride bitwidth cannot exceed 64!122; CHECK-NEXT: ptr @llvm.matrix.column.major.load.v4f32.i128123 %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32.i128(ptr %m, i128 u0x10000000000000000, i1 false, i32 2, i32 2)124 ret <4 x float> %result.1125}126 127define void @column.major_store_stride_i128(ptr %m, i64 %arg) {128; CHECK-NEXT: Stride bitwidth cannot exceed 64!129; CHECK-NEXT: ptr @llvm.matrix.column.major.store.v4f32.i128130 call void @llvm.matrix.column.major.store.v4f32.i128(<4 x float> zeroinitializer, ptr %m, i128 u0x10000000000000000, i1 false, i32 2, i32 2)131 ret void132}133 134declare <4 x i32> @llvm.matrix.column.major.load.v4i32.i64(ptr, i64, i1, i32, i32)135declare <4 x float> @llvm.matrix.column.major.load.v4f32.p0(ptr, i64, i1, i32, i32)136declare <4 x float> @llvm.matrix.column.major.load.v4f32.i64(ptr, i64, i1, i32, i32)137declare <6 x float> @llvm.matrix.column.major.load.v6f32.i64(ptr, i64, i1, i32, i32)138declare <6 x float> @llvm.matrix.column.major.load.v6f32.i8(ptr, i8, i1, i32, i32)139declare <6 x float> @llvm.matrix.column.major.load.v6f32.i128(ptr, i28, i1, i32, i32)140 141declare void @llvm.matrix.column.major.store.v4f32.i64(<4 x float>, ptr, i64, i1, i32, i32)142declare void @llvm.matrix.column.major.store.v6f32.i64(<6 x float>, ptr, i64, i1, i32, i32)143declare void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32>, ptr, i64, i1, i32, i32)144declare void @llvm.matrix.column.major.store.v4f32.p0(<4 x float>, ptr, i64, i1, i32, i32)145declare void @llvm.matrix.column.major.store.v4p0.i64(<4 x ptr>, ptr, i64, i1, i32, i32)146declare void @llvm.matrix.column.major.store.v4p0.i8(<4 x ptr>, ptr, i8, i1, i32, i32)147declare void @llvm.matrix.column.major.store.v4p0.i128(<4 x ptr>, ptr, i128, i1, i32, i32)148 149declare <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float>, i32, i32)150declare <4 x float> @llvm.matrix.transpose.v4f32(<4 x float>, i32, i32)151declare <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32>, i32, i32)152 153declare <4 x i32> @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32)154declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32>, <4 x float>, i32, i32, i32)155declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float>, <4 x i32>, i32, i32, i32)156declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32)157declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32)158declare <3 x float> @llvm.matrix.multiply.v3f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32)159