1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=static < %s | FileCheck %s --check-prefix=CHECK
3 ; RUN: llc -mcpu=atom -mtriple=x86_64-unknown-linux-gnu -relocation-model=static < %s | FileCheck %s --check-prefix=ATOM
5 @A = external dso_local global [0 x double]
7 define void @foo(i64 %n) nounwind {
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: testq %rdi, %rdi
11 ; CHECK-NEXT: jle .LBB0_3
12 ; CHECK-NEXT: # %bb.1: # %for.body.preheader
13 ; CHECK-NEXT: xorl %eax, %eax
14 ; CHECK-NEXT: movsd {{.*#+}} xmm0 = [2.2999999999999998E+0,0.0E+0]
15 ; CHECK-NEXT: .p2align 4, 0x90
16 ; CHECK-NEXT: .LBB0_2: # %for.body
17 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
18 ; CHECK-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
19 ; CHECK-NEXT: mulsd %xmm0, %xmm1
20 ; CHECK-NEXT: movsd %xmm1, A(,%rax,8)
21 ; CHECK-NEXT: incq %rax
22 ; CHECK-NEXT: cmpq %rax, %rdi
23 ; CHECK-NEXT: jne .LBB0_2
24 ; CHECK-NEXT: .LBB0_3: # %for.end
28 ; ATOM: # %bb.0: # %entry
29 ; ATOM-NEXT: testq %rdi, %rdi
30 ; ATOM-NEXT: jle .LBB0_3
31 ; ATOM-NEXT: # %bb.1: # %for.body.preheader
32 ; ATOM-NEXT: xorl %eax, %eax
33 ; ATOM-NEXT: movsd {{.*#+}} xmm0 = [2.2999999999999998E+0,0.0E+0]
34 ; ATOM-NEXT: .p2align 4, 0x90
35 ; ATOM-NEXT: .LBB0_2: # %for.body
36 ; ATOM-NEXT: # =>This Inner Loop Header: Depth=1
37 ; ATOM-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
38 ; ATOM-NEXT: mulsd %xmm0, %xmm1
39 ; ATOM-NEXT: movsd %xmm1, A(,%rax,8)
40 ; ATOM-NEXT: leaq 1(%rax), %rax
41 ; ATOM-NEXT: cmpq %rax, %rdi
42 ; ATOM-NEXT: jne .LBB0_2
43 ; ATOM-NEXT: .LBB0_3: # %for.end
50 %cmp5 = icmp sgt i64 %n, 0
51 br i1 %cmp5, label %for.body, label %for.end
54 %i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
55 %arrayidx = getelementptr [0 x double], ptr @A, i64 0, i64 %i.06
56 %tmp3 = load double, ptr %arrayidx, align 8
57 %mul = fmul double %tmp3, 2.300000e+00
58 store double %mul, ptr %arrayidx, align 8
59 %inc = add nsw i64 %i.06, 1
60 %exitcond = icmp eq i64 %inc, %n
61 br i1 %exitcond, label %for.end, label %for.body