Home | History | Annotate | Download | only in Thumb
      1 ; RUN: llc < %s | FileCheck %s
      2 target triple = "thumbv6---gnueabi"
      3 
      4 ; Use STM to save the three registers
      5 ; CHECK-LABEL: use_stm:
      6 ; CHECK: .save   {r7, lr}
      7 ; CHECK: .setfp  r7, sp
      8 ; CHECK: stm r3!, {r0, r1, r2}
      9 ; CHECK: bl throws_1
     10 define void @use_stm(i32 %a, i32 %b, i32 %c, i32* %d) local_unnamed_addr noreturn "no-frame-pointer-elim"="true" {
     11 entry:
     12   %arrayidx = getelementptr inbounds i32, i32* %d, i32 2
     13   store i32 %a, i32* %arrayidx, align 4
     14   %arrayidx1 = getelementptr inbounds i32, i32* %d, i32 3
     15   store i32 %b, i32* %arrayidx1, align 4
     16   %arrayidx2 = getelementptr inbounds i32, i32* %d, i32 4
     17   store i32 %c, i32* %arrayidx2, align 4
     18   tail call void @throws_1(i32 %a, i32 %b, i32 %c) noreturn
     19   unreachable
     20 }
     21 
     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
     28 ; CHECK: str r0,
     29 ; CHECK: str r1,
     30 ; CHECK: str r2,
     31 ; CHECK: bl throws_2
     32 define void @no_stm(i32 %a, i32 %b, i32 %c, i32* %d) local_unnamed_addr noreturn "no-frame-pointer-elim"="true" {
     33 entry:
     34   %arrayidx = getelementptr inbounds i32, i32* %d, i32 2
     35   store i32 %a, i32* %arrayidx, align 4
     36   %arrayidx1 = getelementptr inbounds i32, i32* %d, i32 3
     37   store i32 %b, i32* %arrayidx1, align 4
     38   %arrayidx2 = getelementptr inbounds i32, i32* %d, i32 4
     39   store i32 %c, i32* %arrayidx2, align 4
     40   tail call void @throws_2(i32 %a, i32 %b, i32 %c, i32* %d) noreturn
     41   unreachable
     42 }
     43 
     44 
     45 declare void @throws_1(i32, i32, i32) noreturn
     46 declare void @throws_2(i32, i32, i32, i32*) noreturn
     47