1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
4 @g = common global [4 x float] zeroinitializer, align 16 ; <ptr> [#uses=4]
6 define void @foo(i32 %n, ptr nocapture %x) nounwind ssp {
9 %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
10 br i1 %0, label %bb.nph, label %return
12 bb.nph: ; preds = %entry
13 ; CHECK: movq _g@GOTPCREL(%rip), [[REG:%[a-z]+]]
14 %tmp = zext i32 %n to i64 ; <i64> [#uses=1]
17 bb: ; preds = %bb, %bb.nph
19 %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %bb ] ; <i64> [#uses=2]
20 %tmp9 = shl i64 %indvar, 2 ; <i64> [#uses=4]
21 %tmp1016 = or i64 %tmp9, 1 ; <i64> [#uses=1]
22 %scevgep = getelementptr float, ptr %x, i64 %tmp1016 ; <ptr> [#uses=1]
23 %tmp1117 = or i64 %tmp9, 2 ; <i64> [#uses=1]
24 %scevgep12 = getelementptr float, ptr %x, i64 %tmp1117 ; <ptr> [#uses=1]
25 %tmp1318 = or i64 %tmp9, 3 ; <i64> [#uses=1]
26 %scevgep14 = getelementptr float, ptr %x, i64 %tmp1318 ; <ptr> [#uses=1]
27 %x_addr.03 = getelementptr float, ptr %x, i64 %tmp9 ; <ptr> [#uses=1]
28 %1 = load float, ptr @g, align 16 ; <float> [#uses=1]
29 store float %1, ptr %x_addr.03, align 4
30 %2 = load float, ptr getelementptr inbounds ([4 x float], ptr @g, i64 0, i64 1), align 4 ; <float> [#uses=1]
31 store float %2, ptr %scevgep, align 4
32 %3 = load float, ptr getelementptr inbounds ([4 x float], ptr @g, i64 0, i64 2), align 8 ; <float> [#uses=1]
33 store float %3, ptr %scevgep12, align 4
34 %4 = load float, ptr getelementptr inbounds ([4 x float], ptr @g, i64 0, i64 3), align 4 ; <float> [#uses=1]
35 store float %4, ptr %scevgep14, align 4
36 %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2]
37 %exitcond = icmp eq i64 %indvar.next, %tmp ; <i1> [#uses=1]
38 br i1 %exitcond, label %return, label %bb
40 return: ; preds = %bb, %entry