Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 1 | ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s |
| 2 | |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 3 | define <4 x float> @transpose(<4 x float> %m, i32 %arg) { |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 4 | ; CHECK: assembly parsed, but does not verify as correct! |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 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! |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 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) |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 16 | %result.2 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.1, i32 2, i32 1) |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 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 |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 20 | } |
| 21 | |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 22 | define <4 x float> @multiply(<4 x float> %m, i32 %arg) { |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 23 | ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! |
| 24 | ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! |
| 25 | ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 26 | ; CHECK-NEXT: immarg operand has non-immediate parameter |
| 27 | ; CHECK-NEXT: i32 %arg |
| 28 | ; CHECK-NEXT: %result.3 = 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) |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 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) |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 32 | %result.3 = 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) |
| 33 | ret <4 x float> %result.3 |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 34 | } |
| 35 | |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 36 | define <4 x float> @column.major_load(float* %m, float* %n, i32 %arg) { |
| 37 | ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! |
| 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! |
Sjoerd Meijer | 0fc17e9 | 2020-07-08 17:04:23 +0100 | [diff] [blame] | 40 | ; CHECK-NEXT: immarg operand has non-immediate parameter |
| 41 | ; CHECK-NEXT: i32 %arg |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 42 | ; CHECK-NEXT: %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg) |
| 43 | %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 0, i1 false, i32 0, i32 0) |
| 44 | %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 2, i1 false, i32 1, i32 2) |
| 45 | %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 3) |
| 46 | %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg) |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 47 | ret <4 x float> %result.1 |
| 48 | } |
| 49 | |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 50 | define void @column.major_store(float* %m, float* %n, i64 %arg) { |
| 51 | ; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector! |
| 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 | call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 0, i1 false, i32 0, i32 0) |
| 56 | call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 2, i1 false, i32 1, i32 2) |
| 57 | call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 2, i1 false, i32 3, i32 3) |
| 58 | call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 %arg, i1 false, i32 3, i32 3) |
Florian Hahn | 862766e | 2020-04-01 09:10:24 +0100 | [diff] [blame] | 59 | ret void |
| 60 | } |
Sjoerd Meijer | 2b3c505 | 2020-07-14 11:01:05 +0100 | [diff] [blame] | 61 | |
| 62 | define <4 x float> @transpose_mixed_types(<4 x float> %fvec, <4 x i32> %ivec, i32 %arg) { |
| 63 | ; |
| 64 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 65 | ; CHECK-NEXT: <4 x float> (<4 x i32>, i32, i32)* @llvm.matrix.transpose.v4f32.v4i32 |
| 66 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 67 | ; CHECK-NEXT: <4 x i32> (<4 x float>, i32, i32)* @llvm.matrix.transpose.v4i32.v4f32 |
| 68 | ; |
| 69 | %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32> %ivec, i32 0, i32 0) |
| 70 | %result.1 = call <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float> %result.0, i32 3, i32 2) |
| 71 | ret <4 x float> %result.0 |
| 72 | } |
| 73 | |
| 74 | define <4 x float> @multiply_mixed_types(<4 x i32> %ivec, <4 x float> %fvec, i32 %arg) { |
| 75 | ; |
| 76 | ; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! |
| 77 | ; CHECK-NEXT: <4 x i32> (<4 x float>, <4 x float>, i32, i32, i32)* @llvm.matrix.multiply.v4i32.v4f32.v4f32 |
| 78 | ; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! |
| 79 | ; CHECK-NEXT: <4 x float> (<4 x i32>, <4 x float>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4i32.v4f32 |
| 80 | ; CHECK-NEXT: Vector element type mismatch of the result and second operand vector! |
| 81 | ; CHECK-NEXT: <4 x float> (<4 x float>, <4 x i32>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4f32.v4i32 |
| 82 | ; CHECK-NEXT: Vector element type mismatch of the result and first operand vector! |
| 83 | ; CHECK-NEXT: <4 x float> (<4 x i32>, <4 x i32>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4i32.v4i32 |
| 84 | ; |
| 85 | %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) |
| 86 | %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) |
| 87 | %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) |
| 88 | %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) |
| 89 | ret <4 x float> %result.3 |
| 90 | } |
| 91 | |
| 92 | define <4 x float> @column.major_load_mixed_types(i32* %m, float* %n, i32 %arg) { |
| 93 | ; |
| 94 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 95 | ; CHECK-NEXT: <4 x float> (i32*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4f32.pi32 |
| 96 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 97 | ; CHECK-NEXT: <4 x i32> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4i32 |
| 98 | ; |
| 99 | %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.pi32(i32* %m, i64 2, i1 false, i32 2, i32 2) |
| 100 | %result.1 = call <4 x i32> @llvm.matrix.column.major.load.v4i32(float* %n, i64 2, i1 false, i32 2, i32 2) |
| 101 | ret <4 x float> %result.0 |
| 102 | } |
| 103 | |
| 104 | define void @column.major_store_mixed_types(float* %m, i32* %n, i64 %arg) { |
| 105 | ; |
| 106 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 107 | ; CHECK-NEXT: void (<4 x i32>, float*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4i32.vi32 |
| 108 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 109 | ; CHECK-NEXT: void (<4 x float>, i32*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32.pi32 |
| 110 | ; |
| 111 | call void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32> zeroinitializer, float* %m, i64 2, i1 false, i32 2, i32 2) |
| 112 | call void @llvm.matrix.column.major.store.v4f32.pi32(<4 x float> zeroinitializer, i32* %n, i64 2, i1 false, i32 2, i32 2) |
| 113 | ret void |
| 114 | } |
| 115 | |
| 116 | define void @column.major_store_non_int_float_type(<4 x float>* %m, <4 x float>* %n, i64 %arg) { |
| 117 | ; |
| 118 | ; CHECK-NEXT: Intrinsic has incorrect argument type! |
| 119 | ; CHECK-NEXT: void (<4 x float*>, <4 x float>*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32p0.p0v4f32 |
| 120 | ; |
| 121 | call void @llvm.matrix.column.major.store.v4f32p0.p0v4f32(<4 x float*> zeroinitializer, <4 x float>* %n, i64 2, i1 false, i32 2, i32 2) |
| 122 | ret void |
| 123 | } |
| 124 | |
| 125 | define <4 x float> @column.major_load_stride_too_small(float* %m, i32 %arg) { |
| 126 | ; |
| 127 | ; CHECK-NEXT: Stride must be greater or equal than the number of rows! |
| 128 | ; CHECK-NEXT: <4 x float> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4f32 |
| 129 | ; |
| 130 | %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 1, i1 false, i32 2, i32 2) |
| 131 | ret <4 x float> %result.1 |
| 132 | } |
| 133 | |
| 134 | define void @column.major_store_stride_too_small(float* %m, i64 %arg) { |
| 135 | ; |
| 136 | ; CHECK-NEXT: Stride must be greater or equal than the number of rows! |
| 137 | ; CHECK-NEXT: void (<4 x float>, float*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32 |
| 138 | ; |
| 139 | call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 1, i1 false, i32 2, i32 2) |
| 140 | ret void |
| 141 | } |
| 142 | |
| 143 | declare <4 x i32> @llvm.matrix.column.major.load.v4i32(float*, i64, i1, i32, i32) |
| 144 | declare <4 x float> @llvm.matrix.column.major.load.v4f32.pi32(i32*, i64, i1, i32, i32) |
| 145 | declare <4 x float> @llvm.matrix.column.major.load.v4f32(float*, i64, i1, i32, i32) |
| 146 | declare <6 x float> @llvm.matrix.column.major.load.v6f32(float*, i64, i1, i32, i32) |
| 147 | |
| 148 | declare void @llvm.matrix.column.major.store.v4f32(<4 x float>, float*, i64, i1, i32, i32) |
| 149 | declare void @llvm.matrix.column.major.store.v6f32(<6 x float>, float*, i64, i1, i32, i32) |
| 150 | declare void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32>, float*, i64, i1, i32, i32) |
| 151 | declare void @llvm.matrix.column.major.store.v4f32.pi32(<4 x float>, i32*, i64, i1, i32, i32) |
| 152 | declare void @llvm.matrix.column.major.store.v4f32p0.p0v4f32(<4 x float*>, <4 x float>*, i64, i1, i32, i32) |
| 153 | |
| 154 | declare <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float>, i32, i32) |
| 155 | declare <4 x float> @llvm.matrix.transpose.v4f32(<4 x float>, i32, i32) |
| 156 | declare <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32>, i32, i32) |
| 157 | |
| 158 | declare <4 x i32> @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) |
| 159 | declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32>, <4 x float>, i32, i32, i32) |
| 160 | declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float>, <4 x i32>, i32, i32, i32) |
| 161 | declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32) |
| 162 | declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32) |