63 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=loop-vectorize \3; RUN: -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue \4; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=IF-EVL5 6; RUN: opt -passes=loop-vectorize \7; RUN: -prefer-predicate-over-epilogue=scalar-epilogue \8; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=NO-VP9 10define void @gather_scatter(ptr noalias %in, ptr noalias %out, ptr noalias %index, i64 %n) {11; IF-EVL-LABEL: @gather_scatter(12; IF-EVL-NEXT: entry:13; IF-EVL-NEXT: br label [[FOR_BODY1:%.*]]14; IF-EVL: for.body:15; IF-EVL-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ 0, [[SCALAR_PH:%.*]] ], [ [[INDVARS_IV_NEXT1:%.*]], [[FOR_BODY1]] ]16; IF-EVL-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, ptr [[INDEX:%.*]], i64 [[INDVARS_IV1]]17; IF-EVL-NEXT: [[TMP0:%.*]] = load i64, ptr [[ARRAYIDX3]], align 818; IF-EVL-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds float, ptr [[IN:%.*]], i64 [[TMP0]]19; IF-EVL-NEXT: [[TMP1:%.*]] = load float, ptr [[ARRAYIDX5]], align 420; IF-EVL-NEXT: [[ARRAYIDX7:%.*]] = getelementptr inbounds float, ptr [[OUT:%.*]], i64 [[TMP0]]21; IF-EVL-NEXT: store float [[TMP1]], ptr [[ARRAYIDX7]], align 422; IF-EVL-NEXT: [[INDVARS_IV_NEXT1]] = add nuw nsw i64 [[INDVARS_IV1]], 123; IF-EVL-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT1]], [[N:%.*]]24; IF-EVL-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_END:%.*]], label [[FOR_BODY1]]25; IF-EVL: for.end:26; IF-EVL-NEXT: ret void27;28; NO-VP-LABEL: @gather_scatter(29; NO-VP-NEXT: entry:30; NO-VP-NEXT: br label [[FOR_BODY1:%.*]]31; NO-VP: for.body:32; NO-VP-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT1:%.*]], [[FOR_BODY1]] ]33; NO-VP-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i32, ptr [[INDEX:%.*]], i64 [[INDVARS_IV1]]34; NO-VP-NEXT: [[TMP0:%.*]] = load i64, ptr [[ARRAYIDX3]], align 835; NO-VP-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds float, ptr [[IN:%.*]], i64 [[TMP0]]36; NO-VP-NEXT: [[TMP1:%.*]] = load float, ptr [[ARRAYIDX5]], align 437; NO-VP-NEXT: [[ARRAYIDX7:%.*]] = getelementptr inbounds float, ptr [[OUT:%.*]], i64 [[TMP0]]38; NO-VP-NEXT: store float [[TMP1]], ptr [[ARRAYIDX7]], align 439; NO-VP-NEXT: [[INDVARS_IV_NEXT1]] = add nuw nsw i64 [[INDVARS_IV1]], 140; NO-VP-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT1]], [[N:%.*]]41; NO-VP-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_END:%.*]], label [[FOR_BODY1]]42; NO-VP: for.end:43; NO-VP-NEXT: ret void44;45entry:46 br label %for.body47 48for.body:49 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]50 %arrayidx3 = getelementptr inbounds i32, ptr %index, i64 %indvars.iv51 %0 = load i64, ptr %arrayidx3, align 852 %arrayidx5 = getelementptr inbounds float, ptr %in, i64 %053 %1 = load float, ptr %arrayidx5, align 454 %arrayidx7 = getelementptr inbounds float, ptr %out, i64 %055 store float %1, ptr %arrayidx7, align 456 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 157 %exitcond.not = icmp eq i64 %indvars.iv.next, %n58 br i1 %exitcond.not, label %for.end, label %for.body59 60for.end:61 ret void62}63