xref: /llvm-project/llvm/test/CodeGen/ARM/dyn-stackalloc.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc -mcpu=generic -mtriple=arm-eabi -verify-machineinstrs < %s | FileCheck %s
2
3%struct.comment = type { ptr, ptr, i32, ptr }
4%struct.info = type { i32, i32, i32, i32, i32, i32, i32, ptr }
5%struct.state = type { i32, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, ptr }
6
7@str215 = external global [2 x i8]
8
9define void @t1(ptr %v) {
10
11; Make sure we generate:
12;   sub	sp, sp, r1
13; instead of:
14;   sub	r1, sp, r1
15;   mov	sp, r1
16
17; CHECK-LABEL: @t1
18; CHECK: bic [[REG1:r[0-9]+]],
19; CHECK-NOT: sub r{{[0-9]+}}, sp, [[REG1]]
20; CHECK: sub sp, sp, [[REG1]]
21
22  %tmp6 = load i32, ptr null
23  %tmp8 = alloca float, i32 %tmp6
24  store i32 1, ptr null
25  br i1 false, label %bb123.preheader, label %return
26
27bb123.preheader:                                  ; preds = %0
28  br i1 false, label %bb43, label %return
29
30bb43:                                             ; preds = %bb123.preheader
31  call fastcc void @f1(ptr %tmp8, ptr null, i32 0)
32  %tmp70 = load i32, ptr null
33  call fastcc void @f2(ptr null, ptr null, ptr %tmp8, i32 %tmp70)
34  ret void
35
36return:                                           ; preds = %bb123.preheader, %0
37  ret void
38}
39
40declare fastcc void @f1(ptr, ptr, i32)
41
42declare fastcc void @f2(ptr, ptr, ptr, i32)
43
44define void @t2(ptr %vc, ptr %tag, ptr %contents) {
45  %tmp1 = call i32 @strlen(ptr %tag)
46  %tmp3 = call i32 @strlen(ptr %contents)
47  %tmp4 = add i32 %tmp1, 2
48  %tmp5 = add i32 %tmp4, %tmp3
49  %tmp6 = alloca i8, i32 %tmp5
50  %tmp9 = call ptr @strcpy(ptr %tmp6, ptr %tag)
51  %tmp6.len = call i32 @strlen(ptr %tmp6)
52  %tmp6.indexed = getelementptr i8, ptr %tmp6, i32 %tmp6.len
53  call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp6.indexed, ptr align 1 @str215, i32 2, i1 false)
54  %tmp15 = call ptr @strcat(ptr %tmp6, ptr %contents)
55  call fastcc void @comment_add(ptr %vc, ptr %tmp6)
56  ret void
57}
58
59declare i32 @strlen(ptr)
60
61declare ptr @strcat(ptr, ptr)
62
63declare fastcc void @comment_add(ptr, ptr)
64
65declare ptr @strcpy(ptr, ptr)
66
67declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind
68