| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "Cost of" --filter-out-after "EMIT branch-on-count" --version 6 |
| ; REQUIRES: asserts |
| ; RUN: opt -passes=loop-vectorize -force-vector-width=2 -force-target-instruction-cost=1 -debug-only=loop-vectorize -disable-output %s 2>&1 | FileCheck --check-prefix=FORCED1 %s |
| ; RUN: opt -passes=loop-vectorize -force-vector-width=2 -force-target-instruction-cost=3 -debug-only=loop-vectorize -disable-output %s 2>&1 | FileCheck --check-prefix=FORCED3 %s |
| |
| define void @int_induction(ptr noalias %dst, i64 %n) { |
| ; FORCED1-LABEL: 'int_induction' |
| ; FORCED1: Cost of 1 for VF 2: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0:%[0-9]+]]> |
| ; FORCED1: Cost of 1 for VF 2: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3:%[0-9]+]]>, ir<1>, vp<[[VP0]]> |
| ; FORCED1: Cost of 1 for VF 2: CLONE ir<%gep> = getelementptr inbounds ir<%dst>, vp<[[VP4]]> |
| ; FORCED1: Cost of 0 for VF 2: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds i64, ir<%gep>, ir<1> |
| ; FORCED1: Cost of 1 for VF 2: WIDEN store vp<[[VP5]]>, ir<%iv> |
| ; FORCED1: Cost of 0 for VF 2: EMIT vp<%index.next> = add nuw vp<[[VP3]]>, vp<[[VP1:%[0-9]+]]> |
| ; FORCED1: Cost of 0 for VF 2: EMIT branch-on-count vp<%index.next>, vp<[[VP2:%[0-9]+]]> |
| ; |
| ; FORCED3-LABEL: 'int_induction' |
| ; FORCED3: Cost of 3 for VF 2: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0:%[0-9]+]]> |
| ; FORCED3: Cost of 3 for VF 2: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3:%[0-9]+]]>, ir<1>, vp<[[VP0]]> |
| ; FORCED3: Cost of 3 for VF 2: CLONE ir<%gep> = getelementptr inbounds ir<%dst>, vp<[[VP4]]> |
| ; FORCED3: Cost of 0 for VF 2: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds i64, ir<%gep>, ir<1> |
| ; FORCED3: Cost of 3 for VF 2: WIDEN store vp<[[VP5]]>, ir<%iv> |
| ; FORCED3: Cost of 0 for VF 2: EMIT vp<%index.next> = add nuw vp<[[VP3]]>, vp<[[VP1:%[0-9]+]]> |
| ; FORCED3: Cost of 0 for VF 2: EMIT branch-on-count vp<%index.next>, vp<[[VP2:%[0-9]+]]> |
| ; |
| entry: |
| br label %loop |
| |
| loop: |
| %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] |
| %gep = getelementptr inbounds i64, ptr %dst, i64 %iv |
| store i64 %iv, ptr %gep, align 8 |
| %iv.next = add nuw nsw i64 %iv, 1 |
| %ec = icmp eq i64 %iv.next, %n |
| br i1 %ec, label %exit, label %loop |
| |
| exit: |
| ret void |
| } |
| |
| define void @fp_induction_scalar_users(ptr noalias %dst, i64 %n) { |
| ; FORCED1-LABEL: 'fp_induction_scalar_users' |
| ; FORCED1: Cost of 1 for VF 2: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0:%[0-9]+]]> |
| ; FORCED1: Cost of 1 for VF 2: vp<[[VP5:%[0-9]+]]> = DERIVED-IV ir<0.000000e+00> + vp<[[VP4:%[0-9]+]]> * ir<1.000000e+00> |
| ; FORCED1: Cost of 1 for VF 2: vp<[[VP6:%[0-9]+]]> = SCALAR-STEPS vp<[[VP5]]>, ir<1.000000e+00>, vp<[[VP0]]> |
| ; FORCED1: Cost of 1 for VF 2: WIDEN ir<%idx> = mul ir<%iv>, ir<3> |
| ; FORCED1: Cost of 1 for VF 2: REPLICATE ir<%gep> = getelementptr inbounds ir<%dst>, ir<%idx> |
| ; FORCED1: Cost of 1 for VF 2: REPLICATE store vp<[[VP6]]>, ir<%gep> |
| ; FORCED1: Cost of 0 for VF 2: EMIT vp<%index.next> = add nuw vp<[[VP4]]>, vp<[[VP1:%[0-9]+]]> |
| ; FORCED1: Cost of 0 for VF 2: EMIT branch-on-count vp<%index.next>, vp<[[VP2:%[0-9]+]]> |
| ; |
| ; FORCED3-LABEL: 'fp_induction_scalar_users' |
| ; FORCED3: Cost of 3 for VF 2: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0:%[0-9]+]]> |
| ; FORCED3: Cost of 3 for VF 2: vp<[[VP5:%[0-9]+]]> = DERIVED-IV ir<0.000000e+00> + vp<[[VP4:%[0-9]+]]> * ir<1.000000e+00> |
| ; FORCED3: Cost of 3 for VF 2: vp<[[VP6:%[0-9]+]]> = SCALAR-STEPS vp<[[VP5]]>, ir<1.000000e+00>, vp<[[VP0]]> |
| ; FORCED3: Cost of 3 for VF 2: WIDEN ir<%idx> = mul ir<%iv>, ir<3> |
| ; FORCED3: Cost of 3 for VF 2: REPLICATE ir<%gep> = getelementptr inbounds ir<%dst>, ir<%idx> |
| ; FORCED3: Cost of 3 for VF 2: REPLICATE store vp<[[VP6]]>, ir<%gep> |
| ; FORCED3: Cost of 0 for VF 2: EMIT vp<%index.next> = add nuw vp<[[VP4]]>, vp<[[VP1:%[0-9]+]]> |
| ; FORCED3: Cost of 0 for VF 2: EMIT branch-on-count vp<%index.next>, vp<[[VP2:%[0-9]+]]> |
| ; |
| entry: |
| br label %loop |
| |
| loop: |
| %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] |
| %fp.iv = phi float [ 0.000000e+00, %entry ], [ %fp.iv.next, %loop ] |
| %idx = mul i64 %iv, 3 |
| %gep = getelementptr inbounds float, ptr %dst, i64 %idx |
| store float %fp.iv, ptr %gep, align 4 |
| %fp.iv.next = fadd fast float %fp.iv, 1.000000e+00 |
| %iv.next = add nuw nsw i64 %iv, 1 |
| %ec = icmp eq i64 %iv.next, %n |
| br i1 %ec, label %exit, label %loop |
| |
| exit: |
| ret void |
| } |