Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -mcpu=cyclone -verify-machineinstrs -aarch64-ccmp | FileCheck %s
      2 target triple = "arm64-apple-ios7.0.0"
      3 
      4 @channelColumns = external global i64
      5 @channelTracks = external global i64
      6 @mazeRoute = external hidden unnamed_addr global i8*, align 8
      7 @TOP = external global i64*
      8 @BOT = external global i64*
      9 @netsAssign = external global i64*
     10 
     11 ; Function from yacr2/maze.c
     12 ; The branch at the end of %if.then is driven by %cmp5 and %cmp6.
     13 ; Isel converts the and i1 into two branches, and arm64-ccmp should not convert
     14 ; it back again. %cmp6 has much higher latency than %cmp5.
     15 ; CHECK: Maze1
     16 ; CHECK: %if.then
     17 ; CHECK: cmp x{{[0-9]+}}, #2
     18 ; CHECK-NEXT: b.lo
     19 ; CHECK: %if.then
     20 ; CHECK: cmp x{{[0-9]+}}, #2
     21 ; CHECK-NEXT: b.lo
     22 define i32 @Maze1() nounwind ssp {
     23 entry:
     24   %0 = load i64, i64* @channelColumns, align 8, !tbaa !0
     25   %cmp90 = icmp eq i64 %0, 0
     26   br i1 %cmp90, label %for.end, label %for.body
     27 
     28 for.body:                                         ; preds = %for.inc, %entry
     29   %1 = phi i64 [ %0, %entry ], [ %37, %for.inc ]
     30   %i.092 = phi i64 [ 1, %entry ], [ %inc53, %for.inc ]
     31   %numLeft.091 = phi i32 [ 0, %entry ], [ %numLeft.1, %for.inc ]
     32   %2 = load i8*, i8** @mazeRoute, align 8, !tbaa !3
     33   %arrayidx = getelementptr inbounds i8, i8* %2, i64 %i.092
     34   %3 = load i8, i8* %arrayidx, align 1, !tbaa !1
     35   %tobool = icmp eq i8 %3, 0
     36   br i1 %tobool, label %for.inc, label %if.then
     37 
     38 if.then:                                          ; preds = %for.body
     39   %4 = load i64*, i64** @TOP, align 8, !tbaa !3
     40   %arrayidx1 = getelementptr inbounds i64, i64* %4, i64 %i.092
     41   %5 = load i64, i64* %arrayidx1, align 8, !tbaa !0
     42   %6 = load i64*, i64** @netsAssign, align 8, !tbaa !3
     43   %arrayidx2 = getelementptr inbounds i64, i64* %6, i64 %5
     44   %7 = load i64, i64* %arrayidx2, align 8, !tbaa !0
     45   %8 = load i64*, i64** @BOT, align 8, !tbaa !3
     46   %arrayidx3 = getelementptr inbounds i64, i64* %8, i64 %i.092
     47   %9 = load i64, i64* %arrayidx3, align 8, !tbaa !0
     48   %arrayidx4 = getelementptr inbounds i64, i64* %6, i64 %9
     49   %10 = load i64, i64* %arrayidx4, align 8, !tbaa !0
     50   %cmp5 = icmp ugt i64 %i.092, 1
     51   %cmp6 = icmp ugt i64 %10, 1
     52   %or.cond = and i1 %cmp5, %cmp6
     53   br i1 %or.cond, label %land.lhs.true7, label %if.else
     54 
     55 land.lhs.true7:                                   ; preds = %if.then
     56   %11 = load i64, i64* @channelTracks, align 8, !tbaa !0
     57   %add = add i64 %11, 1
     58   %call = tail call fastcc i32 @Maze1Mech(i64 %i.092, i64 %add, i64 %10, i64 0, i64 %7, i32 -1, i32 -1)
     59   %tobool8 = icmp eq i32 %call, 0
     60   br i1 %tobool8, label %land.lhs.true7.if.else_crit_edge, label %if.then9
     61 
     62 land.lhs.true7.if.else_crit_edge:                 ; preds = %land.lhs.true7
     63   %.pre = load i64, i64* @channelColumns, align 8, !tbaa !0
     64   br label %if.else
     65 
     66 if.then9:                                         ; preds = %land.lhs.true7
     67   %12 = load i8*, i8** @mazeRoute, align 8, !tbaa !3
     68   %arrayidx10 = getelementptr inbounds i8, i8* %12, i64 %i.092
     69   store i8 0, i8* %arrayidx10, align 1, !tbaa !1
     70   %13 = load i64*, i64** @TOP, align 8, !tbaa !3
     71   %arrayidx11 = getelementptr inbounds i64, i64* %13, i64 %i.092
     72   %14 = load i64, i64* %arrayidx11, align 8, !tbaa !0
     73   tail call fastcc void @CleanNet(i64 %14)
     74   %15 = load i64*, i64** @BOT, align 8, !tbaa !3
     75   %arrayidx12 = getelementptr inbounds i64, i64* %15, i64 %i.092
     76   %16 = load i64, i64* %arrayidx12, align 8, !tbaa !0
     77   tail call fastcc void @CleanNet(i64 %16)
     78   br label %for.inc
     79 
     80 if.else:                                          ; preds = %land.lhs.true7.if.else_crit_edge, %if.then
     81   %17 = phi i64 [ %.pre, %land.lhs.true7.if.else_crit_edge ], [ %1, %if.then ]
     82   %cmp13 = icmp ult i64 %i.092, %17
     83   %or.cond89 = and i1 %cmp13, %cmp6
     84   br i1 %or.cond89, label %land.lhs.true16, label %if.else24
     85 
     86 land.lhs.true16:                                  ; preds = %if.else
     87   %18 = load i64, i64* @channelTracks, align 8, !tbaa !0
     88   %add17 = add i64 %18, 1
     89   %call18 = tail call fastcc i32 @Maze1Mech(i64 %i.092, i64 %add17, i64 %10, i64 0, i64 %7, i32 1, i32 -1)
     90   %tobool19 = icmp eq i32 %call18, 0
     91   br i1 %tobool19, label %if.else24, label %if.then20
     92 
     93 if.then20:                                        ; preds = %land.lhs.true16
     94   %19 = load i8*, i8** @mazeRoute, align 8, !tbaa !3
     95   %arrayidx21 = getelementptr inbounds i8, i8* %19, i64 %i.092
     96   store i8 0, i8* %arrayidx21, align 1, !tbaa !1
     97   %20 = load i64*, i64** @TOP, align 8, !tbaa !3
     98   %arrayidx22 = getelementptr inbounds i64, i64* %20, i64 %i.092
     99   %21 = load i64, i64* %arrayidx22, align 8, !tbaa !0
    100   tail call fastcc void @CleanNet(i64 %21)
    101   %22 = load i64*, i64** @BOT, align 8, !tbaa !3
    102   %arrayidx23 = getelementptr inbounds i64, i64* %22, i64 %i.092
    103   %23 = load i64, i64* %arrayidx23, align 8, !tbaa !0
    104   tail call fastcc void @CleanNet(i64 %23)
    105   br label %for.inc
    106 
    107 if.else24:                                        ; preds = %land.lhs.true16, %if.else
    108   br i1 %cmp5, label %land.lhs.true26, label %if.else36
    109 
    110 land.lhs.true26:                                  ; preds = %if.else24
    111   %24 = load i64, i64* @channelTracks, align 8, !tbaa !0
    112   %cmp27 = icmp ult i64 %7, %24
    113   br i1 %cmp27, label %land.lhs.true28, label %if.else36
    114 
    115 land.lhs.true28:                                  ; preds = %land.lhs.true26
    116   %add29 = add i64 %24, 1
    117   %call30 = tail call fastcc i32 @Maze1Mech(i64 %i.092, i64 0, i64 %7, i64 %add29, i64 %10, i32 -1, i32 1)
    118   %tobool31 = icmp eq i32 %call30, 0
    119   br i1 %tobool31, label %if.else36, label %if.then32
    120 
    121 if.then32:                                        ; preds = %land.lhs.true28
    122   %25 = load i8*, i8** @mazeRoute, align 8, !tbaa !3
    123   %arrayidx33 = getelementptr inbounds i8, i8* %25, i64 %i.092
    124   store i8 0, i8* %arrayidx33, align 1, !tbaa !1
    125   %26 = load i64*, i64** @TOP, align 8, !tbaa !3
    126   %arrayidx34 = getelementptr inbounds i64, i64* %26, i64 %i.092
    127   %27 = load i64, i64* %arrayidx34, align 8, !tbaa !0
    128   tail call fastcc void @CleanNet(i64 %27)
    129   %28 = load i64*, i64** @BOT, align 8, !tbaa !3
    130   %arrayidx35 = getelementptr inbounds i64, i64* %28, i64 %i.092
    131   %29 = load i64, i64* %arrayidx35, align 8, !tbaa !0
    132   tail call fastcc void @CleanNet(i64 %29)
    133   br label %for.inc
    134 
    135 if.else36:                                        ; preds = %land.lhs.true28, %land.lhs.true26, %if.else24
    136   %30 = load i64, i64* @channelColumns, align 8, !tbaa !0
    137   %cmp37 = icmp ult i64 %i.092, %30
    138   br i1 %cmp37, label %land.lhs.true38, label %if.else48
    139 
    140 land.lhs.true38:                                  ; preds = %if.else36
    141   %31 = load i64, i64* @channelTracks, align 8, !tbaa !0
    142   %cmp39 = icmp ult i64 %7, %31
    143   br i1 %cmp39, label %land.lhs.true40, label %if.else48
    144 
    145 land.lhs.true40:                                  ; preds = %land.lhs.true38
    146   %add41 = add i64 %31, 1
    147   %call42 = tail call fastcc i32 @Maze1Mech(i64 %i.092, i64 0, i64 %7, i64 %add41, i64 %10, i32 1, i32 1)
    148   %tobool43 = icmp eq i32 %call42, 0
    149   br i1 %tobool43, label %if.else48, label %if.then44
    150 
    151 if.then44:                                        ; preds = %land.lhs.true40
    152   %32 = load i8*, i8** @mazeRoute, align 8, !tbaa !3
    153   %arrayidx45 = getelementptr inbounds i8, i8* %32, i64 %i.092
    154   store i8 0, i8* %arrayidx45, align 1, !tbaa !1
    155   %33 = load i64*, i64** @TOP, align 8, !tbaa !3
    156   %arrayidx46 = getelementptr inbounds i64, i64* %33, i64 %i.092
    157   %34 = load i64, i64* %arrayidx46, align 8, !tbaa !0
    158   tail call fastcc void @CleanNet(i64 %34)
    159   %35 = load i64*, i64** @BOT, align 8, !tbaa !3
    160   %arrayidx47 = getelementptr inbounds i64, i64* %35, i64 %i.092
    161   %36 = load i64, i64* %arrayidx47, align 8, !tbaa !0
    162   tail call fastcc void @CleanNet(i64 %36)
    163   br label %for.inc
    164 
    165 if.else48:                                        ; preds = %land.lhs.true40, %land.lhs.true38, %if.else36
    166   %inc = add nsw i32 %numLeft.091, 1
    167   br label %for.inc
    168 
    169 for.inc:                                          ; preds = %if.else48, %if.then44, %if.then32, %if.then20, %if.then9, %for.body
    170   %numLeft.1 = phi i32 [ %numLeft.091, %if.then9 ], [ %numLeft.091, %if.then20 ], [ %numLeft.091, %if.then32 ], [ %numLeft.091, %if.then44 ], [ %inc, %if.else48 ], [ %numLeft.091, %for.body ]
    171   %inc53 = add i64 %i.092, 1
    172   %37 = load i64, i64* @channelColumns, align 8, !tbaa !0
    173   %cmp = icmp ugt i64 %inc53, %37
    174   br i1 %cmp, label %for.end, label %for.body
    175 
    176 for.end:                                          ; preds = %for.inc, %entry
    177   %numLeft.0.lcssa = phi i32 [ 0, %entry ], [ %numLeft.1, %for.inc ]
    178   ret i32 %numLeft.0.lcssa
    179 }
    180 
    181 ; Materializable
    182 declare hidden fastcc i32 @Maze1Mech(i64, i64, i64, i64, i64, i32, i32) nounwind ssp
    183 
    184 ; Materializable
    185 declare hidden fastcc void @CleanNet(i64) nounwind ssp
    186 
    187 !0 = !{!"long", !1}
    188 !1 = !{!"omnipotent char", !2}
    189 !2 = !{!"Simple C/C++ TBAA"}
    190 !3 = !{!"any pointer", !1}
    191