[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / SLPVectorizer / reordering-single-phi.ll
bloba70daf9cf8d60cfc61eb19fc7e615f394b70d6e4
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: %if x86-registered-target %{ opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux < %s | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -S --passes=slp-vectorizer -mtriple=aarch64-unknown-linux < %s | FileCheck %s %}
5 @a = external global [32000 x float], align 64
7 define void @test() {
8 ; CHECK-LABEL: define void @test() {
9 ; CHECK-NEXT:  [[ENTRY:.*]]:
10 ; CHECK-NEXT:    br label %[[FOR_BODY:.*]]
11 ; CHECK:       [[FOR_BODY]]:
12 ; CHECK-NEXT:    [[TMP0:%.*]] = phi float [ 0.000000e+00, %[[ENTRY]] ], [ [[TMP16:%.*]], %[[FOR_BODY]] ]
13 ; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]
14 ; CHECK-NEXT:    [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 1
15 ; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[TMP1]]
16 ; CHECK-NEXT:    [[ARRAYIDX6:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[INDVARS_IV]]
17 ; CHECK-NEXT:    [[TMP5:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 4
18 ; CHECK-NEXT:    [[ARRAYIDX31:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[TMP5]]
19 ; CHECK-NEXT:    [[TMP6:%.*]] = load float, ptr [[ARRAYIDX31]], align 4
20 ; CHECK-NEXT:    [[TMP14:%.*]] = load <4 x float>, ptr [[ARRAYIDX]], align 4
21 ; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <4 x float> [[TMP14]], <4 x float> poison, <4 x i32> <i32 poison, i32 0, i32 1, i32 2>
22 ; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <4 x float> [[TMP4]], float [[TMP0]], i32 0
23 ; CHECK-NEXT:    [[TMP15:%.*]] = fmul fast <4 x float> [[TMP11]], [[TMP14]]
24 ; CHECK-NEXT:    store <4 x float> [[TMP15]], ptr [[ARRAYIDX6]], align 4
25 ; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 5
26 ; CHECK-NEXT:    [[ARRAYIDX41:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[INDVARS_IV_NEXT]]
27 ; CHECK-NEXT:    [[TMP16]] = load float, ptr [[ARRAYIDX41]], align 4
28 ; CHECK-NEXT:    [[MUL45:%.*]] = fmul fast float [[TMP16]], [[TMP6]]
29 ; CHECK-NEXT:    store float [[MUL45]], ptr [[ARRAYIDX31]], align 4
30 ; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i64 [[INDVARS_IV]], 31990
31 ; CHECK-NEXT:    br i1 [[CMP2]], label %[[FOR_BODY]], label %[[EXIT:.*]]
32 ; CHECK:       [[EXIT]]:
33 ; CHECK-NEXT:    ret void
35 entry:
36   br label %for.body
38 for.body:
39   %0 = phi float [ 0.000000e+00, %entry ], [ %9, %for.body ]
40   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
41   %1 = add nuw nsw i64 %indvars.iv, 1
42   %arrayidx = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %1
43   %2 = load float, ptr %arrayidx, align 4
44   %arrayidx6 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %indvars.iv
45   %mul = fmul fast float %0, %2
46   store float %mul, ptr %arrayidx6, align 4
47   %3 = add nuw nsw i64 %indvars.iv, 2
48   %arrayidx11 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %3
49   %4 = load float, ptr %arrayidx11, align 4
50   %mul15 = fmul fast float %4, %2
51   store float %mul15, ptr %arrayidx, align 4
52   %5 = add nuw nsw i64 %indvars.iv, 3
53   %arrayidx21 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %5
54   %6 = load float, ptr %arrayidx21, align 4
55   %mul25 = fmul fast float %6, %4
56   store float %mul25, ptr %arrayidx11, align 4
57   %7 = add nuw nsw i64 %indvars.iv, 4
58   %arrayidx31 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %7
59   %8 = load float, ptr %arrayidx31, align 4
60   %mul35 = fmul fast float %8, %6
61   store float %mul35, ptr %arrayidx21, align 4
62   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
63   %arrayidx41 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %indvars.iv.next
64   %9 = load float, ptr %arrayidx41, align 4
65   %mul45 = fmul fast float %9, %8
66   store float %mul45, ptr %arrayidx31, align 4
67   %cmp2 = icmp ult i64 %indvars.iv, 31990
68   br i1 %cmp2, label %for.body, label %exit
70 exit:
71   ret void