1; Show that pops are generated in reverse order of pushes.
2
3; NOTE: Restricts to nonconsecutive S registers to force the generation of
4; multiple vpush/vpop instructions. Also tests that we generate them in the
5; right order (the reverse of the corresponding push). Uses -O2 to keep all
6; results in S registers.
7
8; REQUIRES: allow_dump
9
10; Compile using standalone assembler.
11; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -allow-extern \
12; RUN:   -reg-use s20,s22,s23 \
13; RUN:   | FileCheck %s --check-prefix=ASM
14
15; Show bytes in assembled standalone code.
16; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \
17; RUN:   --args -O2 -allow-extern \
18; RUN:   -reg-use s20,s22,s23 \
19; RUN:   | FileCheck %s --check-prefix=DIS
20
21; Compile using integrated assembler.
22; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -allow-extern \
23; RUN:   -reg-use s20,s22,s23 \
24; RUN:   | FileCheck %s --check-prefix=IASM
25
26; Show bytes in assembled integrated code.
27; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
28; RUN:   --args -O2 -allow-extern \
29; RUN:   -reg-use s20,s22,s23 \
30; RUN:   | FileCheck %s --check-prefix=DIS
31
32declare external void @f()
33
34define internal float @test2SPops(float %p1, float %p2) {
35; ASM-LABEL: test2SPops:
36; DIS-LABEL: 00000000 <test2SPops>:
37; IASM-LABEL: test2SPops:
38
39; ASM:          vpush   {s20}
40; ASM-NEXT:     vpush   {s22, s23}
41; ASM-NEXT:     push    {lr}
42
43; DIS:          0:      ed2daa01
44; DIS-NEXT:     4:      ed2dba02
45; DIS-NEXT:     8:      e52de004
46
47; IASM-NOT:     vpush
48; IASM-NOT:     push
49
50  %v1 = fadd float %p1, %p2
51  %v2 = fsub float %p1, %p2
52  %v3 = fsub float %p2, %p1
53  call void @f()
54  %v4 = fadd float %v1, %v2
55  %res = fadd float %v3, %v4
56
57; ASM:          pop     {lr}
58; ASM-NEXT:     # lr = def.pseudo
59; ASM-NEXT:     vpop    {s22, s23}
60; ASM-NEXT:     vpop    {s20}
61
62; DIS:         40:      e49de004
63; DIS-NEXT:    44:      ecbdba02
64; DIS-NEXT:    48:      ecbdaa01
65
66; IASM-NOT: pop
67; IASM-NOT: vpop
68
69  ret float %res
70}
71