[WinEH] Add some test cases I forgot to add to previous commits
[oota-llvm.git] / test / CodeGen / AArch64 / arm64-addr-type-promotion.ll
1 ; RUN: llc -march arm64 < %s | FileCheck %s
2 ; rdar://13452552
3 ; ModuleID = 'reduced_test.ll'
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32:64-S128"
5 target triple = "arm64-apple-ios3.0.0"
6
7 @block = common global i8* null, align 8
8
9 define zeroext i8 @fullGtU(i32 %i1, i32 %i2) {
10 ; CHECK: fullGtU
11 ; CHECK: adrp [[PAGE:x[0-9]+]], _block@GOTPAGE
12 ; CHECK: ldr [[ADDR:x[0-9]+]], {{\[}}[[PAGE]], _block@GOTPAGEOFF]
13 ; CHECK-NEXT: ldr [[BLOCKBASE:x[0-9]+]], {{\[}}[[ADDR]]]
14 ; CHECK-NEXT: ldrb [[BLOCKVAL1:w[0-9]+]], {{\[}}[[BLOCKBASE]],  w0, sxtw]
15 ; CHECK-NEXT: ldrb [[BLOCKVAL2:w[0-9]+]], {{\[}}[[BLOCKBASE]], w1, sxtw]
16 ; CHECK-NEXT cmp [[BLOCKVAL1]], [[BLOCKVAL2]]
17 ; CHECK-NEXT b.ne
18 ; Next BB
19 ; CHECK: add [[BLOCKBASE2:x[0-9]+]], [[BLOCKBASE]], w1, sxtw
20 ; CHECK-NEXT: add [[BLOCKBASE1:x[0-9]+]], [[BLOCKBASE]], w0, sxtw
21 ; CHECK-NEXT: ldrb [[LOADEDVAL1:w[0-9]+]], {{\[}}[[BLOCKBASE1]], #1]
22 ; CHECK-NEXT: ldrb [[LOADEDVAL2:w[0-9]+]], {{\[}}[[BLOCKBASE2]], #1]
23 ; CHECK-NEXT: cmp [[LOADEDVAL1]], [[LOADEDVAL2]]
24 ; CHECK-NEXT: b.ne
25 ; Next BB
26 ; CHECK: ldrb [[LOADEDVAL3:w[0-9]+]], {{\[}}[[BLOCKBASE1]], #2]
27 ; CHECK-NEXT: ldrb [[LOADEDVAL4:w[0-9]+]], {{\[}}[[BLOCKBASE2]], #2]
28 ; CHECK-NEXT: cmp [[LOADEDVAL3]], [[LOADEDVAL4]]
29 entry:
30   %idxprom = sext i32 %i1 to i64
31   %tmp = load i8*, i8** @block, align 8
32   %arrayidx = getelementptr inbounds i8, i8* %tmp, i64 %idxprom
33   %tmp1 = load i8, i8* %arrayidx, align 1
34   %idxprom1 = sext i32 %i2 to i64
35   %arrayidx2 = getelementptr inbounds i8, i8* %tmp, i64 %idxprom1
36   %tmp2 = load i8, i8* %arrayidx2, align 1
37   %cmp = icmp eq i8 %tmp1, %tmp2
38   br i1 %cmp, label %if.end, label %if.then
39
40 if.then:                                          ; preds = %entry
41   %cmp7 = icmp ugt i8 %tmp1, %tmp2
42   %conv9 = zext i1 %cmp7 to i8
43   br label %return
44
45 if.end:                                           ; preds = %entry
46   %inc = add nsw i32 %i1, 1
47   %inc10 = add nsw i32 %i2, 1
48   %idxprom11 = sext i32 %inc to i64
49   %arrayidx12 = getelementptr inbounds i8, i8* %tmp, i64 %idxprom11
50   %tmp3 = load i8, i8* %arrayidx12, align 1
51   %idxprom13 = sext i32 %inc10 to i64
52   %arrayidx14 = getelementptr inbounds i8, i8* %tmp, i64 %idxprom13
53   %tmp4 = load i8, i8* %arrayidx14, align 1
54   %cmp17 = icmp eq i8 %tmp3, %tmp4
55   br i1 %cmp17, label %if.end25, label %if.then19
56
57 if.then19:                                        ; preds = %if.end
58   %cmp22 = icmp ugt i8 %tmp3, %tmp4
59   %conv24 = zext i1 %cmp22 to i8
60   br label %return
61
62 if.end25:                                         ; preds = %if.end
63   %inc26 = add nsw i32 %i1, 2
64   %inc27 = add nsw i32 %i2, 2
65   %idxprom28 = sext i32 %inc26 to i64
66   %arrayidx29 = getelementptr inbounds i8, i8* %tmp, i64 %idxprom28
67   %tmp5 = load i8, i8* %arrayidx29, align 1
68   %idxprom30 = sext i32 %inc27 to i64
69   %arrayidx31 = getelementptr inbounds i8, i8* %tmp, i64 %idxprom30
70   %tmp6 = load i8, i8* %arrayidx31, align 1
71   %cmp34 = icmp eq i8 %tmp5, %tmp6
72   br i1 %cmp34, label %return, label %if.then36
73
74 if.then36:                                        ; preds = %if.end25
75   %cmp39 = icmp ugt i8 %tmp5, %tmp6
76   %conv41 = zext i1 %cmp39 to i8
77   br label %return
78
79 return:                                           ; preds = %if.then36, %if.end25, %if.then19, %if.then
80   %retval.0 = phi i8 [ %conv9, %if.then ], [ %conv24, %if.then19 ], [ %conv41, %if.then36 ], [ 0, %if.end25 ]
81   ret i8 %retval.0
82 }