1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=arm-unknown-linux < %s | FileCheck %s
4 ; Check CSR split can work properly for tests below.
6 @a = common dso_local local_unnamed_addr global i32 0, align 4
8 define dso_local signext i32 @test1(i32* %b) local_unnamed_addr {
10 ; CHECK: @ %bb.0: @ %entry
11 ; CHECK-NEXT: push {r4, lr}
12 ; CHECK-NEXT: mov r4, r0
13 ; CHECK-NEXT: ldr r0, .LCPI0_0
14 ; CHECK-NEXT: ldr r0, [r0]
15 ; CHECK-NEXT: cmp r0, r4
16 ; CHECK-NEXT: popne {r4, lr}
17 ; CHECK-NEXT: movne pc, lr
18 ; CHECK-NEXT: bl callVoid
19 ; CHECK-NEXT: mov r0, r4
20 ; CHECK-NEXT: pop {r4, lr}
21 ; CHECK-NEXT: b callNonVoid
22 ; CHECK-NEXT: .p2align 2
23 ; CHECK-NEXT: @ %bb.1:
24 ; CHECK-NEXT: .LCPI0_0:
27 %0 = load i32, i32* @a, align 4, !tbaa !2
28 %conv = sext i32 %0 to i64
29 %1 = inttoptr i64 %conv to i32*
30 %cmp = icmp eq i32* %1, %b
31 br i1 %cmp, label %if.then, label %if.end
33 if.then: ; preds = %entry
34 %call = tail call signext i32 bitcast (i32 (...)* @callVoid to i32 ()*)()
35 %call2 = tail call signext i32 @callNonVoid(i32* %b)
38 if.end: ; preds = %if.then, %entry
39 %retval.0 = phi i32 [ %call2, %if.then ], [ undef, %entry ]
43 declare signext i32 @callVoid(...) local_unnamed_addr
45 declare signext i32 @callNonVoid(i32*) local_unnamed_addr
47 define dso_local signext i32 @test2(i32* %p1) local_unnamed_addr {
49 ; CHECK: @ %bb.0: @ %entry
50 ; CHECK-NEXT: push {r4, lr}
51 ; CHECK-NEXT: cmp r0, #0
52 ; CHECK-NEXT: beq .LBB1_2
53 ; CHECK-NEXT: @ %bb.1: @ %if.end
54 ; CHECK-NEXT: mov r4, r0
55 ; CHECK-NEXT: ldr r0, .LCPI1_0
56 ; CHECK-NEXT: ldr r0, [r0]
57 ; CHECK-NEXT: cmp r0, r4
58 ; CHECK-NEXT: beq .LBB1_3
59 ; CHECK-NEXT: .LBB1_2: @ %return
60 ; CHECK-NEXT: mov r0, #0
61 ; CHECK-NEXT: pop {r4, lr}
62 ; CHECK-NEXT: mov pc, lr
63 ; CHECK-NEXT: .LBB1_3: @ %if.then2
64 ; CHECK-NEXT: bl callVoid
65 ; CHECK-NEXT: mov r0, r4
66 ; CHECK-NEXT: pop {r4, lr}
67 ; CHECK-NEXT: b callNonVoid
68 ; CHECK-NEXT: .p2align 2
69 ; CHECK-NEXT: @ %bb.4:
70 ; CHECK-NEXT: .LCPI1_0:
73 %tobool = icmp eq i32* %p1, null
74 br i1 %tobool, label %return, label %if.end
76 if.end: ; preds = %entry
77 %0 = load i32, i32* @a, align 4, !tbaa !2
78 %conv = sext i32 %0 to i64
79 %1 = inttoptr i64 %conv to i32*
80 %cmp = icmp eq i32* %1, %p1
81 br i1 %cmp, label %if.then2, label %return
83 if.then2: ; preds = %if.end
84 %call = tail call signext i32 bitcast (i32 (...)* @callVoid to i32 ()*)()
85 %call3 = tail call signext i32 @callNonVoid(i32* nonnull %p1)
88 return: ; preds = %if.end, %entry, %if.then2
89 %retval.0 = phi i32 [ %call3, %if.then2 ], [ 0, %entry ], [ 0, %if.end ]
94 define dso_local i8* @test3(i8** nocapture %p1, i8 zeroext %p2) local_unnamed_addr {
96 ; CHECK: @ %bb.0: @ %entry
97 ; CHECK-NEXT: push {r4, r5, r11, lr}
98 ; CHECK-NEXT: ldr r4, [r0]
99 ; CHECK-NEXT: cmp r4, #0
100 ; CHECK-NEXT: beq .LBB2_2
101 ; CHECK-NEXT: @ %bb.1: @ %land.rhs
102 ; CHECK-NEXT: mov r5, r0
103 ; CHECK-NEXT: mov r0, r4
105 ; CHECK-NEXT: str r0, [r5]
106 ; CHECK-NEXT: .LBB2_2: @ %land.end
107 ; CHECK-NEXT: mov r0, r4
108 ; CHECK-NEXT: pop {r4, r5, r11, lr}
109 ; CHECK-NEXT: mov pc, lr
111 %0 = load i8*, i8** %p1, align 8, !tbaa !6
112 %tobool = icmp eq i8* %0, null
113 br i1 %tobool, label %land.end, label %land.rhs
115 land.rhs: ; preds = %entry
116 %call = tail call i8* @bar(i8* nonnull %0, i8 zeroext %p2)
117 store i8* %call, i8** %p1, align 8, !tbaa !6
120 land.end: ; preds = %entry, %land.rhs
124 declare i8* @bar(i8*, i8 zeroext) local_unnamed_addr
127 !llvm.module.flags = !{!0}
130 !0 = !{i32 1, !"wchar_size", i32 4}
131 !1 = !{!"clang version 10.0.0 (trunk 367381) (llvm/trunk 367388)"}
132 !2 = !{!3, !3, i64 0}
133 !3 = !{!"int", !4, i64 0}
134 !4 = !{!"omnipotent char", !5, i64 0}
135 !5 = !{!"Simple C/C++ TBAA"}
136 !6 = !{!7, !7, i64 0}
137 !7 = !{!"any pointer", !4, i64 0}