<p dir="ltr"><br>
On Mar 27, 2014 8:41 AM, "Jim Grosbach" <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:<br>
><br>
><br>
><br>
> > On Mar 26, 2014, at 10:32 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
> ><br>
> >> On Wed, Mar 26, 2014 at 5:04 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:<br>
> >> Author: grosbach<br>
> >> Date: Wed Mar 26 19:04:11 2014<br>
> >> New Revision: 204880<br>
> >><br>
> >> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204880&view=rev">http://llvm.org/viewvc/llvm-project?rev=204880&view=rev</a><br>
> >> Log:<br>
> >> X86: Correct vectorization cost model for v8f32->v8i8.<br>
> >><br>
> >> Fix the cost model to reflect the reality of our codegen.<br>
> ><br>
> > Reality of our codegen or reality of the processors?<br>
> ><br>
><br>
> The latter, though the cost model should be accurately reflecting both.</p>
<p dir="ltr">It should, but in the latter a bug should be filed and a comment to that effect listed. "Realities of our CodeGen" really sounds like a deficiency we're papering over. </p>
<p dir="ltr">-eric </p>
<p dir="ltr">PS. Reading more of the patches I'll just CC Quentin on this response too.  :)</p>
<p dir="ltr">> > -eric<br>
> ><br>
> >><br>
> >> rdar://16370633<br>
> >><br>
> >> Added:<br>
> >>    llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll<br>
> >> Modified:<br>
> >>    llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp<br>
> >><br>
> >> Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp<br>
> >> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=204880&r1=204879&r2=204880&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=204880&r1=204879&r2=204880&view=diff</a><br>

> >> ==============================================================================<br>
> >> --- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)<br>
> >> +++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Wed Mar 26 19:04:11 2014<br>
> >> @@ -513,7 +513,7 @@ unsigned X86TTI::getCastInstrCost(unsign<br>
> >>     { ISD::UINT_TO_FP,  MVT::v4f64, MVT::v4i16, 2 },<br>
> >>     { ISD::UINT_TO_FP,  MVT::v4f64, MVT::v4i32, 6 },<br>
> >><br>
> >> -    { ISD::FP_TO_SINT,  MVT::v8i8,  MVT::v8f32, 1 },<br>
> >> +    { ISD::FP_TO_SINT,  MVT::v8i8,  MVT::v8f32, 7 },<br>
> >>     { ISD::FP_TO_SINT,  MVT::v4i8,  MVT::v4f32, 1 },<br>
> >>   };<br>
> >><br>
> >><br>
> >> Added: llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll<br>
> >> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll?rev=204880&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll?rev=204880&view=auto</a><br>

> >> ==============================================================================<br>
> >> --- llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll (added)<br>
> >> +++ llvm/trunk/test/Transforms/LoopVectorize/X86/fp_to_sint8-cost-model.ll Wed Mar 26 19:04:11 2014<br>
> >> @@ -0,0 +1,24 @@<br>
> >> +; RUN: opt < %s  -loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -S -debug-only=loop-vectorize 2>&1 | FileCheck %s<br>
> >> +<br>
> >> +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"<br>
> >> +target triple = "x86_64-apple-macosx10.8.0"<br>
> >> +<br>
> >> +<br>
> >> +; CHECK: cost of 7 for VF 8 For instruction:   %conv = fptosi float %tmp to i8<br>
> >> +define void @float_to_sint8_cost(i8* noalias nocapture %a, float* noalias nocapture readonly %b) nounwind {<br>
> >> +entry:<br>
> >> +  br label %for.body<br>
> >> +for.body:<br>
> >> +  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> >> +  %arrayidx = getelementptr inbounds float* %b, i64 %indvars.iv<br>
> >> +  %tmp = load float* %arrayidx, align 4<br>
> >> +  %conv = fptosi float %tmp to i8<br>
> >> +  %arrayidx2 = getelementptr inbounds i8* %a, i64 %indvars.iv<br>
> >> +  store i8 %conv, i8* %arrayidx2, align 4<br>
> >> +  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> >> +  %exitcond = icmp eq i64 %indvars.iv.next, 256<br>
> >> +  br i1 %exitcond, label %for.end, label %for.body<br>
> >> +<br>
> >> +for.end:<br>
> >> +  ret void<br>
> >> +}<br>
> >><br>
> >><br>
> >> _______________________________________________<br>
> >> llvm-commits mailing list<br>
> >> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>