1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O2 -mtriple=aarch64-linux-gnu < %s | FileCheck %s
4 declare i32 @test(i32) local_unnamed_addr
5 declare i32 @test1(i64) local_unnamed_addr
7 define i32 @assertzext(i32 %n, i1 %a, ptr %b) local_unnamed_addr {
8 ; CHECK-LABEL: assertzext:
9 ; CHECK: // %bb.0: // %entry
10 ; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
11 ; CHECK-NEXT: .cfi_def_cfa_offset 16
12 ; CHECK-NEXT: .cfi_offset w19, -8
13 ; CHECK-NEXT: .cfi_offset w30, -16
14 ; CHECK-NEXT: mov w8, #33066
15 ; CHECK-NEXT: tst w1, #0x1
16 ; CHECK-NEXT: movk w8, #28567, lsl #16
17 ; CHECK-NEXT: csel w19, wzr, w8, ne
18 ; CHECK-NEXT: cbnz w0, .LBB0_2
19 ; CHECK-NEXT: // %bb.1: // %if.then
20 ; CHECK-NEXT: mov w19, wzr
21 ; CHECK-NEXT: str wzr, [x2]
22 ; CHECK-NEXT: .LBB0_2: // %if.end
23 ; CHECK-NEXT: mov w0, w19
25 ; CHECK-NEXT: mov w0, w19
26 ; CHECK-NEXT: bl test1
27 ; CHECK-NEXT: mov w0, wzr
28 ; CHECK-NEXT: ldp x30, x19, [sp], #16 // 16-byte Folded Reload
31 %i = select i1 %a, i64 0, i64 66296709418
32 %conv.i = trunc i64 %i to i32
33 %cmp = icmp eq i32 %n, 0
34 br i1 %cmp, label %if.then, label %if.end
36 if.then: ; preds = %entry
37 store i32 0, ptr %b, align 4
40 if.end: ; preds = %if.then, %entry
41 %i1 = phi i32 [ 0, %if.then ], [ %conv.i, %entry ]
42 %call.i = tail call i32 @test(i32 %i1)
43 %i2 = sext i32 %i1 to i64
44 %call1.i = tail call i32 @test1(i64 %i2)
48 define i32 @assertsext(i32 %n, i8 %a) local_unnamed_addr {
49 ; CHECK-LABEL: assertsext:
50 ; CHECK: // %bb.0: // %entry
51 ; CHECK-NEXT: cbz w0, .LBB1_2
52 ; CHECK-NEXT: // %bb.1:
53 ; CHECK-NEXT: mov x0, xzr
54 ; CHECK-NEXT: b .LBB1_3
55 ; CHECK-NEXT: .LBB1_2: // %if.then
56 ; CHECK-NEXT: mov x9, #24575
57 ; CHECK-NEXT: sxtb w8, w1
58 ; CHECK-NEXT: movk x9, #15873, lsl #16
59 ; CHECK-NEXT: movk x9, #474, lsl #32
60 ; CHECK-NEXT: udiv x0, x9, x8
61 ; CHECK-NEXT: .LBB1_3: // %if.end
62 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
63 ; CHECK-NEXT: .cfi_def_cfa_offset 16
64 ; CHECK-NEXT: .cfi_offset w30, -16
65 ; CHECK-NEXT: bl test1
66 ; CHECK-NEXT: mov w0, wzr
67 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
70 %conv.i = sext i8 %a to i32
71 %cmp = icmp eq i32 %n, 0
72 br i1 %cmp, label %if.then, label %if.end
74 if.then: ; preds = %entry
75 %conv1 = zext i32 %conv.i to i64
76 %div = udiv i64 2036854775807, %conv1
79 if.end: ; preds = %if.then, %entry
80 %i1 = phi i64 [ %div, %if.then ], [ 0, %entry ]
81 %call1.i = tail call i32 @test1(i64 %i1)