blob: 715e1315db0ed934ea06e23fb1c459f490e262fb [file]
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "Cost of [0-9]+(.[0-9]+)? for VF [0-9]+: (INTERLEAVE-GROUP with factor [0-9]+,|EXPRESSION|REPLICATE|WIDEN)" --filter "LV: Selecting VF:" --filter "Estimated cost per lane" --version 6
; REQUIRES: asserts
; RUN: opt -mtriple=wasm32 -mattr=+simd128 -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S < %s 2>&1 | FileCheck %s
; RUN: opt -mtriple=wasm32 -mattr=+simd128 -passes=loop-vectorize -vectorizer-maximize-bandwidth -debug-only=loop-vectorize -disable-output -S < %s 2>&1 | FileCheck %s --check-prefix=MAX
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite)
define hidden void @luma_dominant(ptr noundef readonly captures(none) %ub, ptr noundef readonly captures(none) %vb, i32 noundef %uv_w, ptr noundef writeonly captures(none) %counts) {
; CHECK-LABEL: 'luma_dominant'
; CHECK: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5:%[0-9]+]]>, ir<%spec.select>
; CHECK: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; CHECK: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; CHECK: Cost of 0 for VF 2: REPLICATE ir<%arrayidx> = getelementptr inbounds nuw ir<%ub>, vp<[[VP8:%[0-9]+]]>
; CHECK: Cost of 6 for VF 2: REPLICATE ir<%0> = load ir<%arrayidx>
; CHECK: Cost of 0 for VF 2: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; CHECK: Cost of 1 for VF 2: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; CHECK: Cost of 0 for VF 2: REPLICATE ir<%arrayidx1> = getelementptr inbounds nuw ir<%vb>, vp<[[VP8]]>
; CHECK: Cost of 6 for VF 2: REPLICATE ir<%1> = load ir<%arrayidx1>
; CHECK: Cost of 0 for VF 2: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; CHECK: Cost of 1 for VF 2: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; CHECK: Cost of 1 for VF 2: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; CHECK: Cost of 1 for VF 2: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; CHECK: Cost of 1 for VF 2: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; CHECK: Cost of 1 for VF 2: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; CHECK: Cost of 1 for VF 2: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; CHECK: Cost of 1 for VF 2: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; CHECK: Cost of 1 for VF 2: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; CHECK: Cost of 1 for VF 2: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; CHECK: Cost for VF 2: 46 (Estimated cost per lane: 23)
; CHECK: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5]]>, ir<%spec.select>
; CHECK: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; CHECK: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; CHECK: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8, ir<%arrayidx>
; CHECK: Cost of 2 for VF 4: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; CHECK: Cost of 1 for VF 4: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; CHECK: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8, ir<%arrayidx1>
; CHECK: Cost of 2 for VF 4: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; CHECK: Cost of 1 for VF 4: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; CHECK: Cost of 1 for VF 4: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; CHECK: Cost of 1 for VF 4: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; CHECK: Cost of 1 for VF 4: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; CHECK: Cost of 1 for VF 4: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; CHECK: Cost of 1 for VF 4: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; CHECK: Cost of 1 for VF 4: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; CHECK: Cost of 1 for VF 4: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; CHECK: Cost of 1 for VF 4: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; CHECK: Cost for VF 4: 57 (Estimated cost per lane: 14.3)
; CHECK: LV: Selecting VF: 4.
;
; MAX-LABEL: 'luma_dominant'
; MAX: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5:%[0-9]+]]>, ir<%spec.select>
; MAX: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; MAX: Cost of 1 for VF 2: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; MAX: Cost of 0 for VF 2: REPLICATE ir<%arrayidx> = getelementptr inbounds nuw ir<%ub>, vp<[[VP8:%[0-9]+]]>
; MAX: Cost of 6 for VF 2: REPLICATE ir<%0> = load ir<%arrayidx>
; MAX: Cost of 0 for VF 2: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; MAX: Cost of 1 for VF 2: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; MAX: Cost of 0 for VF 2: REPLICATE ir<%arrayidx1> = getelementptr inbounds nuw ir<%vb>, vp<[[VP8]]>
; MAX: Cost of 6 for VF 2: REPLICATE ir<%1> = load ir<%arrayidx1>
; MAX: Cost of 0 for VF 2: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; MAX: Cost of 1 for VF 2: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; MAX: Cost of 1 for VF 2: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; MAX: Cost of 1 for VF 2: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; MAX: Cost of 1 for VF 2: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; MAX: Cost of 1 for VF 2: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; MAX: Cost of 1 for VF 2: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; MAX: Cost of 1 for VF 2: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; MAX: Cost of 1 for VF 2: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; MAX: Cost of 1 for VF 2: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; MAX: Cost of 1 for VF 2: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; MAX: Cost of 1 for VF 2: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; MAX: Cost of 1 for VF 2: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; MAX: Cost of 1 for VF 2: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; MAX: Cost of 1 for VF 2: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; MAX: Cost of 1 for VF 2: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; MAX: Cost of 1 for VF 2: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; MAX: Cost of 1 for VF 2: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; MAX: Cost for VF 2: 46 (Estimated cost per lane: 23)
; MAX: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5]]>, ir<%spec.select>
; MAX: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; MAX: Cost of 1 for VF 4: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; MAX: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8, ir<%arrayidx>
; MAX: Cost of 2 for VF 4: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; MAX: Cost of 1 for VF 4: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; MAX: Cost of 10 for VF 4: INTERLEAVE-GROUP with factor 8, ir<%arrayidx1>
; MAX: Cost of 2 for VF 4: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; MAX: Cost of 1 for VF 4: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; MAX: Cost of 1 for VF 4: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; MAX: Cost of 1 for VF 4: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; MAX: Cost of 1 for VF 4: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; MAX: Cost of 1 for VF 4: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; MAX: Cost of 1 for VF 4: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; MAX: Cost of 1 for VF 4: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; MAX: Cost of 1 for VF 4: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; MAX: Cost of 1 for VF 4: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; MAX: Cost of 1 for VF 4: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; MAX: Cost of 1 for VF 4: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; MAX: Cost of 1 for VF 4: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; MAX: Cost of 1 for VF 4: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; MAX: Cost of 1 for VF 4: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; MAX: Cost of 1 for VF 4: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; MAX: Cost of 1 for VF 4: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; MAX: Cost of 1 for VF 4: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; MAX: Cost for VF 4: 57 (Estimated cost per lane: 14.3)
; MAX: Cost of 1 for VF 8: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5]]>, ir<%spec.select>
; MAX: Cost of 1 for VF 8: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; MAX: Cost of 1 for VF 8: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; MAX: Cost of 20 for VF 8: INTERLEAVE-GROUP with factor 8, ir<%arrayidx>
; MAX: Cost of 5 for VF 8: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; MAX: Cost of 2 for VF 8: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; MAX: Cost of 20 for VF 8: INTERLEAVE-GROUP with factor 8, ir<%arrayidx1>
; MAX: Cost of 5 for VF 8: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; MAX: Cost of 2 for VF 8: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; MAX: Cost of 2 for VF 8: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; MAX: Cost of 2 for VF 8: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; MAX: Cost of 2 for VF 8: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; MAX: Cost of 2 for VF 8: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; MAX: Cost of 2 for VF 8: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; MAX: Cost of 1 for VF 8: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; MAX: Cost of 2 for VF 8: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; MAX: Cost of 1 for VF 8: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; MAX: Cost of 4 for VF 8: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; MAX: Cost of 2 for VF 8: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; MAX: Cost of 3 for VF 8: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; MAX: Cost of 2 for VF 8: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; MAX: Cost of 3 for VF 8: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; MAX: Cost of 2 for VF 8: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; MAX: Cost of 1 for VF 8: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; MAX: Cost of 2 for VF 8: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; MAX: Cost of 1 for VF 8: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; MAX: Cost of 3 for VF 8: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; MAX: Cost of 2 for VF 8: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; MAX: Cost for VF 8: 122 (Estimated cost per lane: 15.3)
; MAX: Cost of 1 for VF 16: WIDEN-REDUCTION-PHI ir<%core_cnt.078> = phi (add) vp<[[VP5]]>, ir<%spec.select>
; MAX: Cost of 1 for VF 16: WIDEN-REDUCTION-PHI ir<%tail_cnt.077> = phi (add) vp<[[VP5]]>, ir<%tail_cnt.1>
; MAX: Cost of 1 for VF 16: WIDEN-REDUCTION-PHI ir<%neutral_cnt.076> = phi (add) vp<[[VP5]]>, ir<%neutral_cnt.1>
; MAX: Cost of 40 for VF 16: INTERLEAVE-GROUP with factor 8, ir<%arrayidx>
; MAX: Cost of 6 for VF 16: WIDEN-CAST ir<%conv> = zext ir<%0> to i32
; MAX: Cost of 4 for VF 16: WIDEN ir<%sub> = add nsw ir<%conv>, ir<-128>
; MAX: Cost of 40 for VF 16: INTERLEAVE-GROUP with factor 8, ir<%arrayidx1>
; MAX: Cost of 6 for VF 16: WIDEN-CAST ir<%conv2> = zext ir<%1> to i32
; MAX: Cost of 4 for VF 16: WIDEN ir<%sub3> = add nsw ir<%conv2>, ir<-128>
; MAX: Cost of 4 for VF 16: WIDEN ir<%sub8> = sub nsw ir<%conv>, ir<%conv2>
; MAX: Cost of 4 for VF 16: WIDEN ir<%mul> = mul nsw ir<%sub>, ir<%sub>
; MAX: Cost of 4 for VF 16: WIDEN ir<%mul9> = mul nsw ir<%sub3>, ir<%sub3>
; MAX: Cost of 4 for VF 16: WIDEN ir<%add> = add nuw nsw ir<%mul9>, ir<%mul>
; MAX: Cost of 4 for VF 16: WIDEN ir<%sub12> = sub nsw ir<128>, ir<%conv>
; MAX: Cost of 1 for VF 16: WIDEN ir<%cmp1072> = icmp slt ir<%0>, ir<0>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cond> = select ir<%cmp1072>, ir<%sub>, ir<%sub12>
; MAX: Cost of 4 for VF 16: WIDEN ir<%sub16> = sub nsw ir<128>, ir<%conv2>
; MAX: Cost of 1 for VF 16: WIDEN ir<%cmp1373> = icmp slt ir<%1>, ir<0>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cond19> = select ir<%cmp1373>, ir<%sub3>, ir<%sub16>
; MAX: Cost of 8 for VF 16: WIDEN-INTRINSIC ir<%cond26> = call llvm.abs(ir<%sub8>, ir<true>)
; MAX: Cost of 4 for VF 16: WIDEN ir<%cmp27> = icmp ult ir<%add>, ir<257>
; MAX: Cost of 7 for VF 16: WIDEN-CAST ir<%inc> = zext ir<%cmp27> to i32
; MAX: Cost of 4 for VF 16: WIDEN ir<%spec.select> = add ir<%core_cnt.078>, ir<%inc>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cmp29> = icmp ult ir<%add>, ir<325>
; MAX: Cost of 7 for VF 16: WIDEN-CAST ir<%inc32> = zext ir<%cmp29> to i32
; MAX: Cost of 4 for VF 16: WIDEN ir<%tail_cnt.1> = add ir<%tail_cnt.077>, ir<%inc32>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cmp34> = icmp slt ir<%cond>, ir<7>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cmp36> = icmp slt ir<%cond19>, ir<7>
; MAX: Cost of 1 for VF 16: WIDEN ir<%or.cond> = select ir<%cmp34>, ir<%cmp36>, ir<false>
; MAX: Cost of 4 for VF 16: WIDEN ir<%cmp39> = icmp ult ir<%cond26>, ir<5>
; MAX: Cost of 1 for VF 16: WIDEN ir<%or.cond48> = select ir<%or.cond>, ir<%cmp39>, ir<false>
; MAX: Cost of 7 for VF 16: WIDEN-CAST ir<%inc42> = zext ir<%or.cond48> to i32
; MAX: Cost of 4 for VF 16: WIDEN ir<%neutral_cnt.1> = add ir<%neutral_cnt.076>, ir<%inc42>
; MAX: Cost for VF 16: 256 (Estimated cost per lane: 16)
; MAX: LV: Selecting VF: 4.
;
entry:
%cmp74.not = icmp eq i32 %uv_w, 0
br i1 %cmp74.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%neutral_cnt.0.lcssa = phi i32 [ 0, %entry ], [ %neutral_cnt.1, %for.body ]
%tail_cnt.0.lcssa = phi i32 [ 0, %entry ], [ %tail_cnt.1, %for.body ]
%core_cnt.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
store i32 %core_cnt.0.lcssa, ptr %counts, align 4
%arrayidx46 = getelementptr inbounds nuw i8, ptr %counts, i32 4
store i32 %tail_cnt.0.lcssa, ptr %arrayidx46, align 4
%arrayidx47 = getelementptr inbounds nuw i8, ptr %counts, i32 8
store i32 %neutral_cnt.0.lcssa, ptr %arrayidx47, align 4
ret void
for.body: ; preds = %entry, %for.body
%core_cnt.078 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%tail_cnt.077 = phi i32 [ %tail_cnt.1, %for.body ], [ 0, %entry ]
%neutral_cnt.076 = phi i32 [ %neutral_cnt.1, %for.body ], [ 0, %entry ]
%x.075 = phi i32 [ %add44, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds nuw i8, ptr %ub, i32 %x.075
%0 = load i8, ptr %arrayidx, align 1
%conv = zext i8 %0 to i32
%sub = add nsw i32 %conv, -128
%arrayidx1 = getelementptr inbounds nuw i8, ptr %vb, i32 %x.075
%1 = load i8, ptr %arrayidx1, align 1
%conv2 = zext i8 %1 to i32
%sub3 = add nsw i32 %conv2, -128
%sub8 = sub nsw i32 %conv, %conv2
%mul = mul nsw i32 %sub, %sub
%mul9 = mul nsw i32 %sub3, %sub3
%add = add nuw nsw i32 %mul9, %mul
%sub12 = sub nsw i32 128, %conv
%cmp1072 = icmp slt i8 %0, 0
%cond = select i1 %cmp1072, i32 %sub, i32 %sub12
%sub16 = sub nsw i32 128, %conv2
%cmp1373 = icmp slt i8 %1, 0
%cond19 = select i1 %cmp1373, i32 %sub3, i32 %sub16
%cond26 = tail call i32 @llvm.abs.i32(i32 %sub8, i1 true)
%cmp27 = icmp samesign ult i32 %add, 257
%inc = zext i1 %cmp27 to i32
%spec.select = add i32 %core_cnt.078, %inc
%cmp29 = icmp samesign ult i32 %add, 325
%inc32 = zext i1 %cmp29 to i32
%tail_cnt.1 = add i32 %tail_cnt.077, %inc32
%cmp34 = icmp slt i32 %cond, 7
%cmp36 = icmp slt i32 %cond19, 7
%or.cond = select i1 %cmp34, i1 %cmp36, i1 false
%cmp39 = icmp samesign ult i32 %cond26, 5
%or.cond48 = select i1 %or.cond, i1 %cmp39, i1 false
%inc42 = zext i1 %or.cond48 to i32
%neutral_cnt.1 = add i32 %neutral_cnt.076, %inc42
%add44 = add nuw i32 %x.075, 8
%cmp = icmp ult i32 %add44, %uv_w
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
declare i32 @llvm.abs.i32(i32, i1 immarg)