• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: asserts
2; RUN: opt < %s -force-vector-width=2 -force-vector-interleave=1 -loop-vectorize -S --debug-only=loop-vectorize 2>&1 | FileCheck %s
3
4; This test shows extremely high interleaving cost that, probably, should be fixed.
5; Due to the high cost, interleaving is not beneficial and the cost model chooses to scalarize
6; the load instructions.
7
8target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
9target triple = "aarch64--linux-gnu"
10
11%pair = type { i8, i8 }
12
13; CHECK-LABEL: test
14; CHECK: Found an estimated cost of 20 for VF 2 For instruction:   {{.*}} load i8
15; CHECK: Found an estimated cost of 0 for VF 2 For instruction:   {{.*}} load i8
16; CHECK: vector.body
17; CHECK: load i8
18; CHECK: br i1 {{.*}}, label %middle.block, label %vector.body
19
20define void @test(%pair* %p, i64 %n) {
21entry:
22  br label %for.body
23
24for.body:
25  %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
26  %tmp0 = getelementptr %pair, %pair* %p, i64 %i, i32 0
27  %tmp1 = load i8, i8* %tmp0, align 1
28  %tmp2 = getelementptr %pair, %pair* %p, i64 %i, i32 1
29  %tmp3 = load i8, i8* %tmp2, align 1
30  %i.next = add nuw nsw i64 %i, 1
31  %cond = icmp eq i64 %i.next, %n
32  br i1 %cond, label %for.end, label %for.body
33
34for.end:
35  ret void
36}
37
38