Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
      2 
      3 @t = weak global i32 ()* null
      4 @x = external global i32, align 4
      5 
      6 define void @t2() {
      7 ; CHECK-LABEL: t2:
      8 ; CHECK: adrp	x[[GOTADDR:[0-9]+]], _t@GOTPAGE
      9 ; CHECK: ldr	x[[ADDR:[0-9]+]], [x[[GOTADDR]], _t@GOTPAGEOFF]
     10 ; CHECK: ldr	x[[DEST:[0-9]+]], [x[[ADDR]]]
     11 ; CHECK: br	x[[DEST]]
     12   %tmp = load i32 ()*, i32 ()** @t
     13   %tmp.upgrd.2 = tail call i32 %tmp()
     14   ret void
     15 }
     16 
     17 define void @t3() {
     18 ; CHECK-LABEL: t3:
     19 ; CHECK: b	_t2
     20   tail call void @t2()
     21   ret void
     22 }
     23 
     24 define double @t4(double %a) nounwind readonly ssp {
     25 ; CHECK-LABEL: t4:
     26 ; CHECK: b	_sin
     27   %tmp = tail call double @sin(double %a) nounwind readonly
     28   ret double %tmp
     29 }
     30 
     31 define float @t5(float %a) nounwind readonly ssp {
     32 ; CHECK-LABEL: t5:
     33 ; CHECK: b	_sinf
     34   %tmp = tail call float @sinf(float %a) nounwind readonly
     35   ret float %tmp
     36 }
     37 
     38 define void @t7() nounwind {
     39 ; CHECK-LABEL: t7:
     40 ; CHECK: b	_foo
     41 ; CHECK: b	_bar
     42 
     43   br i1 undef, label %bb, label %bb1.lr.ph
     44 
     45 bb1.lr.ph:                                        ; preds = %entry
     46   tail call void @bar() nounwind
     47   ret void
     48 
     49 bb:                                               ; preds = %entry
     50   tail call void @foo() nounwind
     51   ret void
     52 }
     53 
     54 define i32 @t8(i32 %x) nounwind ssp {
     55 ; CHECK-LABEL: t8:
     56 ; CHECK: b	_c
     57 ; CHECK: b	_a
     58 ; CHECK: b	_b
     59   %and = and i32 %x, 1
     60   %tobool = icmp eq i32 %and, 0
     61   br i1 %tobool, label %if.end, label %if.then
     62 
     63 if.then:                                          ; preds = %entry
     64   %call = tail call i32 @a(i32 %x) nounwind
     65   br label %return
     66 
     67 if.end:                                           ; preds = %entry
     68   %and1 = and i32 %x, 2
     69   %tobool2 = icmp eq i32 %and1, 0
     70   br i1 %tobool2, label %if.end5, label %if.then3
     71 
     72 if.then3:                                         ; preds = %if.end
     73   %call4 = tail call i32 @b(i32 %x) nounwind
     74   br label %return
     75 
     76 if.end5:                                          ; preds = %if.end
     77   %call6 = tail call i32 @c(i32 %x) nounwind
     78   br label %return
     79 
     80 return:                                           ; preds = %if.end5, %if.then3, %if.then
     81   %retval.0 = phi i32 [ %call, %if.then ], [ %call4, %if.then3 ], [ %call6, %if.end5 ]
     82   ret i32 %retval.0
     83 }
     84 
     85 declare float @sinf(float) nounwind readonly
     86 declare double @sin(double) nounwind readonly
     87 declare void @bar() nounwind
     88 declare void @foo() nounwind
     89 declare i32 @a(i32)
     90 declare i32 @b(i32)
     91 declare i32 @c(i32)
     92