[PATCH] Optimize sext 4xi8,4xi16 to 4xi64
Arnold Schwaighofer
aschwaighofer at apple.com
Tue Mar 5 10:30:47 PST 2013
Hi Muhammad,
can you add a test case for the cost model to make sure we get the cost right. See test/Analysis/CostModel/X86/cast.ll for examples.
Basically, you have to add entries or make sure that they have the right cost for
;CHECK: cost of 3 {{.*}} sext
%Y = sext <4 x i8> undef to <4 x i64>
;CHECK: cost of 3 {{.*}} sext
%Y = sext <4 x i16> %undef to <4 x i64>
If we don't already get the cost right - probably we don't - you need to edit the file lib/Target/X86/X86TargetTransformInfo.cpp:X86TTI::getCastInstrCost and add the appropriate costs to the appropriate table.
Something like:
static const TypeConversionCostTblEntry<MVT> AVXConversionTbl[] = {
{ ISD::SIGN_EXTEND, MVT::v8i32, MVT::v8i16, 1 },
+ { ISD::SIGN_EXTEND, MVT::v4i8, MVT::v4i64, 3 },
+ { ISD::SIGN_EXTEND, MVT::v4i16, MVT::v4i64, 3 },
Thanks,
Arnold
More information about the llvm-commits
mailing list