OLD | NEW |
1 ; Show that we know how to translate push and pop. | 1 ; Show that we know how to translate push and pop. |
2 ; TODO(kschimpf) Translate pop instructions. | 2 ; TODO(kschimpf) Translate pop instructions. |
3 | 3 |
4 ; NOTE: We use -O2 to get rid of memory stores. | 4 ; NOTE: We use -O2 to get rid of memory stores. |
5 | 5 |
6 ; REQUIRES: allow_dump | 6 ; REQUIRES: allow_dump |
7 | 7 |
8 ; Compile using standalone assembler. | 8 ; Compile using standalone assembler. |
9 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -allow-extern \ | 9 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -allow-extern \ |
10 ; RUN: | FileCheck %s --check-prefix=ASM | 10 ; RUN: | FileCheck %s --check-prefix=ASM |
(...skipping 13 matching lines...) Expand all Loading... |
24 declare external void @DoSomething() | 24 declare external void @DoSomething() |
25 | 25 |
26 define internal void @SinglePushPop() { | 26 define internal void @SinglePushPop() { |
27 call void @DoSomething(); | 27 call void @DoSomething(); |
28 ret void | 28 ret void |
29 } | 29 } |
30 | 30 |
31 ; ASM-LABEL:SinglePushPop: | 31 ; ASM-LABEL:SinglePushPop: |
32 ; ASM-NEXT:.LSinglePushPop$__0: | 32 ; ASM-NEXT:.LSinglePushPop$__0: |
33 ; ASM-NEXT: push {lr} | 33 ; ASM-NEXT: push {lr} |
34 ; ASM: sub sp, sp, #12 | 34 ; ASM-NEXT: sub sp, sp, #12 |
35 ; ASM-NEXT: bl DoSomething | 35 ; ASM-NEXT: bl DoSomething |
36 ; ASM: add sp, sp, #12 | 36 ; ASM-NEXT: add sp, sp, #12 |
37 ; ASM-NEXT: pop {lr} | 37 ; ASM-NEXT: pop {lr} |
38 ; ASM: bx lr | 38 ; ASM-NEXT: # lr = def.pseudo |
| 39 ; ASM-NEXT: bx lr |
39 | 40 |
40 ; DIS-LABEL:00000000 <SinglePushPop>: | 41 ; DIS-LABEL:00000000 <SinglePushPop>: |
41 ; DIS-NEXT: 0: e52de004 | 42 ; DIS-NEXT: 0: e52de004 |
42 ; DIS-NEXT: 4: e24dd00c | 43 ; DIS-NEXT: 4: e24dd00c |
43 ; DIS-NEXT: 8: ebfffffe | 44 ; DIS-NEXT: 8: ebfffffe |
44 ; DIS-NEXT: c: e28dd00c | 45 ; DIS-NEXT: c: e28dd00c |
45 ; DIS-NEXT: 10: e49de004 | 46 ; DIS-NEXT: 10: e49de004 |
46 ; DIS-NEXT: 14: e12fff1e | 47 ; DIS-NEXT: 14: e12fff1e |
47 | 48 |
48 ; IASM-LABEL:SinglePushPop: | 49 ; IASM-LABEL:SinglePushPop: |
(...skipping 30 matching lines...) Expand all Loading... |
79 ; prolog/epilog. | 80 ; prolog/epilog. |
80 define internal i32 @MultPushPop(i32 %v1, i32 %v2) { | 81 define internal i32 @MultPushPop(i32 %v1, i32 %v2) { |
81 call void @DoSomething(); | 82 call void @DoSomething(); |
82 %v3 = add i32 %v1, %v2 | 83 %v3 = add i32 %v1, %v2 |
83 ret i32 %v3 | 84 ret i32 %v3 |
84 } | 85 } |
85 | 86 |
86 ; ASM-LABEL:MultPushPop: | 87 ; ASM-LABEL:MultPushPop: |
87 ; ASM-NEXT:.LMultPushPop$__0: | 88 ; ASM-NEXT:.LMultPushPop$__0: |
88 ; ASM-NEXT: push {r4, r5, lr} | 89 ; ASM-NEXT: push {r4, r5, lr} |
89 ; ASM: sub sp, sp, #4 | 90 ; ASM-NEXT: sub sp, sp, #4 |
90 ; ASM-NEXT: mov r4, r0 | 91 ; ASM-NEXT: mov r4, r0 |
91 ; ASM-NEXT: mov r5, r1 | 92 ; ASM-NEXT: mov r5, r1 |
92 ; ASM-NEXT: bl DoSomething | 93 ; ASM-NEXT: bl DoSomething |
93 ; ASM: add r4, r4, r5 | 94 ; ASM-NEXT: add r4, r4, r5 |
94 ; ASM-NEXT: mov r0, r4 | 95 ; ASM-NEXT: mov r0, r4 |
95 ; ASM-NEXT: add sp, sp, #4 | 96 ; ASM-NEXT: add sp, sp, #4 |
96 ; ASM-NEXT: pop {r4, r5, lr} | 97 ; ASM-NEXT: pop {r4, r5, lr} |
97 ; ASM: bx lr | 98 ; ASM-NEXT: # r4 = def.pseudo |
| 99 ; ASM-NEXT: # r5 = def.pseudo |
| 100 ; ASM-NEXT: # lr = def.pseudo |
| 101 ; ASM-NEXT: bx lr |
98 | 102 |
99 ; DIS-LABEL:00000020 <MultPushPop>: | 103 ; DIS-LABEL:00000020 <MultPushPop>: |
100 ; DIS-NEXT: 20: e92d4030 | 104 ; DIS-NEXT: 20: e92d4030 |
101 ; DIS-NEXT: 24: e24dd004 | 105 ; DIS-NEXT: 24: e24dd004 |
102 ; DIS-NEXT: 28: e1a04000 | 106 ; DIS-NEXT: 28: e1a04000 |
103 ; DIS-NEXT: 2c: e1a05001 | 107 ; DIS-NEXT: 2c: e1a05001 |
104 ; DIS-NEXT: 30: ebfffffe | 108 ; DIS-NEXT: 30: ebfffffe |
105 ; DIS-NEXT: 34: e0844005 | 109 ; DIS-NEXT: 34: e0844005 |
106 ; DIS-NEXT: 38: e1a00004 | 110 ; DIS-NEXT: 38: e1a00004 |
107 ; DIS-NEXT: 3c: e28dd004 | 111 ; DIS-NEXT: 3c: e28dd004 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 152 |
149 ; IASM-NEXT: .byte 0x30 | 153 ; IASM-NEXT: .byte 0x30 |
150 ; IASM-NEXT: .byte 0x40 | 154 ; IASM-NEXT: .byte 0x40 |
151 ; IASM-NEXT: .byte 0xbd | 155 ; IASM-NEXT: .byte 0xbd |
152 ; IASM-NEXT: .byte 0xe8 | 156 ; IASM-NEXT: .byte 0xe8 |
153 | 157 |
154 ; IASM: .byte 0x1e | 158 ; IASM: .byte 0x1e |
155 ; IASM-NEXT: .byte 0xff | 159 ; IASM-NEXT: .byte 0xff |
156 ; IASM-NEXT: .byte 0x2f | 160 ; IASM-NEXT: .byte 0x2f |
157 ; IASM-NEXT: .byte 0xe1 | 161 ; IASM-NEXT: .byte 0xe1 |
OLD | NEW |