xref: /llvm-project/llvm/test/CodeGen/AArch64/complex-deinterleaving-f16-add-scalable.ll (revision 643c38333fc1b1e7e705e6e1035c595bbd95bc74)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s --mattr=+sve -o - | FileCheck %s
3
4target triple = "aarch64"
5
6; Expected to not transform
7define <vscale x 4 x half> @complex_add_v4f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b) {
8; CHECK-LABEL: complex_add_v4f16:
9; CHECK:       // %bb.0: // %entry
10; CHECK-NEXT:    uzp1 z2.s, z0.s, z0.s
11; CHECK-NEXT:    uzp2 z0.s, z0.s, z0.s
12; CHECK-NEXT:    ptrue p0.d
13; CHECK-NEXT:    uzp2 z3.s, z1.s, z0.s
14; CHECK-NEXT:    uzp1 z1.s, z1.s, z0.s
15; CHECK-NEXT:    uunpklo z2.d, z2.s
16; CHECK-NEXT:    uunpklo z0.d, z0.s
17; CHECK-NEXT:    uunpklo z3.d, z3.s
18; CHECK-NEXT:    uunpklo z1.d, z1.s
19; CHECK-NEXT:    fsubr z0.h, p0/m, z0.h, z1.h
20; CHECK-NEXT:    movprfx z1, z3
21; CHECK-NEXT:    fadd z1.h, p0/m, z1.h, z2.h
22; CHECK-NEXT:    zip2 z2.d, z0.d, z1.d
23; CHECK-NEXT:    zip1 z0.d, z0.d, z1.d
24; CHECK-NEXT:    uzp1 z0.s, z0.s, z2.s
25; CHECK-NEXT:    ret
26entry:
27  %a.deinterleaved = tail call { <vscale x 2 x half>, <vscale x 2 x half> } @llvm.vector.deinterleave2.nxv4f16(<vscale x 4 x half> %a)
28  %a.real = extractvalue { <vscale x 2 x half>, <vscale x 2 x half> } %a.deinterleaved, 0
29  %a.imag = extractvalue { <vscale x 2 x half>, <vscale x 2 x half> } %a.deinterleaved, 1
30  %b.deinterleaved = tail call { <vscale x 2 x half>, <vscale x 2 x half> } @llvm.vector.deinterleave2.nxv4f16(<vscale x 4 x half> %b)
31  %b.real = extractvalue { <vscale x 2 x half>, <vscale x 2 x half> } %b.deinterleaved, 0
32  %b.imag = extractvalue { <vscale x 2 x half>, <vscale x 2 x half> } %b.deinterleaved, 1
33  %0 = fsub fast <vscale x 2 x half> %b.real, %a.imag
34  %1 = fadd fast <vscale x 2 x half> %b.imag, %a.real
35  %interleaved.vec = tail call <vscale x 4 x half> @llvm.vector.interleave2.nxv4f16(<vscale x 2 x half> %0, <vscale x 2 x half> %1)
36  ret <vscale x 4 x half> %interleaved.vec
37}
38
39; Expected to transform
40define <vscale x 8 x half> @complex_add_v8f16(<vscale x 8 x half> %a, <vscale x 8 x half> %b) {
41; CHECK-LABEL: complex_add_v8f16:
42; CHECK:       // %bb.0: // %entry
43; CHECK-NEXT:    ptrue p0.h
44; CHECK-NEXT:    fcadd z1.h, p0/m, z1.h, z0.h, #90
45; CHECK-NEXT:    mov z0.d, z1.d
46; CHECK-NEXT:    ret
47entry:
48  %a.deinterleaved = tail call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %a)
49  %a.real = extractvalue { <vscale x 4 x half>, <vscale x 4 x half> } %a.deinterleaved, 0
50  %a.imag = extractvalue { <vscale x 4 x half>, <vscale x 4 x half> } %a.deinterleaved, 1
51  %b.deinterleaved = tail call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %b)
52  %b.real = extractvalue { <vscale x 4 x half>, <vscale x 4 x half> } %b.deinterleaved, 0
53  %b.imag = extractvalue { <vscale x 4 x half>, <vscale x 4 x half> } %b.deinterleaved, 1
54  %0 = fsub fast <vscale x 4 x half> %b.real, %a.imag
55  %1 = fadd fast <vscale x 4 x half> %b.imag, %a.real
56  %interleaved.vec = tail call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %0, <vscale x 4 x half> %1)
57  ret <vscale x 8 x half> %interleaved.vec
58}
59
60; Expected to transform
61define <vscale x 16 x half> @complex_add_v16f16(<vscale x 16 x half> %a, <vscale x 16 x half> %b) {
62; CHECK-LABEL: complex_add_v16f16:
63; CHECK:       // %bb.0: // %entry
64; CHECK-NEXT:    ptrue p0.h
65; CHECK-NEXT:    fcadd z2.h, p0/m, z2.h, z0.h, #90
66; CHECK-NEXT:    fcadd z3.h, p0/m, z3.h, z1.h, #90
67; CHECK-NEXT:    mov z0.d, z2.d
68; CHECK-NEXT:    mov z1.d, z3.d
69; CHECK-NEXT:    ret
70entry:
71  %a.deinterleaved = tail call { <vscale x 8 x half>, <vscale x 8 x half> } @llvm.vector.deinterleave2.nxv16f16(<vscale x 16 x half> %a)
72  %a.real = extractvalue { <vscale x 8 x half>, <vscale x 8 x half> } %a.deinterleaved, 0
73  %a.imag = extractvalue { <vscale x 8 x half>, <vscale x 8 x half> } %a.deinterleaved, 1
74  %b.deinterleaved = tail call { <vscale x 8 x half>, <vscale x 8 x half> } @llvm.vector.deinterleave2.nxv16f16(<vscale x 16 x half> %b)
75  %b.real = extractvalue { <vscale x 8 x half>, <vscale x 8 x half> } %b.deinterleaved, 0
76  %b.imag = extractvalue { <vscale x 8 x half>, <vscale x 8 x half> } %b.deinterleaved, 1
77  %0 = fsub fast <vscale x 8 x half> %b.real, %a.imag
78  %1 = fadd fast <vscale x 8 x half> %b.imag, %a.real
79  %interleaved.vec = tail call <vscale x 16 x half> @llvm.vector.interleave2.nxv16f16(<vscale x 8 x half> %0, <vscale x 8 x half> %1)
80  ret <vscale x 16 x half> %interleaved.vec
81}
82
83; Expected to transform
84define <vscale x 32 x half> @complex_add_v32f16(<vscale x 32 x half> %a, <vscale x 32 x half> %b) {
85; CHECK-LABEL: complex_add_v32f16:
86; CHECK:       // %bb.0: // %entry
87; CHECK-NEXT:    ptrue p0.h
88; CHECK-NEXT:    fcadd z4.h, p0/m, z4.h, z0.h, #90
89; CHECK-NEXT:    fcadd z5.h, p0/m, z5.h, z1.h, #90
90; CHECK-NEXT:    fcadd z6.h, p0/m, z6.h, z2.h, #90
91; CHECK-NEXT:    fcadd z7.h, p0/m, z7.h, z3.h, #90
92; CHECK-NEXT:    mov z0.d, z4.d
93; CHECK-NEXT:    mov z1.d, z5.d
94; CHECK-NEXT:    mov z2.d, z6.d
95; CHECK-NEXT:    mov z3.d, z7.d
96; CHECK-NEXT:    ret
97entry:
98  %a.deinterleaved = tail call { <vscale x 16 x half>, <vscale x 16 x half> } @llvm.vector.deinterleave2.nxv32f16(<vscale x 32 x half> %a)
99  %a.real = extractvalue { <vscale x 16 x half>, <vscale x 16 x half> } %a.deinterleaved, 0
100  %a.imag = extractvalue { <vscale x 16 x half>, <vscale x 16 x half> } %a.deinterleaved, 1
101  %b.deinterleaved = tail call { <vscale x 16 x half>, <vscale x 16 x half> } @llvm.vector.deinterleave2.nxv32f16(<vscale x 32 x half> %b)
102  %b.real = extractvalue { <vscale x 16 x half>, <vscale x 16 x half> } %b.deinterleaved, 0
103  %b.imag = extractvalue { <vscale x 16 x half>, <vscale x 16 x half> } %b.deinterleaved, 1
104  %0 = fsub fast <vscale x 16 x half> %b.real, %a.imag
105  %1 = fadd fast <vscale x 16 x half> %b.imag, %a.real
106  %interleaved.vec = tail call <vscale x 32 x half> @llvm.vector.interleave2.nxv32f16(<vscale x 16 x half> %0, <vscale x 16 x half> %1)
107  ret <vscale x 32 x half> %interleaved.vec
108}
109
110declare { <vscale x 2 x half>, <vscale x 2 x half> } @llvm.vector.deinterleave2.nxv4f16(<vscale x 4 x half>)
111declare <vscale x 4 x half> @llvm.vector.interleave2.nxv4f16(<vscale x 2 x half>, <vscale x 2 x half>)
112
113declare { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half>)
114declare <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half>, <vscale x 4 x half>)
115
116declare { <vscale x 8 x half>, <vscale x 8 x half> } @llvm.vector.deinterleave2.nxv16f16(<vscale x 16 x half>)
117declare <vscale x 16 x half> @llvm.vector.interleave2.nxv16f16(<vscale x 8 x half>, <vscale x 8 x half>)
118
119declare { <vscale x 16 x half>, <vscale x 16 x half> } @llvm.vector.deinterleave2.nxv32f16(<vscale x 32 x half>)
120declare <vscale x 32 x half> @llvm.vector.interleave2.nxv32f16(<vscale x 16 x half>, <vscale x 16 x half>)
121