1 ; RUN: llc < %s | FileCheck %s
2 target triple = "thumbv6---gnueabi"
4 ; Use STM to save the three registers
5 ; CHECK-LABEL: use_stm:
6 ; CHECK: .save {r7, lr}
8 ; CHECK: stm r3!, {r0, r1, r2}
10 define void @use_stm(i32 %a, i32 %b, i32 %c, ptr %d) local_unnamed_addr noreturn "frame-pointer"="all" {
12 %arrayidx = getelementptr inbounds i32, ptr %d, i32 2
13 store i32 %a, ptr %arrayidx, align 4
14 %arrayidx1 = getelementptr inbounds i32, ptr %d, i32 3
15 store i32 %b, ptr %arrayidx1, align 4
16 %arrayidx2 = getelementptr inbounds i32, ptr %d, i32 4
17 store i32 %c, ptr %arrayidx2, align 4
18 tail call void @throws_1(i32 %a, i32 %b, i32 %c) noreturn
22 ; Don't use STM: there is no available register to store
23 ; the address. We could transform this with some extra math, but
24 ; that currently isn't implemented.
25 ; CHECK-LABEL: no_stm:
26 ; CHECK: .save {r7, lr}
27 ; CHECK: .setfp r7, sp
32 define void @no_stm(i32 %a, i32 %b, i32 %c, ptr %d) local_unnamed_addr noreturn "frame-pointer"="all" {
34 %arrayidx = getelementptr inbounds i32, ptr %d, i32 2
35 store i32 %a, ptr %arrayidx, align 4
36 %arrayidx1 = getelementptr inbounds i32, ptr %d, i32 3
37 store i32 %b, ptr %arrayidx1, align 4
38 %arrayidx2 = getelementptr inbounds i32, ptr %d, i32 4
39 store i32 %c, ptr %arrayidx2, align 4
40 tail call void @throws_2(i32 %a, i32 %b, i32 %c, ptr %d) noreturn
45 declare void @throws_1(i32, i32, i32) noreturn
46 declare void @throws_2(i32, i32, i32, ptr) noreturn