1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -vectorizer-maximize-bandwidth -mtriple=powerpc64le-- -S \
3 ; RUN: -targetlibinfo -loop-simplify -loop-rotate -loop-vectorize \
4 ; RUN: -instcombine -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -force-vector-interleave=1 < %s | FileCheck %s
5 define dso_local double @test(float* %Arr) {
8 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
10 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
11 ; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <2 x double> [ zeroinitializer, [[ENTRY]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
12 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[INDEX]] to i64
13 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds float, float* [[ARR:%.*]], i64 [[TMP0]]
14 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast float* [[TMP1]] to <2 x float>*
15 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <2 x float>, <2 x float>* [[TMP2]], align 4
16 ; CHECK-NEXT: [[TMP3:%.*]] = fpext <2 x float> [[WIDE_LOAD]] to <2 x double>
17 ; CHECK-NEXT: [[TMP4:%.*]] = call fast <2 x double> @__sind2_P8(<2 x double> [[TMP3]])
18 ; CHECK-NEXT: [[TMP5]] = fadd fast <2 x double> [[VEC_PHI]], [[TMP4]]
19 ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 2
20 ; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], 128
21 ; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
22 ; CHECK: middle.block:
23 ; CHECK-NEXT: [[TMP7:%.*]] = call fast double @llvm.vector.reduce.fadd.v2f64(double -0.000000e+00, <2 x double> [[TMP5]])
24 ; CHECK-NEXT: ret double [[TMP7]]
30 %Sum.0 = phi double [ 0.000000e+00, %entry ], [ %add, %for.inc ]
31 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
32 %cmp = icmp slt i32 %i.0, 128
33 br i1 %cmp, label %for.body, label %for.cond.cleanup
39 %idxprom = sext i32 %i.0 to i64
40 %arrayidx = getelementptr inbounds float, float* %Arr, i64 %idxprom
41 %0 = load float, float* %arrayidx, align 4
42 %conv = fpext float %0 to double
43 %1 = call fast double @llvm.sin.f64(double %conv) #1
44 %add = fadd fast double %Sum.0, %1
48 %inc = add nsw i32 %i.0, 1
55 declare double @llvm.sin.f64(double) #0
56 declare <2 x double> @__sind2_P8(<2 x double>) #0
57 attributes #0 = { nounwind readnone speculatable willreturn }
58 attributes #1 = { "vector-function-abi-variant"="_ZGV_LLVM_N2v_llvm.sin.f64(__sind2_P8)" }