1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -frame-pointer=all -mtriple=m68k %s -verify-machineinstrs -o - \
3 ; RUN: | FileCheck --check-prefix=FP %s
5 ; RUN: llc -frame-pointer=none -mtriple=m68k %s -verify-machineinstrs -o - \
6 ; RUN: | FileCheck --check-prefix=NO-FP %s
8 define i32 @fib(i32 %a, i32 %b) {
11 ; FP-NEXT: ; %bb.0: ; %entry
12 ; FP-NEXT: link.w %a6, #-32
13 ; FP-NEXT: .cfi_def_cfa_offset -8
14 ; FP-NEXT: .cfi_offset %a6, -8
15 ; FP-NEXT: .cfi_def_cfa_register %a6
16 ; FP-NEXT: move.l (8,%a6), %d1
17 ; FP-NEXT: move.l %d1, (-32,%a6)
18 ; FP-NEXT: move.l (12,%a6), %d0
19 ; FP-NEXT: add.l %d0, %d1
20 ; FP-NEXT: move.l %d0, (-28,%a6)
21 ; FP-NEXT: add.l %d1, %d0
22 ; FP-NEXT: move.l %d1, (-24,%a6)
23 ; FP-NEXT: add.l %d0, %d1
24 ; FP-NEXT: move.l %d0, (-20,%a6)
25 ; FP-NEXT: move.l %d1, (-16,%a6)
26 ; FP-NEXT: add.l %d1, %d0
27 ; FP-NEXT: move.l %d0, (-12,%a6)
28 ; FP-NEXT: add.l %d0, %d1
29 ; FP-NEXT: move.l %d1, (-8,%a6)
30 ; FP-NEXT: add.l %d1, %d0
31 ; FP-NEXT: move.l %d0, (-4,%a6)
36 ; NO-FP: .cfi_startproc
37 ; NO-FP-NEXT: ; %bb.0: ; %entry
38 ; NO-FP-NEXT: suba.l #32, %sp
39 ; NO-FP-NEXT: .cfi_def_cfa_offset -36
40 ; NO-FP-NEXT: move.l (36,%sp), %d1
41 ; NO-FP-NEXT: move.l %d1, (0,%sp)
42 ; NO-FP-NEXT: move.l (40,%sp), %d0
43 ; NO-FP-NEXT: add.l %d0, %d1
44 ; NO-FP-NEXT: move.l %d0, (4,%sp)
45 ; NO-FP-NEXT: add.l %d1, %d0
46 ; NO-FP-NEXT: move.l %d1, (8,%sp)
47 ; NO-FP-NEXT: add.l %d0, %d1
48 ; NO-FP-NEXT: move.l %d0, (12,%sp)
49 ; NO-FP-NEXT: move.l %d1, (16,%sp)
50 ; NO-FP-NEXT: add.l %d1, %d0
51 ; NO-FP-NEXT: move.l %d0, (20,%sp)
52 ; NO-FP-NEXT: add.l %d0, %d1
53 ; NO-FP-NEXT: move.l %d1, (24,%sp)
54 ; NO-FP-NEXT: add.l %d1, %d0
55 ; NO-FP-NEXT: move.l %d0, (28,%sp)
56 ; NO-FP-NEXT: adda.l #32, %sp
59 %arr = alloca [8 x i32], align 4
60 %s0 = getelementptr i32, ptr %arr, i32 0
61 %s1 = getelementptr i32, ptr %arr, i32 1
62 store i32 %a, i32* %s0
63 store i32 %b, i32* %s1
65 %ptr0 = getelementptr i32, ptr %arr, i32 0
66 %ptr1 = getelementptr i32, ptr %arr, i32 1
67 %ptr2 = getelementptr i32, ptr %arr, i32 2
68 %ptr3 = getelementptr i32, ptr %arr, i32 3
69 %ptr4 = getelementptr i32, ptr %arr, i32 4
70 %ptr5 = getelementptr i32, ptr %arr, i32 5
71 %ptr6 = getelementptr i32, ptr %arr, i32 6
72 %ptr7 = getelementptr i32, ptr %arr, i32 7
74 %res0 = load i32, i32 * %ptr0
75 %res1 = load i32, i32 * %ptr1
77 %res2 = add i32 %res0, %res1
78 store i32 %res2, i32 * %ptr2
80 %res3 = add i32 %res1, %res2
81 store i32 %res3, i32 * %ptr3
83 %res4 = add i32 %res2, %res3
84 store i32 %res4, i32 * %ptr4
86 %res5 = add i32 %res3, %res4
87 store i32 %res5, i32 * %ptr5
89 %res6 = add i32 %res4, %res5
90 store i32 %res6, i32 * %ptr6
92 %res7 = add i32 %res5, %res6
93 store i32 %res7, i32 * %ptr7
98 define i32 @test_gep() {
101 ; FP-NEXT: ; %bb.0: ; %entry
102 ; FP-NEXT: link.w %a6, #-256
103 ; FP-NEXT: .cfi_def_cfa_offset -8
104 ; FP-NEXT: .cfi_offset %a6, -8
105 ; FP-NEXT: .cfi_def_cfa_register %a6
106 ; FP-NEXT: move.l #21, (-4,%a6)
107 ; FP-NEXT: move.l #12, (-256,%a6)
108 ; FP-NEXT: move.l #0, %d0
112 ; NO-FP-LABEL: test_gep:
113 ; NO-FP: .cfi_startproc
114 ; NO-FP-NEXT: ; %bb.0: ; %entry
115 ; NO-FP-NEXT: suba.l #256, %sp
116 ; NO-FP-NEXT: .cfi_def_cfa_offset -260
117 ; NO-FP-NEXT: move.l #21, (252,%sp)
118 ; NO-FP-NEXT: move.l #12, (0,%sp)
119 ; NO-FP-NEXT: move.l #0, %d0
120 ; NO-FP-NEXT: adda.l #256, %sp
123 %arr = alloca [8 x [8 x i32]]
124 %ptr1 = getelementptr [8 x i32], ptr %arr, i64 0, i64 0
125 store i32 12, i32 * %ptr1
126 %ptr2 = getelementptr [8 x i32], ptr %arr, i64 7, i64 7
127 store i32 21, i32 * %ptr2