[PATCH] D29631: SystemZTargetTransformInfo cost functions and some common code changes

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 04:49:42 PST 2017


jonpa created this revision.
Herald added subscribers: nemanjai, mzolotukhin.
Herald added a reviewer: javed.absar.

SystemZTargetTransformInfo methods implemented:

  int getArithmeticInstrCost()
  int getCastInstrCost()
  int getCmpSelInstrCost()

Common code changes:

getCmpSelInstrCost() has gotten an extra parameter to make it possible to pass the actual instruction if it exists. The motivation for this is that the actual cost on SystemZ for compare and select instructions depend on the scalar widths of the vector elements. The vector element compare instruction produces a bitmask for the elements, and the vector select operates with that bitmask. However, if the widths of the elements of the compare / select operands differ, the bitmask must be adjusted with pack or unpack instructions for instance. Therefore it is useful to look at the "other" instruction when evaluating cost for the compare or select instruction.

LoopVectorizer.cpp: Don't consider a vectorized cost for the compare if it is for the conditional back branch in the loop latch.

New ovlerloaded method getScalarizationOverhead() which was factored out of getArithmeticInstrCost(). This method is useful also in the SystemZ backend.

The fix in InstCombineVectorOps.cpp is "in progress", which is obviously needed in some cases. See https://llvm.org/bugs/show_bug.cgi?id=30630


https://reviews.llvm.org/D29631

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/CodeGen/BasicTTIImpl.h
  lib/Analysis/CostModel.cpp
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  lib/Target/AArch64/AArch64TargetTransformInfo.h
  lib/Target/ARM/ARMTargetTransformInfo.cpp
  lib/Target/ARM/ARMTargetTransformInfo.h
  lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  lib/Target/PowerPC/PPCTargetTransformInfo.h
  lib/Target/SystemZ/SystemZISelLowering.cpp
  lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
  lib/Target/SystemZ/SystemZTargetTransformInfo.h
  lib/Target/X86/X86TargetTransformInfo.cpp
  lib/Target/X86/X86TargetTransformInfo.h
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29631.87393.patch
Type: text/x-patch
Size: 42306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/889628b7/attachment.bin>


More information about the llvm-commits mailing list