Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
      2 
      3 ; CHECK: r{{[0-9]+}} = add({{pc|PC}},##.LJTI{{[0-9_]+}}@PCREL)
      4 ; CHECK: r{{[0-9]+}} = memw(r{{[0-9]}}+##g0@GOT
      5 ; CHECK: r{{[0-9]+}} = add({{pc|PC}},##_GLOBAL_OFFSET_TABLE_@PCREL)
      6 ; CHECK: r{{[0-9]+}} = memw(r{{[0-9]*}}+##g1@GOT)
      7 
      8 @g0 = external global i32
      9 @g1 = external global i32
     10 
     11 ; Function Attrs: nounwind
     12 define i32 @f0(i32 %a0) #0 {
     13 b0:
     14   switch i32 %a0, label %b8 [
     15     i32 2, label %b1
     16     i32 3, label %b2
     17     i32 4, label %b3
     18     i32 5, label %b4
     19     i32 6, label %b5
     20     i32 7, label %b6
     21     i32 8, label %b7
     22   ]
     23 
     24 b1:                                               ; preds = %b0
     25   tail call void bitcast (void (...)* @f1 to void ()*)() #0
     26   br label %b8
     27 
     28 b2:                                               ; preds = %b0
     29   %v0 = load i32, i32* @g0, align 4, !tbaa !0
     30   %v1 = add nsw i32 %v0, 99
     31   br label %b9
     32 
     33 b3:                                               ; preds = %b0
     34   %v2 = load i32, i32* @g1, align 4, !tbaa !0
     35   %v3 = load i32, i32* @g0, align 4, !tbaa !0
     36   %v4 = add nsw i32 %v3, %v2
     37   tail call void @f2(i32 %v4) #0
     38   br label %b8
     39 
     40 b4:                                               ; preds = %b0
     41   %v5 = load i32, i32* @g1, align 4, !tbaa !0
     42   %v6 = load i32, i32* @g0, align 4, !tbaa !0
     43   %v7 = mul nsw i32 %v6, 2
     44   %v8 = add i32 %v5, 9
     45   %v9 = add i32 %v8, %v7
     46   tail call void @f2(i32 %v9) #0
     47   br label %b8
     48 
     49 b5:                                               ; preds = %b0
     50   br label %b8
     51 
     52 b6:                                               ; preds = %b0
     53   br label %b7
     54 
     55 b7:                                               ; preds = %b6, %b0
     56   %v10 = phi i32 [ 2, %b0 ], [ 4, %b6 ]
     57   br label %b8
     58 
     59 b8:                                               ; preds = %b7, %b5, %b4, %b3, %b1, %b0
     60   %v11 = phi i32 [ %a0, %b0 ], [ %v10, %b7 ], [ 7, %b5 ], [ 5, %b4 ], [ 4, %b3 ], [ 2, %b1 ]
     61   %v12 = add nsw i32 %v11, 522
     62   br label %b9
     63 
     64 b9:                                               ; preds = %b8, %b2
     65   %v13 = phi i32 [ %v12, %b8 ], [ %v1, %b2 ]
     66   ret i32 %v13
     67 }
     68 
     69 declare void @f1(...)
     70 
     71 declare void @f2(i32)
     72 
     73 attributes #0 = { nounwind }
     74 
     75 !0 = !{!1, !1, i64 0}
     76 !1 = !{!"int", !2}
     77 !2 = !{!"omnipotent char", !3}
     78 !3 = !{!"Simple C/C++ TBAA"}
     79