1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=aarch64-none-linux-gnu < %s -o -| FileCheck %s
define void @matrix_mul_unsigned(i32 %N, i32* nocapture %C, i16* nocapture readonly %A, i16 %val) {
; CHECK-LABEL: matrix_mul_unsigned:
; CHECK: // %bb.0: // %vector.header
; CHECK-NEXT: and w8, w3, #0xffff
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: dup v0.4h, w8
; CHECK-NEXT: and x8, x0, #0xfffffff8
; CHECK-NEXT: .LBB0_1: // %vector.body
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
; CHECK-NEXT: add x9, x2, w0, uxtw #1
; CHECK-NEXT: subs x8, x8, #8
; CHECK-NEXT: ldp d1, d2, [x9]
; CHECK-NEXT: add x9, x1, w0, uxtw #2
; CHECK-NEXT: add w0, w0, #8
; CHECK-NEXT: umull v1.4s, v0.4h, v1.4h
; CHECK-NEXT: umull v2.4s, v0.4h, v2.4h
; CHECK-NEXT: stp q1, q2, [x9]
; CHECK-NEXT: b.ne .LBB0_1
; CHECK-NEXT: // %bb.2: // %for.end12
; CHECK-NEXT: ret
vector.header:
%conv4 = zext i16 %val to i32
%wide.trip.count = zext i32 %N to i64
%0 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %N, 8
%1 = trunc i64 %0 to i32
%2 = icmp ugt i64 %0, 4294967295
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> undef, i32 %conv4, i32 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> undef, i32 %conv4, i32 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> undef, <4 x i32> zeroinitializer
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %vector.body
vector.body: ; preds = %vector.header, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.header ]
%3 = trunc i64 %index to i32
%4 = add i32 %N, %3
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i16, i16* %A, i64 %5
%7 = bitcast i16* %6 to <4 x i16>*
%wide.load = load <4 x i16>, <4 x i16>* %7, align 2
%8 = getelementptr inbounds i16, i16* %6, i64 4
%9 = bitcast i16* %8 to <4 x i16>*
%wide.load30 = load <4 x i16>, <4 x i16>* %9, align 2
%10 = zext <4 x i16> %wide.load to <4 x i32>
%11 = zext <4 x i16> %wide.load30 to <4 x i32>
%12 = mul nuw nsw <4 x i32> %broadcast.splat, %10
%13 = mul nuw nsw <4 x i32> %broadcast.splat32, %11
%14 = getelementptr inbounds i32, i32* %C, i64 %5
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %15, align 4
%16 = getelementptr inbounds i32, i32* %14, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %13, <4 x i32>* %17, align 4
%index.next = add i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %for.end12, label %vector.body
for.end12: ; preds = %vector.body
ret void
}
define void @matrix_mul_signed(i32 %N, i32* nocapture %C, i16* nocapture readonly %A, i16 %val) {
; CHECK-LABEL: matrix_mul_signed:
; CHECK: // %bb.0: // %vector.header
; CHECK-NEXT: sxth w8, w3
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: dup v0.4h, w8
; CHECK-NEXT: and x8, x0, #0xfffffff8
; CHECK-NEXT: .LBB1_1: // %vector.body
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
; CHECK-NEXT: add x9, x2, w0, sxtw #1
; CHECK-NEXT: subs x8, x8, #8
; CHECK-NEXT: ldp d1, d2, [x9]
; CHECK-NEXT: add x9, x1, w0, sxtw #2
; CHECK-NEXT: add w0, w0, #8
; CHECK-NEXT: smull v1.4s, v0.4h, v1.4h
; CHECK-NEXT: smull v2.4s, v0.4h, v2.4h
; CHECK-NEXT: stp q1, q2, [x9]
; CHECK-NEXT: b.ne .LBB1_1
; CHECK-NEXT: // %bb.2: // %for.end12
; CHECK-NEXT: ret
vector.header:
%conv4 = sext i16 %val to i32
%wide.trip.count = sext i32 %N to i64
%0 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %N, 8
%1 = trunc i64 %0 to i32
%2 = icmp ugt i64 %0, 4294967295
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> undef, i32 %conv4, i32 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> undef, i32 %conv4, i32 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> undef, <4 x i32> zeroinitializer
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %vector.body
vector.body: ; preds = %vector.header, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.header ]
%3 = trunc i64 %index to i32
%4 = add i32 %N, %3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i16, i16* %A, i64 %5
%7 = bitcast i16* %6 to <4 x i16>*
%wide.load = load <4 x i16>, <4 x i16>* %7, align 2
%8 = getelementptr inbounds i16, i16* %6, i64 4
%9 = bitcast i16* %8 to <4 x i16>*
%wide.load30 = load <4 x i16>, <4 x i16>* %9, align 2
%10 = sext <4 x i16> %wide.load to <4 x i32>
%11 = sext <4 x i16> %wide.load30 to <4 x i32>
%12 = mul nsw <4 x i32> %broadcast.splat, %10
%13 = mul nsw <4 x i32> %broadcast.splat32, %11
%14 = getelementptr inbounds i32, i32* %C, i64 %5
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %15, align 4
%16 = getelementptr inbounds i32, i32* %14, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %13, <4 x i32>* %17, align 4
%index.next = add i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %for.end12, label %vector.body
for.end12: ; preds = %vector.body
ret void
}
define void @matrix_mul_double_shuffle(i32 %N, i32* nocapture %C, i16* nocapture readonly %A, i16 %val) {
; CHECK-LABEL: matrix_mul_double_shuffle:
; CHECK: // %bb.0: // %vector.header
; CHECK-NEXT: and w8, w3, #0xffff
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: dup v0.4h, w8
; CHECK-NEXT: and x8, x0, #0xfffffff8
; CHECK-NEXT: .LBB2_1: // %vector.body
; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
; CHECK-NEXT: ldrh w9, [x2], #16
; CHECK-NEXT: subs x8, x8, #8
; CHECK-NEXT: dup v1.4h, w9
; CHECK-NEXT: mov w9, w0
; CHECK-NEXT: lsl x9, x9, #2
; CHECK-NEXT: add w0, w0, #8
; CHECK-NEXT: umull v1.4s, v0.4h, v1.4h
; CHECK-NEXT: str q1, [x1, x9]
; CHECK-NEXT: b.ne .LBB2_1
; CHECK-NEXT: // %bb.2: // %for.end12
; CHECK-NEXT: ret
vector.header:
%conv4 = zext i16 %val to i32
%wide.trip.count = zext i32 %N to i64
%0 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %N, 8
%1 = trunc i64 %0 to i32
%2 = icmp ugt i64 %0, 4294967295
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> undef, i32 %conv4, i32 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %vector.body
vector.body: ; preds = %vector.header, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.header ]
%g = getelementptr inbounds i16, i16* %A, i64 %index
%val1 = load i16, i16* %g
%splat.input.ext = zext i16 %val1 to i32
%broadcast.splatinsert31 = insertelement <4 x i32> undef, i32 %splat.input.ext, i32 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> %broadcast.splat, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%3 = trunc i64 %index to i32
%4 = add i32 %N, %3
%5 = zext i32 %4 to i64
%6 = mul nuw nsw <4 x i32> %broadcast.splat, %broadcast.splat32
%7 = getelementptr inbounds i32, i32* %C, i64 %5
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> %6, <4 x i32>* %8, align 4
%index.next = add i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %for.end12, label %vector.body
for.end12: ; preds = %vector.body
ret void
}
|