blob: 7516261e4fdf6e427888260411ca70efadf33b9d [file]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt < %s -mcpu=pwr7 -mattr=+vsx -passes=loop-vectorize -S | FileCheck %s
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
%struct.GlobalData = type { [32000 x float], [3 x i32], [4 x i8], [32000 x float], [5 x i32], [12 x i8], [32000 x float], [7 x i32], [4 x i8], [32000 x float], [11 x i32], [4 x i8], [32000 x float], [13 x i32], [12 x i8], [256 x [256 x float]], [17 x i32], [12 x i8], [256 x [256 x float]], [19 x i32], [4 x i8], [256 x [256 x float]], [23 x i32], [4 x i8], [256 x [256 x float]] }
@global_data = external global %struct.GlobalData, align 16
@ntimes = external hidden unnamed_addr global i32, align 4
define signext i32 @s173() {
; CHECK-LABEL: define signext i32 @s173(
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @ntimes, align 4
; CHECK-NEXT: [[CMP21:%.*]] = icmp sgt i32 [[TMP0]], 0
; CHECK-NEXT: br i1 [[CMP21]], label %[[FOR_COND1_PREHEADER_PREHEADER:.*]], label %[[FOR_END12:.*]]
; CHECK: [[FOR_COND1_PREHEADER_PREHEADER]]:
; CHECK-NEXT: br label %[[FOR_COND1_PREHEADER:.*]]
; CHECK: [[FOR_COND1_PREHEADER]]:
; CHECK-NEXT: [[NL_022:%.*]] = phi i32 [ [[INC11:%.*]], %[[FOR_END:.*]] ], [ 0, %[[FOR_COND1_PREHEADER_PREHEADER]] ]
; CHECK-NEXT: br label %[[VECTOR_PH:.*]]
; CHECK: [[VECTOR_PH]]:
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
; CHECK: [[VECTOR_BODY]]:
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_GLOBALDATA:%.*]], ptr @global_data, i64 0, i32 0, i64 [[INDEX]]
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 4
; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 8
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 12
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 16
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 20
; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 24
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, ptr [[TMP1]], i64 28
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP1]], align 4
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x float>, ptr [[TMP2]], align 4
; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP3]], align 4
; CHECK-NEXT: [[WIDE_LOAD3:%.*]] = load <4 x float>, ptr [[TMP4]], align 4
; CHECK-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x float>, ptr [[TMP5]], align 4
; CHECK-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP6]], align 4
; CHECK-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP7]], align 4
; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, ptr [[TMP8]], align 4
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT_GLOBALDATA]], ptr @global_data, i64 0, i32 3, i64 [[INDEX]]
; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 4
; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 8
; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 12
; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 16
; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 20
; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 24
; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds float, ptr [[TMP9]], i64 28
; CHECK-NEXT: [[WIDE_LOAD8:%.*]] = load <4 x float>, ptr [[TMP9]], align 4
; CHECK-NEXT: [[WIDE_LOAD9:%.*]] = load <4 x float>, ptr [[TMP10]], align 4
; CHECK-NEXT: [[WIDE_LOAD10:%.*]] = load <4 x float>, ptr [[TMP11]], align 4
; CHECK-NEXT: [[WIDE_LOAD11:%.*]] = load <4 x float>, ptr [[TMP12]], align 4
; CHECK-NEXT: [[WIDE_LOAD12:%.*]] = load <4 x float>, ptr [[TMP13]], align 4
; CHECK-NEXT: [[WIDE_LOAD13:%.*]] = load <4 x float>, ptr [[TMP14]], align 4
; CHECK-NEXT: [[WIDE_LOAD14:%.*]] = load <4 x float>, ptr [[TMP15]], align 4
; CHECK-NEXT: [[WIDE_LOAD15:%.*]] = load <4 x float>, ptr [[TMP16]], align 4
; CHECK-NEXT: [[TMP17:%.*]] = fadd <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD8]]
; CHECK-NEXT: [[TMP18:%.*]] = fadd <4 x float> [[WIDE_LOAD1]], [[WIDE_LOAD9]]
; CHECK-NEXT: [[TMP19:%.*]] = fadd <4 x float> [[WIDE_LOAD2]], [[WIDE_LOAD10]]
; CHECK-NEXT: [[TMP20:%.*]] = fadd <4 x float> [[WIDE_LOAD3]], [[WIDE_LOAD11]]
; CHECK-NEXT: [[TMP21:%.*]] = fadd <4 x float> [[WIDE_LOAD4]], [[WIDE_LOAD12]]
; CHECK-NEXT: [[TMP22:%.*]] = fadd <4 x float> [[WIDE_LOAD5]], [[WIDE_LOAD13]]
; CHECK-NEXT: [[TMP23:%.*]] = fadd <4 x float> [[WIDE_LOAD6]], [[WIDE_LOAD14]]
; CHECK-NEXT: [[TMP24:%.*]] = fadd <4 x float> [[WIDE_LOAD7]], [[WIDE_LOAD15]]
; CHECK-NEXT: [[TMP25:%.*]] = add nsw i64 [[INDEX]], 16000
; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds [[STRUCT_GLOBALDATA]], ptr @global_data, i64 0, i32 0, i64 [[TMP25]]
; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 4
; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 8
; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 12
; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 16
; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 20
; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 24
; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds float, ptr [[TMP26]], i64 28
; CHECK-NEXT: store <4 x float> [[TMP17]], ptr [[TMP26]], align 4
; CHECK-NEXT: store <4 x float> [[TMP18]], ptr [[TMP27]], align 4
; CHECK-NEXT: store <4 x float> [[TMP19]], ptr [[TMP28]], align 4
; CHECK-NEXT: store <4 x float> [[TMP20]], ptr [[TMP29]], align 4
; CHECK-NEXT: store <4 x float> [[TMP21]], ptr [[TMP30]], align 4
; CHECK-NEXT: store <4 x float> [[TMP22]], ptr [[TMP31]], align 4
; CHECK-NEXT: store <4 x float> [[TMP23]], ptr [[TMP32]], align 4
; CHECK-NEXT: store <4 x float> [[TMP24]], ptr [[TMP33]], align 4
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 32
; CHECK-NEXT: [[TMP34:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16000
; CHECK-NEXT: br i1 [[TMP34]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
; CHECK: [[MIDDLE_BLOCK]]:
; CHECK-NEXT: br label %[[FOR_END]]
; CHECK: [[FOR_END]]:
; CHECK-NEXT: [[INC11]] = add nsw i32 [[NL_022]], 1
; CHECK-NEXT: [[TMP35:%.*]] = load i32, ptr @ntimes, align 4
; CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP35]], 10
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC11]], [[MUL]]
; CHECK-NEXT: br i1 [[CMP]], label %[[FOR_COND1_PREHEADER]], label %[[FOR_END12_LOOPEXIT:.*]]
; CHECK: [[FOR_END12_LOOPEXIT]]:
; CHECK-NEXT: br label %[[FOR_END12]]
; CHECK: [[FOR_END12]]:
; CHECK-NEXT: ret i32 0
;
entry:
%0 = load i32, ptr @ntimes, align 4
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.cond1.preheader, label %for.end12
for.cond1.preheader:
%nl.022 = phi i32 [ %inc11, %for.end ], [ 0, %entry ]
br label %for.body3
for.body3:
%indvars.iv = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next, %for.body3 ]
%arrayidx = getelementptr inbounds %struct.GlobalData, ptr @global_data, i64 0, i32 0, i64 %indvars.iv
%1 = load float, ptr %arrayidx, align 4
%arrayidx5 = getelementptr inbounds %struct.GlobalData, ptr @global_data, i64 0, i32 3, i64 %indvars.iv
%2 = load float, ptr %arrayidx5, align 4
%add = fadd float %1, %2
%3 = add nsw i64 %indvars.iv, 16000
%arrayidx8 = getelementptr inbounds %struct.GlobalData, ptr @global_data, i64 0, i32 0, i64 %3
store float %add, ptr %arrayidx8, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond = icmp eq i64 %indvars.iv.next, 16000
br i1 %exitcond, label %for.end, label %for.body3
for.end:
%inc11 = add nsw i32 %nl.022, 1
%4 = load i32, ptr @ntimes, align 4
%mul = mul nsw i32 %4, 10
%cmp = icmp slt i32 %inc11, %mul
br i1 %cmp, label %for.cond1.preheader, label %for.end12
for.end12:
ret i32 0
}
;.
; CHECK: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]]}
; CHECK: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
; CHECK: [[META2]] = !{!"llvm.loop.unroll.runtime.disable"}
;.