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: .LBB0_1: @ %if.then
19 ; CHECK-NEXT: bl callVoid
20 ; CHECK-NEXT: mov r0, r4
21 ; CHECK-NEXT: pop {r4, lr}
22 ; CHECK-NEXT: b callNonVoid
23 ; CHECK-NEXT: .p2align 2
24 ; CHECK-NEXT: @ %bb.2:
25 ; CHECK-NEXT: .LCPI0_0:
28 %0 = load i32, i32* @a, align 4, !tbaa !2
29 %conv = sext i32 %0 to i64
30 %1 = inttoptr i64 %conv to i32*
31 %cmp = icmp eq i32* %1, %b
32 br i1 %cmp, label %if.then, label %if.end
34 if.then: ; preds = %entry
35 %call = tail call signext i32 bitcast (i32 (...)* @callVoid to i32 ()*)()
36 %call2 = tail call signext i32 @callNonVoid(i32* %b)
39 if.end: ; preds = %if.then, %entry
40 %retval.0 = phi i32 [ %call2, %if.then ], [ undef, %entry ]
44 declare signext i32 @callVoid(...) local_unnamed_addr
46 declare signext i32 @callNonVoid(i32*) local_unnamed_addr
48 define dso_local signext i32 @test2(i32* %p1) local_unnamed_addr {
50 ; CHECK: @ %bb.0: @ %entry
51 ; CHECK-NEXT: push {r4, lr}
52 ; CHECK-NEXT: cmp r0, #0
53 ; CHECK-NEXT: beq .LBB1_2
54 ; CHECK-NEXT: @ %bb.1: @ %if.end
55 ; CHECK-NEXT: mov r4, r0
56 ; CHECK-NEXT: ldr r0, .LCPI1_0
57 ; CHECK-NEXT: ldr r0, [r0]
58 ; CHECK-NEXT: cmp r0, r4
59 ; CHECK-NEXT: beq .LBB1_3
60 ; CHECK-NEXT: .LBB1_2: @ %return
61 ; CHECK-NEXT: mov r0, #0
62 ; CHECK-NEXT: pop {r4, lr}
63 ; CHECK-NEXT: mov pc, lr
64 ; CHECK-NEXT: .LBB1_3: @ %if.then2
65 ; CHECK-NEXT: bl callVoid
66 ; CHECK-NEXT: mov r0, r4
67 ; CHECK-NEXT: pop {r4, lr}
68 ; CHECK-NEXT: b callNonVoid
69 ; CHECK-NEXT: .p2align 2
70 ; CHECK-NEXT: @ %bb.4:
71 ; CHECK-NEXT: .LCPI1_0:
74 %tobool = icmp eq i32* %p1, null
75 br i1 %tobool, label %return, label %if.end
77 if.end: ; preds = %entry
78 %0 = load i32, i32* @a, align 4, !tbaa !2
79 %conv = sext i32 %0 to i64
80 %1 = inttoptr i64 %conv to i32*
81 %cmp = icmp eq i32* %1, %p1
82 br i1 %cmp, label %if.then2, label %return
84 if.then2: ; preds = %if.end
85 %call = tail call signext i32 bitcast (i32 (...)* @callVoid to i32 ()*)()
86 %call3 = tail call signext i32 @callNonVoid(i32* nonnull %p1)
89 return: ; preds = %if.end, %entry, %if.then2
90 %retval.0 = phi i32 [ %call3, %if.then2 ], [ 0, %entry ], [ 0, %if.end ]
95 define dso_local i8* @test3(i8** nocapture %p1, i8 zeroext %p2) local_unnamed_addr {
97 ; CHECK: @ %bb.0: @ %entry
98 ; CHECK-NEXT: push {r4, r5, r11, lr}
99 ; CHECK-NEXT: ldr r4, [r0]
100 ; CHECK-NEXT: cmp r4, #0
101 ; CHECK-NEXT: beq .LBB2_2
102 ; CHECK-NEXT: @ %bb.1: @ %land.rhs
103 ; CHECK-NEXT: mov r5, r0
104 ; CHECK-NEXT: mov r0, r4
106 ; CHECK-NEXT: str r0, [r5]
107 ; CHECK-NEXT: .LBB2_2: @ %land.end
108 ; CHECK-NEXT: mov r0, r4
109 ; CHECK-NEXT: pop {r4, r5, r11, lr}
110 ; CHECK-NEXT: mov pc, lr
112 %0 = load i8*, i8** %p1, align 8, !tbaa !6
113 %tobool = icmp eq i8* %0, null
114 br i1 %tobool, label %land.end, label %land.rhs
116 land.rhs: ; preds = %entry
117 %call = tail call i8* @bar(i8* nonnull %0, i8 zeroext %p2)
118 store i8* %call, i8** %p1, align 8, !tbaa !6
121 land.end: ; preds = %entry, %land.rhs
125 declare i8* @bar(i8*, i8 zeroext) local_unnamed_addr
128 !llvm.module.flags = !{!0}
131 !0 = !{i32 1, !"wchar_size", i32 4}
132 !1 = !{!"clang version 10.0.0 (trunk 367381) (llvm/trunk 367388)"}
133 !2 = !{!3, !3, i64 0}
134 !3 = !{!"int", !4, i64 0}
135 !4 = !{!"omnipotent char", !5, i64 0}
136 !5 = !{!"Simple C/C++ TBAA"}
137 !6 = !{!7, !7, i64 0}
138 !7 = !{!"any pointer", !4, i64 0}