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(ptr %b) local_unnamed_addr {
10 ; CHECK: @ %bb.0: @ %entry
11 ; CHECK-NEXT: ldr r1, .LCPI0_0
12 ; CHECK-NEXT: ldr r1, [r1]
13 ; CHECK-NEXT: cmp r1, r0
14 ; CHECK-NEXT: movne pc, lr
15 ; CHECK-NEXT: .LBB0_1: @ %if.then
16 ; CHECK-NEXT: push {r4, lr}
17 ; CHECK-NEXT: mov r4, r0
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.2:
24 ; CHECK-NEXT: .LCPI0_0:
27 %0 = load i32, ptr @a, align 4, !tbaa !2
28 %conv = sext i32 %0 to i64
29 %1 = inttoptr i64 %conv to ptr
30 %cmp = icmp eq ptr %1, %b
31 br i1 %cmp, label %if.then, label %if.end
33 if.then: ; preds = %entry
34 %call = tail call signext i32 @callVoid()
35 %call2 = tail call signext i32 @callNonVoid(ptr %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(ptr) local_unnamed_addr
47 define dso_local signext i32 @test2(ptr %p1) local_unnamed_addr {
49 ; CHECK: @ %bb.0: @ %entry
50 ; CHECK-NEXT: cmp r0, #0
51 ; CHECK-NEXT: beq .LBB1_2
52 ; CHECK-NEXT: @ %bb.1: @ %if.end
53 ; CHECK-NEXT: ldr r1, .LCPI1_0
54 ; CHECK-NEXT: ldr r1, [r1]
55 ; CHECK-NEXT: cmp r1, r0
56 ; CHECK-NEXT: beq .LBB1_3
57 ; CHECK-NEXT: .LBB1_2: @ %return
58 ; CHECK-NEXT: mov r0, #0
59 ; CHECK-NEXT: mov pc, lr
60 ; CHECK-NEXT: .LBB1_3: @ %if.then2
61 ; CHECK-NEXT: push {r4, lr}
62 ; CHECK-NEXT: mov r4, r0
63 ; CHECK-NEXT: bl callVoid
64 ; CHECK-NEXT: mov r0, r4
65 ; CHECK-NEXT: pop {r4, lr}
66 ; CHECK-NEXT: b callNonVoid
67 ; CHECK-NEXT: .p2align 2
68 ; CHECK-NEXT: @ %bb.4:
69 ; CHECK-NEXT: .LCPI1_0:
72 %tobool = icmp eq ptr %p1, null
73 br i1 %tobool, label %return, label %if.end
75 if.end: ; preds = %entry
76 %0 = load i32, ptr @a, align 4, !tbaa !2
77 %conv = sext i32 %0 to i64
78 %1 = inttoptr i64 %conv to ptr
79 %cmp = icmp eq ptr %1, %p1
80 br i1 %cmp, label %if.then2, label %return
82 if.then2: ; preds = %if.end
83 %call = tail call signext i32 @callVoid()
84 %call3 = tail call signext i32 @callNonVoid(ptr nonnull %p1)
87 return: ; preds = %if.end, %entry, %if.then2
88 %retval.0 = phi i32 [ %call3, %if.then2 ], [ 0, %entry ], [ 0, %if.end ]
93 define dso_local ptr @test3(ptr nocapture %p1, i8 zeroext %p2) local_unnamed_addr {
95 ; CHECK: @ %bb.0: @ %entry
96 ; CHECK-NEXT: push {r4, r5, r11, lr}
97 ; CHECK-NEXT: ldr r4, [r0]
98 ; CHECK-NEXT: cmp r4, #0
99 ; CHECK-NEXT: beq .LBB2_2
100 ; CHECK-NEXT: @ %bb.1: @ %land.rhs
101 ; CHECK-NEXT: mov r5, r0
102 ; CHECK-NEXT: mov r0, r4
104 ; CHECK-NEXT: str r0, [r5]
105 ; CHECK-NEXT: .LBB2_2: @ %land.end
106 ; CHECK-NEXT: mov r0, r4
107 ; CHECK-NEXT: pop {r4, r5, r11, lr}
108 ; CHECK-NEXT: mov pc, lr
110 %0 = load ptr, ptr %p1, align 8, !tbaa !6
111 %tobool = icmp eq ptr %0, null
112 br i1 %tobool, label %land.end, label %land.rhs
114 land.rhs: ; preds = %entry
115 %call = tail call ptr @bar(ptr nonnull %0, i8 zeroext %p2)
116 store ptr %call, ptr %p1, align 8, !tbaa !6
119 land.end: ; preds = %entry, %land.rhs
123 declare ptr @bar(ptr, i8 zeroext) local_unnamed_addr
126 !llvm.module.flags = !{!0}
129 !0 = !{i32 1, !"wchar_size", i32 4}
130 !1 = !{!"clang version 10.0.0 (trunk 367381) (llvm/trunk 367388)"}
131 !2 = !{!3, !3, i64 0}
132 !3 = !{!"int", !4, i64 0}
133 !4 = !{!"omnipotent char", !5, i64 0}
134 !5 = !{!"Simple C/C++ TBAA"}
135 !6 = !{!7, !7, i64 0}
136 !7 = !{!"any pointer", !4, i64 0}