forked from OSchip/llvm-project
[NFC][ARM] Tail fold test changes
Run update script on one test and add another.
This commit is contained in:
parent
c65627a1fe
commit
97a476eb56
|
@ -0,0 +1,84 @@
|
||||||
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||||
|
; RUN: opt -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -tail-predication=enabled -loop-vectorize -instcombine -simplifycfg %s -S -o - | FileCheck %s
|
||||||
|
|
||||||
|
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
|
||||||
|
|
||||||
|
define arm_aapcs_vfpcc i32 @minmaxval4(i32* nocapture readonly %x, i32* nocapture %minp, i32 %N) {
|
||||||
|
; CHECK-LABEL: @minmaxval4(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP26_NOT:%.*]] = icmp eq i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP26_NOT]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: [[N_VEC:%.*]] = and i32 [[N]], -4
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
|
; CHECK: vector.body:
|
||||||
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, [[VECTOR_PH]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, [[VECTOR_PH]] ], [ [[TMP3:%.*]], [[VECTOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i32 [[INDEX]]
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[TMP0]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP1]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt <4 x i32> [[WIDE_LOAD]], [[VEC_PHI1]]
|
||||||
|
; CHECK-NEXT: [[TMP3]] = select <4 x i1> [[TMP2]], <4 x i32> [[WIDE_LOAD]], <4 x i32> [[VEC_PHI1]]
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = icmp slt <4 x i32> [[WIDE_LOAD]], [[VEC_PHI]]
|
||||||
|
; CHECK-NEXT: [[TMP5]] = select <4 x i1> [[TMP4]], <4 x i32> [[WIDE_LOAD]], <4 x i32> [[VEC_PHI]]
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.experimental.vector.reduce.smax.v4i32(<4 x i32> [[TMP3]])
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = call i32 @llvm.experimental.vector.reduce.smin.v4i32(<4 x i32> [[TMP5]])
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N_VEC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ [[TMP8]], [[MIDDLE_BLOCK]] ], [ 2147483647, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX2:%.*]] = phi i32 [ [[TMP7]], [[MIDDLE_BLOCK]] ], [ -2147483648, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: [[MAX_0_LCSSA:%.*]] = phi i32 [ -2147483648, [[ENTRY:%.*]] ], [ [[COND:%.*]], [[FOR_BODY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: [[MIN_0_LCSSA:%.*]] = phi i32 [ 2147483647, [[ENTRY]] ], [ [[COND9:%.*]], [[FOR_BODY]] ], [ [[TMP8]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: store i32 [[MIN_0_LCSSA]], i32* [[MINP:%.*]], align 4
|
||||||
|
; CHECK-NEXT: ret i32 [[MAX_0_LCSSA]]
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_029:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[MIN_028:%.*]] = phi i32 [ [[COND9]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[MAX_027:%.*]] = phi i32 [ [[COND]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX2]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[X]], i32 [[I_029]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[TMP9]], [[MAX_027]]
|
||||||
|
; CHECK-NEXT: [[COND]] = select i1 [[CMP1]], i32 [[TMP9]], i32 [[MAX_027]]
|
||||||
|
; CHECK-NEXT: [[CMP4:%.*]] = icmp slt i32 [[TMP9]], [[MIN_028]]
|
||||||
|
; CHECK-NEXT: [[COND9]] = select i1 [[CMP4]], i32 [[TMP9]], i32 [[MIN_028]]
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw i32 [[I_029]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP2:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
|
entry:
|
||||||
|
%cmp26.not = icmp eq i32 %N, 0
|
||||||
|
br i1 %cmp26.not, label %for.cond.cleanup, label %for.body
|
||||||
|
|
||||||
|
for.cond.cleanup: ; preds = %for.body, %entry
|
||||||
|
%max.0.lcssa = phi i32 [ -2147483648, %entry ], [ %cond, %for.body ]
|
||||||
|
%min.0.lcssa = phi i32 [ 2147483647, %entry ], [ %cond9, %for.body ]
|
||||||
|
store i32 %min.0.lcssa, i32* %minp, align 4
|
||||||
|
ret i32 %max.0.lcssa
|
||||||
|
|
||||||
|
for.body: ; preds = %entry, %for.body
|
||||||
|
%i.029 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
|
||||||
|
%min.028 = phi i32 [ %cond9, %for.body ], [ 2147483647, %entry ]
|
||||||
|
%max.027 = phi i32 [ %cond, %for.body ], [ -2147483648, %entry ]
|
||||||
|
%arrayidx = getelementptr inbounds i32, i32* %x, i32 %i.029
|
||||||
|
%0 = load i32, i32* %arrayidx, align 4
|
||||||
|
%cmp1 = icmp sgt i32 %0, %max.027
|
||||||
|
%cond = select i1 %cmp1, i32 %0, i32 %max.027
|
||||||
|
%cmp4 = icmp slt i32 %0, %min.028
|
||||||
|
%cond9 = select i1 %cmp4, i32 %0, i32 %min.028
|
||||||
|
%inc = add nuw i32 %i.029, 1
|
||||||
|
%exitcond.not = icmp eq i32 %inc, %N
|
||||||
|
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,64 @@
|
||||||
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||||
; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp \
|
; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp \
|
||||||
; RUN: -tail-predication=enabled -loop-vectorize -S < %s | \
|
; RUN: -tail-predication=enabled -loop-vectorize -S < %s | \
|
||||||
; RUN: FileCheck %s
|
; RUN: FileCheck %s
|
||||||
|
|
||||||
define void @trunc_not_allowed_different_vec_elemns(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i16* noalias nocapture %D) #0 {
|
define void @trunc_not_allowed_different_vec_elemns(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i16* noalias nocapture %D) #0 {
|
||||||
; CHECK-LABEL: trunc_not_allowed_different_vec_elemns(
|
; CHECK-LABEL: @trunc_not_allowed_different_vec_elemns(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP4]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = bitcast i32* [[TMP5]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, <4 x i32>* [[TMP6]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP8]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP10:%.*]] = bitcast i32* [[TMP9]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: store <4 x i32> [[TMP7]], <4 x i32>* [[TMP10]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP11:%.*]] = trunc <4 x i32> [[TMP7]] to <4 x i16>
|
||||||
|
; CHECK-NEXT: [[TMP12:%.*]] = shl <4 x i16> [[TMP11]], <i16 1, i16 1, i16 1, i16 1>
|
||||||
|
; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i16, i16* [[D:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i16, i16* [[TMP13]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP15:%.*]] = bitcast i16* [[TMP14]] to <4 x i16>*
|
||||||
|
; CHECK-NEXT: store <4 x i16> [[TMP12]], <4 x i16>* [[TMP15]], align 2
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP16:%.*]] = icmp eq i32 [[INDEX_NEXT]], 428
|
||||||
|
; CHECK-NEXT: br i1 [[TMP16]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 431, 428
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 428, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_021:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD9:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[I_021]]
|
||||||
|
; CHECK-NEXT: [[TMP17:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 [[I_021]]
|
||||||
|
; CHECK-NEXT: [[TMP18:%.*]] = load i32, i32* [[ARRAYIDX1]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP18]], [[TMP17]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_021]]
|
||||||
|
; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX2]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD_TR:%.*]] = trunc i32 [[ADD]] to i16
|
||||||
|
; CHECK-NEXT: [[CONV7:%.*]] = shl i16 [[ADD_TR]], 1
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds i16, i16* [[D]], i32 [[I_021]]
|
||||||
|
; CHECK-NEXT: store i16 [[CONV7]], i16* [[ARRAYIDX8]], align 2
|
||||||
|
; CHECK-NEXT: [[ADD9]] = add nuw nsw i32 [[I_021]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD9]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP2:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -33,11 +84,24 @@ for.body:
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @unsupported_i64_type(i64* noalias nocapture %A, i64* noalias nocapture readonly %B, i64* noalias nocapture readonly %C) #0 {
|
define void @unsupported_i64_type(i64* noalias nocapture %A, i64* noalias nocapture readonly %B, i64* noalias nocapture readonly %C) #0 {
|
||||||
; CHECK-LABEL: unsupported_i64_type(
|
; CHECK-LABEL: @unsupported_i64_type(
|
||||||
; CHECK-NOT: vector.body:
|
; CHECK-NEXT: entry:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
; CHECK: for.body:
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_09:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD3:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i64, i64* [[B:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[ARRAYIDX]], align 8
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[C:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[ARRAYIDX1]], align 8
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i64 [[TMP1]], [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i64, i64* [[A:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: store i64 [[ADD]], i64* [[ARRAYIDX2]], align 8
|
||||||
|
; CHECK-NEXT: [[ADD3]] = add nuw nsw i32 [[I_09]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD3]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -59,11 +123,53 @@ for.body:
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @narrowing_load_not_allowed(i8* noalias nocapture %A, i8* noalias nocapture readonly %B, i16* noalias nocapture readonly %C) #0 {
|
define void @narrowing_load_not_allowed(i8* noalias nocapture %A, i8* noalias nocapture readonly %B, i16* noalias nocapture readonly %C) #0 {
|
||||||
; CHECK-LABEL: narrowing_load_not_allowed(
|
; CHECK-LABEL: @narrowing_load_not_allowed(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i16, i16* [[C:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i16, i16* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i16* [[TMP2]] to <8 x i16>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <8 x i16>, <8 x i16>* [[TMP3]], align 2
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, i8* [[B:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, i8* [[TMP4]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = bitcast i8* [[TMP5]] to <8 x i8>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <8 x i8>, <8 x i8>* [[TMP6]], align 1
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = trunc <8 x i16> [[WIDE_LOAD]] to <8 x i8>
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = add <8 x i8> [[WIDE_LOAD1]], [[TMP7]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, i8* [[A:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, i8* [[TMP9]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to <8 x i8>*
|
||||||
|
; CHECK-NEXT: store <8 x i8> [[TMP8]], <8 x i8>* [[TMP11]], align 1
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 8
|
||||||
|
; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i32 [[INDEX_NEXT]], 424
|
||||||
|
; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP4:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 431, 424
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 424, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_012:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD6:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i16, i16* [[C]], i32 [[I_012]]
|
||||||
|
; CHECK-NEXT: [[TMP13:%.*]] = load i16, i16* [[ARRAYIDX]], align 2
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i8, i8* [[B]], i32 [[I_012]]
|
||||||
|
; CHECK-NEXT: [[TMP14:%.*]] = load i8, i8* [[ARRAYIDX1]], align 1
|
||||||
|
; CHECK-NEXT: [[CONV3:%.*]] = trunc i16 [[TMP13]] to i8
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add i8 [[TMP14]], [[CONV3]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i8, i8* [[A]], i32 [[I_012]]
|
||||||
|
; CHECK-NEXT: store i8 [[ADD]], i8* [[ARRAYIDX5]], align 1
|
||||||
|
; CHECK-NEXT: [[ADD6]] = add nuw nsw i32 [[I_012]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD6]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP5:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -91,11 +197,54 @@ for.body: ; preds = %for.body, %entry
|
||||||
; we could allow this case.
|
; we could allow this case.
|
||||||
;
|
;
|
||||||
define void @trunc_not_allowed(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) #0 {
|
define void @trunc_not_allowed(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) #0 {
|
||||||
; CHECK-LABEL: trunc_not_allowed(
|
; CHECK-LABEL: @trunc_not_allowed(
|
||||||
; CHECK: vector.body:
|
; CHECK-NEXT: entry:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK: vector.ph:
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
|
; CHECK: vector.body:
|
||||||
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP4]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = bitcast i32* [[TMP5]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, <4 x i32>* [[TMP6]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP8]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP10:%.*]] = bitcast i32* [[TMP9]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: store <4 x i32> [[TMP7]], <4 x i32>* [[TMP10]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP11:%.*]] = add nuw nsw i32 [[TMP0]], 1
|
||||||
|
; CHECK-NEXT: [[TMP12:%.*]] = trunc i32 [[TMP11]] to i16
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i32 [[INDEX_NEXT]], 428
|
||||||
|
; CHECK-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP6:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 431, 428
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 428, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_09:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD3:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP14:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP15:%.*]] = load i32, i32* [[ARRAYIDX1]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP15]], [[TMP14]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX2]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD3]] = add nuw nsw i32 [[I_09]], 1
|
||||||
|
; CHECK-NEXT: [[ADD_IV:%.*]] = trunc i32 [[ADD3]] to i16
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i16 [[ADD_IV]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP7:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -123,11 +272,67 @@ for.body:
|
||||||
; force vectorisation with a loop hint.
|
; force vectorisation with a loop hint.
|
||||||
;
|
;
|
||||||
define void @strides_different_direction(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i32 %N) #0 {
|
define void @strides_different_direction(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i32 %N) #0 {
|
||||||
; CHECK-LABEL: strides_different_direction(
|
; CHECK-LABEL: @strides_different_direction(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_SCEVCHECK:%.*]]
|
||||||
|
; CHECK: vector.scevcheck:
|
||||||
|
; CHECK-NEXT: [[MUL:%.*]] = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 1, i32 430)
|
||||||
|
; CHECK-NEXT: [[MUL_RESULT:%.*]] = extractvalue { i32, i1 } [[MUL]], 0
|
||||||
|
; CHECK-NEXT: [[MUL_OVERFLOW:%.*]] = extractvalue { i32, i1 } [[MUL]], 1
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[N:%.*]], [[MUL_RESULT]]
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = sub i32 [[N]], [[MUL_RESULT]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP1]], [[N]]
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP0]], [[N]]
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = select i1 true, i1 [[TMP2]], i1 [[TMP3]]
|
||||||
|
; CHECK-NEXT: [[TMP5:%.*]] = or i1 [[TMP4]], [[MUL_OVERFLOW]]
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[INDEX]], 0
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i32 [[TMP7]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP8]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP10:%.*]] = bitcast i32* [[TMP9]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP10]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP11:%.*]] = sub nsw i32 [[N]], [[TMP7]]
|
||||||
|
; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i32 [[TMP11]]
|
||||||
|
; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i32, i32* [[TMP12]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i32, i32* [[TMP13]], i32 -3
|
||||||
|
; CHECK-NEXT: [[TMP15:%.*]] = bitcast i32* [[TMP14]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, <4 x i32>* [[TMP15]], align 4
|
||||||
|
; CHECK-NEXT: [[REVERSE:%.*]] = shufflevector <4 x i32> [[WIDE_LOAD1]], <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
|
||||||
|
; CHECK-NEXT: [[TMP16:%.*]] = add nsw <4 x i32> [[REVERSE]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP7]]
|
||||||
|
; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i32, i32* [[TMP17]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP19:%.*]] = bitcast i32* [[TMP18]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: store <4 x i32> [[TMP16]], <4 x i32>* [[TMP19]], align 4
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP20:%.*]] = icmp eq i32 [[INDEX_NEXT]], 428
|
||||||
|
; CHECK-NEXT: br i1 [[TMP20]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP8:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 431, 428
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 428, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ], [ 0, [[VECTOR_SCEVCHECK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_09:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD3:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP21:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[N]], [[I_09]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 [[SUB]]
|
||||||
|
; CHECK-NEXT: [[TMP22:%.*]] = load i32, i32* [[ARRAYIDX1]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP22]], [[TMP21]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX2]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD3]] = add nuw nsw i32 [[I_09]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD3]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP9:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -150,11 +355,53 @@ for.body:
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @too_many_loop_blocks(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) #0 {
|
define void @too_many_loop_blocks(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) #0 {
|
||||||
; CHECK-LABEL: too_many_loop_blocks(
|
; CHECK-LABEL: @too_many_loop_blocks(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[C:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP4]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = bitcast i32* [[TMP5]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD1:%.*]] = load <4 x i32>, <4 x i32>* [[TMP6]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_LOAD1]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP8]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP10:%.*]] = bitcast i32* [[TMP9]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: store <4 x i32> [[TMP7]], <4 x i32>* [[TMP10]], align 4
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[INDEX_NEXT]], 428
|
||||||
|
; CHECK-NEXT: br i1 [[TMP11]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP10:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 431, 428
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 428, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_09:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD3:%.*]], [[LOOPINCR:%.*]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP12:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[C]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP13:%.*]] = load i32, i32* [[ARRAYIDX1]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP13]], [[TMP12]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: store i32 [[ADD]], i32* [[ARRAYIDX2]], align 4
|
||||||
|
; CHECK-NEXT: br label [[LOOPINCR]]
|
||||||
|
; CHECK: loopincr:
|
||||||
|
; CHECK-NEXT: [[ADD3]] = add nuw nsw i32 [[I_09]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD3]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], [[LOOP11:!llvm.loop !.*]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -179,9 +426,24 @@ loopincr:
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @double(double* noalias nocapture %A, double* noalias nocapture readonly %B, double* noalias nocapture readonly %C) #0 {
|
define void @double(double* noalias nocapture %A, double* noalias nocapture readonly %B, double* noalias nocapture readonly %C) #0 {
|
||||||
; CHECK-LABEL: double(
|
; CHECK-LABEL: @double(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
; CHECK: for.body:
|
; CHECK: for.body:
|
||||||
; CHECK-NOT: vector.body:
|
; CHECK-NEXT: [[I_09:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD3:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, double* [[B:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = load double, double* [[ARRAYIDX]], align 8
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds double, double* [[C:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = load double, double* [[ARRAYIDX1]], align 8
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = fadd fast double [[TMP1]], [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds double, double* [[A:%.*]], i32 [[I_09]]
|
||||||
|
; CHECK-NEXT: store double [[ADD]], double* [[ARRAYIDX2]], align 8
|
||||||
|
; CHECK-NEXT: [[ADD3]] = add nuw nsw i32 [[I_09]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD3]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -203,11 +465,28 @@ for.body:
|
||||||
}
|
}
|
||||||
|
|
||||||
define void @fptrunc_not_allowed(float* noalias nocapture %A, float* noalias nocapture readonly %B, float* noalias nocapture readonly %C, half* noalias nocapture %D) #0 {
|
define void @fptrunc_not_allowed(float* noalias nocapture %A, float* noalias nocapture readonly %B, float* noalias nocapture readonly %C, half* noalias nocapture %D) #0 {
|
||||||
; CHECK-LABEL: fptrunc_not_allowed(
|
; CHECK-LABEL: @fptrunc_not_allowed(
|
||||||
; CHECK-NOT: vector.body:
|
; CHECK-NEXT: entry:
|
||||||
; CHECK-NOT: llvm.masked.load
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
; CHECK-NOT: llvm.masked.store
|
; CHECK: for.cond.cleanup:
|
||||||
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %for.body
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_017:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD6:%.*]], [[FOR_BODY]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i32 [[I_017]]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = load float, float* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds float, float* [[C:%.*]], i32 [[I_017]]
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[ARRAYIDX1]], align 4
|
||||||
|
; CHECK-NEXT: [[ADD:%.*]] = fadd fast float [[TMP1]], [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i32 [[I_017]]
|
||||||
|
; CHECK-NEXT: store float [[ADD]], float* [[ARRAYIDX2]], align 4
|
||||||
|
; CHECK-NEXT: [[CONV:%.*]] = fptrunc float [[ADD]] to half
|
||||||
|
; CHECK-NEXT: [[FACTOR:%.*]] = fmul fast half [[CONV]], 0xH4000
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds half, half* [[D:%.*]], i32 [[I_017]]
|
||||||
|
; CHECK-NEXT: store half [[FACTOR]], half* [[ARRAYIDX5]], align 2
|
||||||
|
; CHECK-NEXT: [[ADD6]] = add nuw nsw i32 [[I_017]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[ADD6]], 431
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
br label %for.body
|
br label %for.body
|
||||||
|
|
||||||
|
@ -238,6 +517,30 @@ for.body:
|
||||||
; to be reverted which is expensive and what we would like to avoid.
|
; to be reverted which is expensive and what we would like to avoid.
|
||||||
;
|
;
|
||||||
define dso_local void @select_not_allowed(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i32 %N, i32* noalias nocapture readonly %Cond) {
|
define dso_local void @select_not_allowed(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i32 %N, i32* noalias nocapture readonly %Cond) {
|
||||||
|
; CHECK-LABEL: @select_not_allowed(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP10:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP10]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.cond.cleanup.loopexit:
|
||||||
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: ret void
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_011:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[COND:%.*]], i32 [[I_011]]
|
||||||
|
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[TMP0]], 0
|
||||||
|
; CHECK-NEXT: [[C_B:%.*]] = select i1 [[TOBOOL_NOT]], i32* [[C:%.*]], i32* [[B:%.*]]
|
||||||
|
; CHECK-NEXT: [[COND_IN:%.*]] = getelementptr inbounds i32, i32* [[C_B]], i32 [[I_011]]
|
||||||
|
; CHECK-NEXT: [[COND:%.*]] = load i32, i32* [[COND_IN]], align 4
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[I_011]]
|
||||||
|
; CHECK-NEXT: store i32 [[COND]], i32* [[ARRAYIDX3]], align 4
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_011]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[FOR_BODY]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
%cmp10 = icmp sgt i32 %N, 0
|
%cmp10 = icmp sgt i32 %N, 0
|
||||||
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
|
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
|
||||||
|
@ -267,11 +570,55 @@ for.body: ; preds = %for.body.preheader,
|
||||||
}
|
}
|
||||||
|
|
||||||
define i32 @i32_smin_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
define i32 @i32_smin_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
||||||
; CHECK-LABEL: i32_smin_reduction(
|
; CHECK-LABEL: @i32_smin_reduction(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP6]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: @llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: @llvm.masked.store
|
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>, [[VECTOR_PH]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK: br i1 %{{.*}}, label {{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = icmp slt <4 x i32> [[VEC_PHI]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP5]] = select <4 x i1> [[TMP4]], <4 x i32> [[VEC_PHI]], <4 x i32> [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP12:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.experimental.vector.reduce.smin.v4i32(<4 x i32> [[TMP5]])
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 2147483647, [[FOR_BODY_PREHEADER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[R_07:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[X]], i32 [[I_08]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[C:%.*]] = icmp slt i32 [[R_07]], [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[ADD]] = select i1 [[C]], i32 [[R_07]], i32 [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], [[LOOP13:!llvm.loop !.*]]
|
||||||
|
; CHECK: for.cond.cleanup.loopexit:
|
||||||
|
; CHECK-NEXT: [[ADD_LCSSA:%.*]] = phi i32 [ [[ADD]], [[FOR_BODY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: [[R_0_LCSSA:%.*]] = phi i32 [ 2147483647, [[ENTRY:%.*]] ], [ [[ADD_LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]
|
||||||
|
; CHECK-NEXT: ret i32 [[R_0_LCSSA]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
%cmp6 = icmp sgt i32 %n, 0
|
%cmp6 = icmp sgt i32 %n, 0
|
||||||
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
||||||
|
@ -293,11 +640,55 @@ for.cond.cleanup: ; preds = %for.body, %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
define i32 @i32_smax_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
define i32 @i32_smax_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
||||||
; CHECK-LABEL: i32_smax_reduction(
|
; CHECK-LABEL: @i32_smax_reduction(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP6]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: @llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: @llvm.masked.store
|
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, [[VECTOR_PH]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK: br i1 %{{.*}}, label {{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt <4 x i32> [[VEC_PHI]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP5]] = select <4 x i1> [[TMP4]], <4 x i32> [[VEC_PHI]], <4 x i32> [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP14:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.experimental.vector.reduce.smax.v4i32(<4 x i32> [[TMP5]])
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ -2147483648, [[FOR_BODY_PREHEADER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[R_07:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[X]], i32 [[I_08]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 [[R_07]], [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[ADD]] = select i1 [[C]], i32 [[R_07]], i32 [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], [[LOOP15:!llvm.loop !.*]]
|
||||||
|
; CHECK: for.cond.cleanup.loopexit:
|
||||||
|
; CHECK-NEXT: [[ADD_LCSSA:%.*]] = phi i32 [ [[ADD]], [[FOR_BODY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: [[R_0_LCSSA:%.*]] = phi i32 [ -2147483648, [[ENTRY:%.*]] ], [ [[ADD_LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]
|
||||||
|
; CHECK-NEXT: ret i32 [[R_0_LCSSA]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
%cmp6 = icmp sgt i32 %n, 0
|
%cmp6 = icmp sgt i32 %n, 0
|
||||||
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
||||||
|
@ -319,11 +710,55 @@ for.cond.cleanup: ; preds = %for.body, %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
define i32 @i32_umin_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
define i32 @i32_umin_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
||||||
; CHECK-LABEL: i32_umin_reduction(
|
; CHECK-LABEL: @i32_umin_reduction(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP6]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: @llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: @llvm.masked.store
|
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ <i32 -1, i32 -1, i32 -1, i32 -1>, [[VECTOR_PH]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK: br i1 %{{.*}}, label {{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult <4 x i32> [[VEC_PHI]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP5]] = select <4 x i1> [[TMP4]], <4 x i32> [[VEC_PHI]], <4 x i32> [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP16:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.experimental.vector.reduce.umin.v4i32(<4 x i32> [[TMP5]])
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ -1, [[FOR_BODY_PREHEADER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[R_07:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[X]], i32 [[I_08]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[R_07]], [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[ADD]] = select i1 [[C]], i32 [[R_07]], i32 [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], [[LOOP17:!llvm.loop !.*]]
|
||||||
|
; CHECK: for.cond.cleanup.loopexit:
|
||||||
|
; CHECK-NEXT: [[ADD_LCSSA:%.*]] = phi i32 [ [[ADD]], [[FOR_BODY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: [[R_0_LCSSA:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ [[ADD_LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]
|
||||||
|
; CHECK-NEXT: ret i32 [[R_0_LCSSA]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
%cmp6 = icmp sgt i32 %n, 0
|
%cmp6 = icmp sgt i32 %n, 0
|
||||||
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
||||||
|
@ -345,11 +780,55 @@ for.cond.cleanup: ; preds = %for.body, %entry
|
||||||
}
|
}
|
||||||
|
|
||||||
define i32 @i32_umax_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
define i32 @i32_umax_reduction(i32* nocapture readonly %x, i32 %n) #0 {
|
||||||
; CHECK-LABEL: i32_umax_reduction(
|
; CHECK-LABEL: @i32_umax_reduction(
|
||||||
|
; CHECK-NEXT: entry:
|
||||||
|
; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[N:%.*]], 0
|
||||||
|
; CHECK-NEXT: br i1 [[CMP6]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
|
||||||
|
; CHECK: for.body.preheader:
|
||||||
|
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
|
||||||
|
; CHECK: vector.ph:
|
||||||
|
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i32 [[N]], 4
|
||||||
|
; CHECK-NEXT: [[N_VEC:%.*]] = sub i32 [[N]], [[N_MOD_VF]]
|
||||||
|
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
|
||||||
; CHECK: vector.body:
|
; CHECK: vector.body:
|
||||||
; CHECK-NOT: @llvm.masked.load
|
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK-NOT: @llvm.masked.store
|
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP5:%.*]], [[VECTOR_BODY]] ]
|
||||||
; CHECK: br i1 %{{.*}}, label {{.*}}, label %vector.body
|
; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
|
||||||
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i32 [[TMP0]]
|
||||||
|
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i32 0
|
||||||
|
; CHECK-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>*
|
||||||
|
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP3]], align 4
|
||||||
|
; CHECK-NEXT: [[TMP4:%.*]] = icmp ugt <4 x i32> [[VEC_PHI]], [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[TMP5]] = select <4 x i1> [[TMP4]], <4 x i32> [[VEC_PHI]], <4 x i32> [[WIDE_LOAD]]
|
||||||
|
; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
|
||||||
|
; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP18:!llvm.loop !.*]]
|
||||||
|
; CHECK: middle.block:
|
||||||
|
; CHECK-NEXT: [[TMP7:%.*]] = call i32 @llvm.experimental.vector.reduce.umax.v4i32(<4 x i32> [[TMP5]])
|
||||||
|
; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N]], [[N_VEC]]
|
||||||
|
; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]
|
||||||
|
; CHECK: scalar.ph:
|
||||||
|
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
|
||||||
|
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[FOR_BODY_PREHEADER]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
||||||
|
; CHECK: for.body:
|
||||||
|
; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[R_07:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ]
|
||||||
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[X]], i32 [[I_08]]
|
||||||
|
; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
|
||||||
|
; CHECK-NEXT: [[C:%.*]] = icmp ugt i32 [[R_07]], [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[ADD]] = select i1 [[C]], i32 [[R_07]], i32 [[TMP8]]
|
||||||
|
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
|
||||||
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], [[N]]
|
||||||
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], [[LOOP19:!llvm.loop !.*]]
|
||||||
|
; CHECK: for.cond.cleanup.loopexit:
|
||||||
|
; CHECK-NEXT: [[ADD_LCSSA:%.*]] = phi i32 [ [[ADD]], [[FOR_BODY]] ], [ [[TMP7]], [[MIDDLE_BLOCK]] ]
|
||||||
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
||||||
|
; CHECK: for.cond.cleanup:
|
||||||
|
; CHECK-NEXT: [[R_0_LCSSA:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD_LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]
|
||||||
|
; CHECK-NEXT: ret i32 [[R_0_LCSSA]]
|
||||||
|
;
|
||||||
entry:
|
entry:
|
||||||
%cmp6 = icmp sgt i32 %n, 0
|
%cmp6 = icmp sgt i32 %n, 0
|
||||||
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
br i1 %cmp6, label %for.body, label %for.cond.cleanup
|
||||||
|
|
Loading…
Reference in New Issue