Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon < %s | FileCheck %s
      2 ; REQUIRES: asserts
      3 
      4 ; Check for a reasonable output. This testcase used to crash.
      5 ; CHECK: .size fred
      6 
      7 target triple = "hexagon"
      8 
      9 define void @fred() local_unnamed_addr #0 {
     10 entry:
     11   %0 = load i64, i64* undef, align 8
     12   %shr.i465 = lshr i64 %0, 48
     13   %trunc = trunc i64 %shr.i465 to i15
     14   switch i15 %trunc, label %if.end26 [
     15     i15 -1, label %if.then14
     16     i15 0, label %if.then21
     17   ]
     18 
     19 if.then14:                                        ; preds = %entry
     20   unreachable
     21 
     22 if.then21:                                        ; preds = %entry
     23   unreachable
     24 
     25 if.end26:                                         ; preds = %entry
     26   br label %if.end36
     27 
     28 if.end36:                                         ; preds = %if.end26
     29   %or.i335 = or i64 undef, undef
     30   %shl2.i322 = or i64 undef, -9223372036854775808
     31   br i1 undef, label %if.then44, label %lor.rhs.i
     32 
     33 lor.rhs.i:                                        ; preds = %if.end36
     34   br label %le128.exit
     35 
     36 le128.exit:                                       ; preds = %lor.rhs.i
     37   br i1 undef, label %if.then44, label %while.cond.preheader
     38 
     39 if.then44:                                        ; preds = %le128.exit, %if.end36
     40   %conv42544 = phi i64 [ 0, %le128.exit ], [ 1, %if.end36 ]
     41   br label %while.cond.preheader
     42 
     43 while.cond.preheader:                             ; preds = %if.then44, %le128.exit
     44   %aSig0.3.ph = phi i64 [ undef, %if.then44 ], [ %or.i335, %le128.exit ]
     45   %q.0.ph = phi i64 [ %conv42544, %if.then44 ], [ 0, %le128.exit ]
     46   br i1 undef, label %while.body.lr.ph, label %while.end
     47 
     48 while.body.lr.ph:                                 ; preds = %while.cond.preheader
     49   %shr.i263 = lshr i64 %shl2.i322, 32
     50   br label %while.body
     51 
     52 while.body:                                       ; preds = %exit312, %while.body.lr.ph
     53   %aSig0.3554 = phi i64 [ %aSig0.3.ph, %while.body.lr.ph ], [ %sub3.i205, %exit312 ]
     54   br label %while.body.i297
     55 
     56 while.body.i297:                                  ; preds = %while.body.i297, %while.body
     57   %z.045.i287 = phi i64 [ %sub.i290, %while.body.i297 ], [ undef, %while.body ]
     58   %sub.i290 = add i64 %z.045.i287, -4294967296
     59   %cmp3.i296 = icmp slt i64 undef, 0
     60   br i1 %cmp3.i296, label %while.body.i297, label %while.end.i305.loopexit
     61 
     62 while.end.i305.loopexit:                          ; preds = %while.body.i297
     63   %or14.i309 = or i64 0, %sub.i290
     64   br label %exit312
     65 
     66 exit312:                                          ; preds = %while.end.i305.loopexit
     67   %cmp50 = icmp ugt i64 %or14.i309, 4
     68   %cond = select i1 %cmp50, i64 undef, i64 0
     69   %shr3.i.i221 = lshr i64 %cond, 32
     70   %mul15.i11.i243 = mul nuw i64 %shr3.i.i221, %shr.i263
     71   %add20.i18.i250 = add i64 0, %mul15.i11.i243
     72   %add26.i23.i255 = add i64 %add20.i18.i250, 0
     73   %add3.i.i261 = add i64 %add26.i23.i255, 0
     74   %shl4.i215 = shl i64 %add3.i.i261, 61
     75   %or10.i = or i64 %shl4.i215, 0
     76   %shl2.i207 = shl i64 %aSig0.3554, 61
     77   %or.i209 = or i64 %shl2.i207, 0
     78   %sub1.i202 = add i64 0, %or.i209
     79   %sub3.i205 = sub i64 %sub1.i202, %or10.i
     80   %cmp47 = icmp sgt i32 undef, 61
     81   br i1 %cmp47, label %while.body, label %while.end.loopexit
     82 
     83 while.end.loopexit:                               ; preds = %exit312
     84   br label %while.end
     85 
     86 while.end:                                        ; preds = %while.end.loopexit, %while.cond.preheader
     87   %aSig0.3.lcssa = phi i64 [ %aSig0.3.ph, %while.cond.preheader ], [ %sub3.i205, %while.end.loopexit ]
     88   %q.0.lcssa = phi i64 [ %q.0.ph, %while.cond.preheader ], [ %cond, %while.end.loopexit ]
     89   br i1 undef, label %if.then56, label %if.else71
     90 
     91 if.then56:                                        ; preds = %while.end
     92   unreachable
     93 
     94 if.else71:                                        ; preds = %while.end
     95   %shr8.i155 = lshr i64 %aSig0.3.lcssa, 12
     96   br label %do.body
     97 
     98 do.body:                                          ; preds = %do.body, %if.else71
     99   %aSig0.5 = phi i64 [ %sub3.i151, %do.body ], [ %shr8.i155, %if.else71 ]
    100   %q.1 = phi i64 [ %inc, %do.body ], [ %q.0.lcssa, %if.else71 ]
    101   %inc = add i64 %q.1, 1
    102   %sub1.i148 = sub i64 %aSig0.5, 0
    103   %sub3.i151 = add i64 %sub1.i148, 0
    104   %cmp73 = icmp sgt i64 %sub3.i151, -1
    105   br i1 %cmp73, label %do.body, label %do.end
    106 
    107 do.end:                                           ; preds = %do.body
    108   %and = and i64 %inc, 1
    109   unreachable
    110 }
    111 
    112 attributes #0 = { nounwind }
    113