xref: /llvm-project/llvm/test/Transforms/LoopVectorize/X86/uniformshift.ll (revision 3097c60928c773d8c7f97432491c0e4367b6215c)
1; RUN: opt -mtriple=x86_64-apple-darwin -mattr=+sse2 -passes=loop-vectorize -debug-only=loop-vectorize -S < %s 2>&1 | FileCheck %s
2; REQUIRES: asserts
3
4; CHECK: 'foo'
5; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction:   %shift = ashr i32 %val, %k
6; CHECK: Cost of 2 for VF 2: WIDEN ir<%shift> = ashr ir<%val>, ir<%k>
7; CHECK: Cost of 2 for VF 4: WIDEN ir<%shift> = ashr ir<%val>, ir<%k>
8define void @foo(ptr nocapture %p, i32 %k) local_unnamed_addr #0 {
9entry:
10  br label %body
11
12body:
13  %i = phi i64 [ 0, %entry ], [ %next, %body ]
14  %ptr = getelementptr inbounds i32, ptr %p, i64 %i
15  %val = load i32, ptr %ptr, align 4
16  %shift = ashr i32 %val, %k
17  store i32 %shift, ptr %ptr, align 4
18  %next = add nuw nsw i64 %i, 1
19  %cmp = icmp eq i64 %next, 16
20  br i1 %cmp, label %exit, label %body
21
22exit:
23  ret void
24
25}
26