xref: /llvm-project/llvm/test/CodeGen/AArch64/complex-deinterleaving-f32-add-scalable.ll (revision bfc0317153dca75137fba00b5c28758d6f720963)
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 transform
7define <vscale x 4 x float> @complex_add_v4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
8; CHECK-LABEL: complex_add_v4f32:
9; CHECK:       // %bb.0: // %entry
10; CHECK-NEXT:    ptrue p0.s
11; CHECK-NEXT:    fcadd z1.s, p0/m, z1.s, z0.s, #90
12; CHECK-NEXT:    mov z0.d, z1.d
13; CHECK-NEXT:    ret
14entry:
15  %a.deinterleaved = tail call { <vscale x 2 x float>, <vscale x 2 x float> } @llvm.vector.deinterleave2.nxv4f32(<vscale x 4 x float> %a)
16  %a.real = extractvalue { <vscale x 2 x float>, <vscale x 2 x float> } %a.deinterleaved, 0
17  %a.imag = extractvalue { <vscale x 2 x float>, <vscale x 2 x float> } %a.deinterleaved, 1
18  %b.deinterleaved = tail call { <vscale x 2 x float>, <vscale x 2 x float> } @llvm.vector.deinterleave2.nxv4f32(<vscale x 4 x float> %b)
19  %b.real = extractvalue { <vscale x 2 x float>, <vscale x 2 x float> } %b.deinterleaved, 0
20  %b.imag = extractvalue { <vscale x 2 x float>, <vscale x 2 x float> } %b.deinterleaved, 1
21  %0 = fsub fast <vscale x 2 x float> %b.real, %a.imag
22  %1 = fadd fast <vscale x 2 x float> %b.imag, %a.real
23  %interleaved.vec = tail call <vscale x 4 x float> @llvm.vector.interleave2.nxv4f32(<vscale x 2 x float> %0, <vscale x 2 x float> %1)
24  ret <vscale x 4 x float> %interleaved.vec
25}
26
27; Expected to transform
28define <vscale x 8 x float> @complex_add_v8f32(<vscale x 8 x float> %a, <vscale x 8 x float> %b) {
29; CHECK-LABEL: complex_add_v8f32:
30; CHECK:       // %bb.0: // %entry
31; CHECK-NEXT:    ptrue p0.s
32; CHECK-NEXT:    fcadd z2.s, p0/m, z2.s, z0.s, #90
33; CHECK-NEXT:    fcadd z3.s, p0/m, z3.s, z1.s, #90
34; CHECK-NEXT:    mov z0.d, z2.d
35; CHECK-NEXT:    mov z1.d, z3.d
36; CHECK-NEXT:    ret
37entry:
38  %a.deinterleaved = tail call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %a)
39  %a.real = extractvalue { <vscale x 4 x float>, <vscale x 4 x float> } %a.deinterleaved, 0
40  %a.imag = extractvalue { <vscale x 4 x float>, <vscale x 4 x float> } %a.deinterleaved, 1
41  %b.deinterleaved = tail call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %b)
42  %b.real = extractvalue { <vscale x 4 x float>, <vscale x 4 x float> } %b.deinterleaved, 0
43  %b.imag = extractvalue { <vscale x 4 x float>, <vscale x 4 x float> } %b.deinterleaved, 1
44  %0 = fsub fast <vscale x 4 x float> %b.real, %a.imag
45  %1 = fadd fast <vscale x 4 x float> %b.imag, %a.real
46  %interleaved.vec = tail call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %0, <vscale x 4 x float> %1)
47  ret <vscale x 8 x float> %interleaved.vec
48}
49; Expected to transform
50define <vscale x 16 x float> @complex_add_v16f32(<vscale x 16 x float> %a, <vscale x 16 x float> %b) {
51; CHECK-LABEL: complex_add_v16f32:
52; CHECK:       // %bb.0: // %entry
53; CHECK-NEXT:    ptrue p0.s
54; CHECK-NEXT:    fcadd z4.s, p0/m, z4.s, z0.s, #90
55; CHECK-NEXT:    fcadd z5.s, p0/m, z5.s, z1.s, #90
56; CHECK-NEXT:    fcadd z6.s, p0/m, z6.s, z2.s, #90
57; CHECK-NEXT:    fcadd z7.s, p0/m, z7.s, z3.s, #90
58; CHECK-NEXT:    mov z0.d, z4.d
59; CHECK-NEXT:    mov z1.d, z5.d
60; CHECK-NEXT:    mov z2.d, z6.d
61; CHECK-NEXT:    mov z3.d, z7.d
62; CHECK-NEXT:    ret
63entry:
64  %a.deinterleaved = tail call { <vscale x 8 x float>, <vscale x 8 x float> } @llvm.vector.deinterleave2.nxv16f32(<vscale x 16 x float> %a)
65  %a.real = extractvalue { <vscale x 8 x float>, <vscale x 8 x float> } %a.deinterleaved, 0
66  %a.imag = extractvalue { <vscale x 8 x float>, <vscale x 8 x float> } %a.deinterleaved, 1
67  %b.deinterleaved = tail call { <vscale x 8 x float>, <vscale x 8 x float> } @llvm.vector.deinterleave2.nxv16f32(<vscale x 16 x float> %b)
68  %b.real = extractvalue { <vscale x 8 x float>, <vscale x 8 x float> } %b.deinterleaved, 0
69  %b.imag = extractvalue { <vscale x 8 x float>, <vscale x 8 x float> } %b.deinterleaved, 1
70  %0 = fsub fast <vscale x 8 x float> %b.real, %a.imag
71  %1 = fadd fast <vscale x 8 x float> %b.imag, %a.real
72  %interleaved.vec = tail call <vscale x 16 x float> @llvm.vector.interleave2.nxv16f32(<vscale x 8 x float> %0, <vscale x 8 x float> %1)
73  ret <vscale x 16 x float> %interleaved.vec
74}
75
76declare { <vscale x 2 x float>, <vscale x 2 x float> } @llvm.vector.deinterleave2.nxv4f32(<vscale x 4 x float>)
77declare <vscale x 4 x float> @llvm.vector.interleave2.nxv4f32(<vscale x 2 x float>, <vscale x 2 x float>)
78
79declare { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float>)
80declare <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float>, <vscale x 4 x float>)
81
82declare { <vscale x 8 x float>, <vscale x 8 x float> } @llvm.vector.deinterleave2.nxv16f32(<vscale x 16 x float>)
83declare <vscale x 16 x float> @llvm.vector.interleave2.nxv16f32(<vscale x 8 x float>, <vscale x 8 x float>)
84