1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3
4
5define i32 @foo(i64* nocapture %perm, i32 %n) {
6; CHECK-LABEL: foo:
7; CHECK:       # %bb.0: # %entry
8; CHECK-NEXT:    movl %esi, %eax
9; CHECK-NEXT:    movaps {{.*#+}} xmm0 = [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0]
10; CHECK-NEXT:    movl %esi, %ecx
11; CHECK-NEXT:    andl $1, %ecx
12; CHECK-NEXT:    movaps {{.*#+}} xmm1 = [2,3]
13; CHECK-NEXT:    .p2align 4, 0x90
14; CHECK-NEXT:  .LBB0_1: # %body
15; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
16; CHECK-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
17; CHECK-NEXT:    movq -24(%rsp,%rcx,8), %rdx
18; CHECK-NEXT:    movups %xmm0, (%rdi,%rdx,8)
19; CHECK-NEXT:    testq %rdx, %rdx
20; CHECK-NEXT:    movaps %xmm1, %xmm0
21; CHECK-NEXT:    jne .LBB0_1
22; CHECK-NEXT:  # %bb.2: # %exit
23; CHECK-NEXT:    # kill: def $eax killed $eax killed $rax
24; CHECK-NEXT:    retq
25entry:
26  br label %body
27
28body:
29  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %entry ], [ <i64 2, i64 3>, %body ]
30  %l13 = extractelement <2 x i64> %vec.ind, i32 %n
31  %l14 = getelementptr inbounds i64, i64* %perm, i64 %l13
32  %l15 = bitcast i64* %l14 to <2 x i64>*
33  store <2 x i64> %vec.ind, <2 x i64>* %l15, align 8
34  %niter.ncmp.3 = icmp eq i64 %l13, 0
35  br i1 %niter.ncmp.3, label %exit, label %body
36
37exit:
38  ret i32 %n
39
40}
41
42