• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 < %s 2>&1 | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3@a = common local_unnamed_addr global i32 0, align 4
4@b = common local_unnamed_addr global i8 0, align 1
5
6; Function Attrs: norecurse nounwind uwtable
7define void @doit1() local_unnamed_addr{
8entry:
9  br label %for.body
10
11for.body:
12  %main.iv = phi i32 [ 0, %entry ], [ %inc, %for.body ]
13
14  %i8.iv = phi i8 [ 0, %entry ], [ %i8.add, %for.body ]
15  %i32.iv = phi i32 [ 0, %entry ], [ %i32.add, %for.body ]
16
17  %trunc.to.be.converted.to.new.iv = trunc i32 %i32.iv to i8
18  %i8.add = add i8 %i8.iv, %trunc.to.be.converted.to.new.iv
19
20  %noop.conv.under.pse = and i32 %i32.iv, 255
21  %i32.add = add nuw nsw i32 %noop.conv.under.pse, 9
22
23  %inc = add i32 %main.iv, 1
24  %tobool = icmp eq i32 %inc, 16
25  br i1 %tobool, label %for.cond.for.end_crit_edge, label %for.body
26
27; CHECK-LABEL: @doit1(
28; CHECK:       vector.body:
29; CHECK-NEXT:    [[MAIN_IV:%.*]] = phi i32 [ 0, [[VECTOR_PH:%.*]] ], [ [[MAIN_IV_NEXT:%.*]], [[VECTOR_BODY:%.*]] ]
30; CHECK-NEXT:    [[I8_IV:%.*]] = phi <4 x i8> [ zeroinitializer, [[VECTOR_PH]] ], [ [[I8_IV_NEXT:%.*]], [[VECTOR_BODY]] ]
31; CHECK-NEXT:    [[I32_IV:%.*]] = phi <4 x i32> [ <i32 0, i32 9, i32 18, i32 27>, [[VECTOR_PH]] ], [ [[I32_IV_NEXT:%.*]], [[VECTOR_BODY]] ]
32; CHECK-NEXT:    [[IV_FROM_TRUNC:%.*]] = phi <4 x i8> [ <i8 0, i8 9, i8 18, i8 27>, [[VECTOR_PH]] ], [ [[IV_FROM_TRUNC_NEXT:%.*]], [[VECTOR_BODY]] ]
33
34; CHECK-NEXT:    [[TMP7:%.*]] = add i32 [[MAIN_IV]], 0
35
36; CHECK-NEXT:    [[I8_IV_NEXT]] = add <4 x i8> [[I8_IV]], [[IV_FROM_TRUNC]]
37
38; CHECK-NEXT:    [[MAIN_IV_NEXT]] = add i32 [[MAIN_IV]], 4
39; CHECK-NEXT:    [[I32_IV_NEXT]] = add <4 x i32> [[I32_IV]], <i32 36, i32 36, i32 36, i32 36>
40; CHECK-NEXT:    [[IV_FROM_TRUNC_NEXT]] = add <4 x i8> [[IV_FROM_TRUNC]], <i8 36, i8 36, i8 36, i8 36>
41; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq i32 [[MAIN_IV_NEXT]], 16
42; CHECK-NEXT:    br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop !0
43
44for.cond.for.end_crit_edge:
45  store i8 %i8.add, i8* @b, align 1
46  br label %for.end
47
48for.end:
49  ret void
50}
51