1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s --mattr=+mve -o - | FileCheck %s
4 target triple = "thumbv8.1m.main-none-none-eabi"
7 ; Expected to not transform
8 define arm_aapcs_vfpcc <2 x i16> @complex_add_v2i16(<2 x i16> %a, <2 x i16> %b) {
9 ; CHECK-LABEL: complex_add_v2i16:
10 ; CHECK: @ %bb.0: @ %entry
11 ; CHECK-NEXT: vmov r0, s0
12 ; CHECK-NEXT: vmov r1, s6
13 ; CHECK-NEXT: vmov r2, s4
14 ; CHECK-NEXT: add r0, r1
15 ; CHECK-NEXT: vmov r1, s2
16 ; CHECK-NEXT: subs r1, r2, r1
17 ; CHECK-NEXT: vmov q0[2], q0[0], r1, r0
20 %a.real = shufflevector <2 x i16> %a, <2 x i16> zeroinitializer, <1 x i32> <i32 0>
21 %a.imag = shufflevector <2 x i16> %a, <2 x i16> zeroinitializer, <1 x i32> <i32 1>
22 %b.real = shufflevector <2 x i16> %b, <2 x i16> zeroinitializer, <1 x i32> <i32 0>
23 %b.imag = shufflevector <2 x i16> %b, <2 x i16> zeroinitializer, <1 x i32> <i32 1>
24 %0 = sub <1 x i16> %b.real, %a.imag
25 %1 = add <1 x i16> %b.imag, %a.real
26 %interleaved.vec = shufflevector <1 x i16> %0, <1 x i16> %1, <2 x i32> <i32 0, i32 1>
27 ret <2 x i16> %interleaved.vec
30 ; Expected to not transform
31 define arm_aapcs_vfpcc <4 x i16> @complex_add_v4i16(<4 x i16> %a, <4 x i16> %b) {
32 ; CHECK-LABEL: complex_add_v4i16:
33 ; CHECK: @ %bb.0: @ %entry
34 ; CHECK-NEXT: vrev64.32 q2, q0
35 ; CHECK-NEXT: vmov r1, s6
36 ; CHECK-NEXT: vmov r0, s10
37 ; CHECK-NEXT: vrev64.32 q3, q1
38 ; CHECK-NEXT: vmov r2, s4
39 ; CHECK-NEXT: subs r0, r1, r0
40 ; CHECK-NEXT: vmov r1, s8
41 ; CHECK-NEXT: subs r1, r2, r1
42 ; CHECK-NEXT: vmov r2, s0
43 ; CHECK-NEXT: vmov q2[2], q2[0], r1, r0
44 ; CHECK-NEXT: vmov r0, s14
45 ; CHECK-NEXT: vmov r1, s2
46 ; CHECK-NEXT: add r0, r1
47 ; CHECK-NEXT: vmov r1, s12
48 ; CHECK-NEXT: add r1, r2
49 ; CHECK-NEXT: vmov q2[3], q2[1], r1, r0
50 ; CHECK-NEXT: vmov q0, q2
53 %a.real = shufflevector <4 x i16> %a, <4 x i16> zeroinitializer, <2 x i32> <i32 0, i32 2>
54 %a.imag = shufflevector <4 x i16> %a, <4 x i16> zeroinitializer, <2 x i32> <i32 1, i32 3>
55 %b.real = shufflevector <4 x i16> %b, <4 x i16> zeroinitializer, <2 x i32> <i32 0, i32 2>
56 %b.imag = shufflevector <4 x i16> %b, <4 x i16> zeroinitializer, <2 x i32> <i32 1, i32 3>
57 %0 = sub <2 x i16> %b.real, %a.imag
58 %1 = add <2 x i16> %b.imag, %a.real
59 %interleaved.vec = shufflevector <2 x i16> %0, <2 x i16> %1, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
60 ret <4 x i16> %interleaved.vec
63 ; Expected to transform
64 define arm_aapcs_vfpcc <8 x i16> @complex_add_v8i16(<8 x i16> %a, <8 x i16> %b) {
65 ; CHECK-LABEL: complex_add_v8i16:
66 ; CHECK: @ %bb.0: @ %entry
67 ; CHECK-NEXT: vcadd.i16 q0, q1, q0, #90
70 %a.real = shufflevector <8 x i16> %a, <8 x i16> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
71 %a.imag = shufflevector <8 x i16> %a, <8 x i16> zeroinitializer, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
72 %b.real = shufflevector <8 x i16> %b, <8 x i16> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
73 %b.imag = shufflevector <8 x i16> %b, <8 x i16> zeroinitializer, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
74 %0 = sub <4 x i16> %b.real, %a.imag
75 %1 = add <4 x i16> %b.imag, %a.real
76 %interleaved.vec = shufflevector <4 x i16> %0, <4 x i16> %1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
77 ret <8 x i16> %interleaved.vec
80 ; Expected to transform
81 define arm_aapcs_vfpcc <16 x i16> @complex_add_v16i16(<16 x i16> %a, <16 x i16> %b) {
82 ; CHECK-LABEL: complex_add_v16i16:
83 ; CHECK: @ %bb.0: @ %entry
84 ; CHECK-NEXT: vcadd.i16 q0, q2, q0, #90
85 ; CHECK-NEXT: vcadd.i16 q1, q3, q1, #90
88 %a.real = shufflevector <16 x i16> %a, <16 x i16> zeroinitializer, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
89 %a.imag = shufflevector <16 x i16> %a, <16 x i16> zeroinitializer, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>
90 %b.real = shufflevector <16 x i16> %b, <16 x i16> zeroinitializer, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
91 %b.imag = shufflevector <16 x i16> %b, <16 x i16> zeroinitializer, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>
92 %0 = sub <8 x i16> %b.real, %a.imag
93 %1 = add <8 x i16> %b.imag, %a.real
94 %interleaved.vec = shufflevector <8 x i16> %0, <8 x i16> %1, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
95 ret <16 x i16> %interleaved.vec
98 ; Expected to transform
99 define arm_aapcs_vfpcc <32 x i16> @complex_add_v32i16(<32 x i16> %a, <32 x i16> %b) {
100 ; CHECK-LABEL: complex_add_v32i16:
101 ; CHECK: @ %bb.0: @ %entry
102 ; CHECK-NEXT: .vsave {d8, d9}
103 ; CHECK-NEXT: vpush {d8, d9}
104 ; CHECK-NEXT: add r0, sp, #16
105 ; CHECK-NEXT: vldrw.u32 q4, [r0]
106 ; CHECK-NEXT: add r0, sp, #32
107 ; CHECK-NEXT: vcadd.i16 q0, q4, q0, #90
108 ; CHECK-NEXT: vldrw.u32 q4, [r0]
109 ; CHECK-NEXT: add r0, sp, #48
110 ; CHECK-NEXT: vcadd.i16 q1, q4, q1, #90
111 ; CHECK-NEXT: vldrw.u32 q4, [r0]
112 ; CHECK-NEXT: add r0, sp, #64
113 ; CHECK-NEXT: vcadd.i16 q2, q4, q2, #90
114 ; CHECK-NEXT: vldrw.u32 q4, [r0]
115 ; CHECK-NEXT: vcadd.i16 q3, q4, q3, #90
116 ; CHECK-NEXT: vpop {d8, d9}
119 %a.real = shufflevector <32 x i16> %a, <32 x i16> zeroinitializer, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
120 %a.imag = shufflevector <32 x i16> %a, <32 x i16> zeroinitializer, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
121 %b.real = shufflevector <32 x i16> %b, <32 x i16> zeroinitializer, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
122 %b.imag = shufflevector <32 x i16> %b, <32 x i16> zeroinitializer, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
123 %0 = sub <16 x i16> %b.real, %a.imag
124 %1 = add <16 x i16> %b.imag, %a.real
125 %interleaved.vec = shufflevector <16 x i16> %0, <16 x i16> %1, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
126 ret <32 x i16> %interleaved.vec