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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s --mattr=+mve.fp,+fp64 -o - | FileCheck %s
target triple = "thumbv8.1m.main-none-none-eabi"
; Expected to transform
define arm_aapcs_vfpcc <4 x float> @simple_mul(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: simple_mul:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vcmul.f32 q2, q0, q1, #0
; CHECK-NEXT: vcmla.f32 q2, q0, q1, #90
; CHECK-NEXT: vmov q0, q2
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec17 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec19 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec20 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fmul fast <2 x float> %strided.vec20, %strided.vec
%1 = fmul fast <2 x float> %strided.vec19, %strided.vec17
%2 = fadd fast <2 x float> %1, %0
%3 = fmul fast <2 x float> %strided.vec19, %strided.vec
%4 = fmul fast <2 x float> %strided.vec17, %strided.vec20
%5 = fsub fast <2 x float> %3, %4
%interleaved.vec = shufflevector <2 x float> %5, <2 x float> %2, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to not transform
define arm_aapcs_vfpcc <4 x float> @simple_mul_no_contract(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: simple_mul_no_contract:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .vsave {d8, d9, d10, d11}
; CHECK-NEXT: vpush {d8, d9, d10, d11}
; CHECK-NEXT: vmov.f32 s8, s5
; CHECK-NEXT: vmov.f32 s12, s1
; CHECK-NEXT: vmov.f32 s9, s7
; CHECK-NEXT: vmov.f32 s13, s3
; CHECK-NEXT: vmov.f32 s1, s2
; CHECK-NEXT: vmul.f32 q4, q3, q2
; CHECK-NEXT: vmov.f32 s5, s6
; CHECK-NEXT: vmul.f32 q2, q2, q0
; CHECK-NEXT: vmul.f32 q5, q1, q0
; CHECK-NEXT: vfma.f32 q2, q1, q3
; CHECK-NEXT: vsub.f32 q4, q5, q4
; CHECK-NEXT: vmov.f32 s1, s8
; CHECK-NEXT: vmov.f32 s0, s16
; CHECK-NEXT: vmov.f32 s2, s17
; CHECK-NEXT: vmov.f32 s3, s9
; CHECK-NEXT: vpop {d8, d9, d10, d11}
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec17 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec19 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec20 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fmul fast <2 x float> %strided.vec20, %strided.vec
%1 = fmul fast <2 x float> %strided.vec19, %strided.vec17
%2 = fadd fast <2 x float> %1, %0
%3 = fmul fast <2 x float> %strided.vec19, %strided.vec
%4 = fmul fast <2 x float> %strided.vec17, %strided.vec20
%5 = fsub <2 x float> %3, %4
%interleaved.vec = shufflevector <2 x float> %5, <2 x float> %2, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to transform
define arm_aapcs_vfpcc <4 x float> @three_way_mul(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
; CHECK-LABEL: three_way_mul:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vcmul.f32 q3, q1, q0, #0
; CHECK-NEXT: vcmla.f32 q3, q1, q0, #90
; CHECK-NEXT: vcmul.f32 q0, q2, q3, #0
; CHECK-NEXT: vcmla.f32 q0, q2, q3, #90
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec39 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec41 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec42 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec44 = shufflevector <4 x float> %c, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec45 = shufflevector <4 x float> %c, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fmul fast <2 x float> %strided.vec41, %strided.vec
%1 = fmul fast <2 x float> %strided.vec42, %strided.vec39
%2 = fsub fast <2 x float> %0, %1
%3 = fmul fast <2 x float> %2, %strided.vec45
%4 = fmul fast <2 x float> %strided.vec42, %strided.vec
%5 = fmul fast <2 x float> %strided.vec39, %strided.vec41
%6 = fadd fast <2 x float> %4, %5
%7 = fmul fast <2 x float> %6, %strided.vec44
%8 = fadd fast <2 x float> %3, %7
%9 = fmul fast <2 x float> %2, %strided.vec44
%10 = fmul fast <2 x float> %6, %strided.vec45
%11 = fsub fast <2 x float> %9, %10
%interleaved.vec = shufflevector <2 x float> %11, <2 x float> %8, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to transform
define arm_aapcs_vfpcc <4 x float> @simple_add_90(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: simple_add_90:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vcadd.f32 q2, q1, q0, #90
; CHECK-NEXT: vmov q0, q2
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec17 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec19 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec20 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fsub fast <2 x float> %strided.vec19, %strided.vec17
%1 = fadd fast <2 x float> %strided.vec20, %strided.vec
%interleaved.vec = shufflevector <2 x float> %0, <2 x float> %1, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to not transform, fadd commutativity is not yet implemented
define arm_aapcs_vfpcc <4 x float> @simple_add_270_false(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: simple_add_270_false:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vmov.f32 s8, s4
; CHECK-NEXT: vmov.f32 s12, s1
; CHECK-NEXT: vmov.f32 s4, s5
; CHECK-NEXT: vmov.f32 s9, s6
; CHECK-NEXT: vmov.f32 s13, s3
; CHECK-NEXT: vmov.f32 s1, s2
; CHECK-NEXT: vsub.f32 q2, q3, q2
; CHECK-NEXT: vmov.f32 s5, s7
; CHECK-NEXT: vadd.f32 q1, q1, q0
; CHECK-NEXT: vmov.f32 s1, s8
; CHECK-NEXT: vmov.f32 s0, s4
; CHECK-NEXT: vmov.f32 s2, s5
; CHECK-NEXT: vmov.f32 s3, s9
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec17 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec19 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec20 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fadd fast <2 x float> %strided.vec20, %strided.vec
%1 = fsub fast <2 x float> %strided.vec17, %strided.vec19
%interleaved.vec = shufflevector <2 x float> %0, <2 x float> %1, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to transform
define arm_aapcs_vfpcc <4 x float> @simple_add_270_true(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: simple_add_270_true:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vcadd.f32 q2, q0, q1, #270
; CHECK-NEXT: vmov q0, q2
; CHECK-NEXT: bx lr
entry:
%strided.vec = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec17 = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%strided.vec19 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%strided.vec20 = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fadd fast <2 x float> %strided.vec, %strided.vec20
%1 = fsub fast <2 x float> %strided.vec17, %strided.vec19
%interleaved.vec = shufflevector <2 x float> %0, <2 x float> %1, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to not transform
define arm_aapcs_vfpcc <4 x float> @add_external_use(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: add_external_use:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vmov.f32 s8, s4
; CHECK-NEXT: vmov.f32 s12, s1
; CHECK-NEXT: vmov.f32 s4, s5
; CHECK-NEXT: vmov.f32 s9, s6
; CHECK-NEXT: vmov.f32 s13, s3
; CHECK-NEXT: vmov.f32 s5, s7
; CHECK-NEXT: vadd.f32 q2, q3, q2
; CHECK-NEXT: vmov.f32 s1, s2
; CHECK-NEXT: vsub.f32 q1, q0, q1
; CHECK-NEXT: vmov.f32 s1, s8
; CHECK-NEXT: vmov.f32 s0, s4
; CHECK-NEXT: vmov.f32 s2, s5
; CHECK-NEXT: vmov.f32 s3, s9
; CHECK-NEXT: bx lr
entry:
%a.real = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%a.imag = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%b.real = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%b.imag = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fsub fast <2 x float> %a.real, %b.imag
%1 = fadd fast <2 x float> %a.imag, %b.real
%interleaved.vec = shufflevector <2 x float> %0, <2 x float> %1, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
%dup = shufflevector <2 x float> %0, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
%interleaved.vec2 = shufflevector <4 x float> %interleaved.vec, <4 x float> %dup, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
ret <4 x float> %interleaved.vec2
}
define arm_aapcs_vfpcc <4 x float> @mul_mul_with_fneg(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: mul_mul_with_fneg:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vcmul.f32 q2, q1, q0, #270
; CHECK-NEXT: vcmla.f32 q2, q1, q0, #180
; CHECK-NEXT: vmov q0, q2
; CHECK-NEXT: bx lr
entry:
%a.real = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%a.imag = shufflevector <4 x float> %a, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%b.real = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 0, i32 2>
%b.imag = shufflevector <4 x float> %b, <4 x float> poison, <2 x i32> <i32 1, i32 3>
%0 = fneg fast <2 x float> %a.imag
%1 = fmul fast <2 x float> %b.real, %0
%2 = fmul fast <2 x float> %a.real, %b.imag
%3 = fsub fast <2 x float> %1, %2
%4 = fmul fast <2 x float> %b.imag, %a.imag
%5 = fmul fast <2 x float> %a.real, %b.real
%6 = fsub fast <2 x float> %4, %5
%interleaved.vec = shufflevector <2 x float> %6, <2 x float> %3, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
ret <4 x float> %interleaved.vec
}
; Expected to not transform
define arm_aapcs_vfpcc <12 x float> @abp90c12(<12 x float> %a, <12 x float> %b, <12 x float> %c) {
; CHECK-LABEL: abp90c12:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: .pad #48
; CHECK-NEXT: sub sp, #48
; CHECK-NEXT: vldr s23, [sp, #124]
; CHECK-NEXT: vmov.f32 s20, s13
; CHECK-NEXT: vldr s22, [sp, #116]
; CHECK-NEXT: vmov.f32 s25, s11
; CHECK-NEXT: vmov.f32 s13, s10
; CHECK-NEXT: vldr s19, [sp, #120]
; CHECK-NEXT: vmov.f32 s11, s6
; CHECK-NEXT: vldr s18, [sp, #112]
; CHECK-NEXT: vmov.f32 s6, s5
; CHECK-NEXT: vldr s31, [sp, #172]
; CHECK-NEXT: vmov.f32 s10, s4
; CHECK-NEXT: vldr s30, [sp, #164]
; CHECK-NEXT: vmov.f32 s21, s15
; CHECK-NEXT: vldr s29, [sp, #156]
; CHECK-NEXT: vmov.f32 s5, s3
; CHECK-NEXT: vldr s28, [sp, #148]
; CHECK-NEXT: vmov.f32 s4, s1
; CHECK-NEXT: vmov.f32 s24, s9
; CHECK-NEXT: vmov.f32 s16, s12
; CHECK-NEXT: vstrw.32 q6, [sp, #16] @ 16-byte Spill
; CHECK-NEXT: vmov.f32 s12, s8
; CHECK-NEXT: vldr s27, [sp, #168]
; CHECK-NEXT: vmov.f32 s17, s14
; CHECK-NEXT: vldr s26, [sp, #160]
; CHECK-NEXT: vmov.f32 s9, s2
; CHECK-NEXT: vldr s25, [sp, #152]
; CHECK-NEXT: vmov.f32 s8, s0
; CHECK-NEXT: vmul.f32 q0, q5, q1
; CHECK-NEXT: vmul.f32 q1, q4, q1
; CHECK-NEXT: vneg.f32 q0, q0
; CHECK-NEXT: vldr s24, [sp, #144]
; CHECK-NEXT: vfma.f32 q1, q5, q2
; CHECK-NEXT: vstrw.32 q0, [sp] @ 16-byte Spill
; CHECK-NEXT: vstrw.32 q3, [sp, #32] @ 16-byte Spill
; CHECK-NEXT: vsub.f32 q6, q6, q1
; CHECK-NEXT: vldrw.u32 q1, [sp] @ 16-byte Reload
; CHECK-NEXT: vldr s13, [sp, #140]
; CHECK-NEXT: vfma.f32 q1, q4, q2
; CHECK-NEXT: vldr s12, [sp, #132]
; CHECK-NEXT: vadd.f32 q1, q7, q1
; CHECK-NEXT: vldrw.u32 q7, [sp, #16] @ 16-byte Reload
; CHECK-NEXT: vldr s1, [sp, #136]
; CHECK-NEXT: vstrw.32 q3, [sp, #16] @ 16-byte Spill
; CHECK-NEXT: vmul.f32 q2, q3, q7
; CHECK-NEXT: vldr s0, [sp, #128]
; CHECK-NEXT: vldrw.u32 q3, [sp, #32] @ 16-byte Reload
; CHECK-NEXT: vneg.f32 q2, q2
; CHECK-NEXT: vldr s21, [sp, #184]
; CHECK-NEXT: vfma.f32 q2, q0, q3
; CHECK-NEXT: vmul.f32 q0, q0, q7
; CHECK-NEXT: vldrw.u32 q7, [sp, #16] @ 16-byte Reload
; CHECK-NEXT: vldr s20, [sp, #176]
; CHECK-NEXT: vldr s17, [sp, #188]
; CHECK-NEXT: vldr s16, [sp, #180]
; CHECK-NEXT: vfma.f32 q0, q7, q3
; CHECK-NEXT: vsub.f32 q3, q5, q0
; CHECK-NEXT: vmov.f32 s1, s4
; CHECK-NEXT: vadd.f32 q4, q4, q2
; CHECK-NEXT: vmov.f32 s3, s5
; CHECK-NEXT: vmov.f32 s5, s6
; CHECK-NEXT: vmov.f32 s0, s24
; CHECK-NEXT: vmov.f32 s2, s25
; CHECK-NEXT: vmov.f32 s4, s26
; CHECK-NEXT: vmov.f32 s6, s27
; CHECK-NEXT: vmov.f32 s8, s12
; CHECK-NEXT: vmov.f32 s9, s16
; CHECK-NEXT: vmov.f32 s10, s13
; CHECK-NEXT: vmov.f32 s11, s17
; CHECK-NEXT: add sp, #48
; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: bx lr
entry:
%ar = shufflevector <12 x float> %a, <12 x float> poison, <6 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10>
%ai = shufflevector <12 x float> %a, <12 x float> poison, <6 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11>
%br = shufflevector <12 x float> %b, <12 x float> poison, <6 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10>
%bi = shufflevector <12 x float> %b, <12 x float> poison, <6 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11>
%cr = shufflevector <12 x float> %c, <12 x float> poison, <6 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10>
%ci = shufflevector <12 x float> %c, <12 x float> poison, <6 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11>
%i6 = fmul fast <6 x float> %br, %ar
%i7 = fmul fast <6 x float> %bi, %ai
%xr = fsub fast <6 x float> %i6, %i7
%i9 = fmul fast <6 x float> %bi, %ar
%i10 = fmul fast <6 x float> %br, %ai
%xi = fadd fast <6 x float> %i9, %i10
%zr = fsub fast <6 x float> %cr, %xi
%zi = fadd fast <6 x float> %ci, %xr
%interleaved.vec = shufflevector <6 x float> %zr, <6 x float> %zi, <12 x i32> <i32 0, i32 6, i32 1, i32 7, i32 2, i32 8, i32 3, i32 9, i32 4, i32 10, i32 5, i32 11>
ret <12 x float> %interleaved.vec
}
|