[PATCH] D41895: [X86] Another attempt at support prefer-vector-width function attribute

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 18:02:58 PST 2018


craig.topper created this revision.
craig.topper added reviewers: echristo, RKSimon, hfinkel.

This is another attempt at supporting prefer-vector-width attribute in the X86 backend. Some of this is based on a conversation I had with Eric Christopher on IRC. This is a subset of the functionality in https://reviews.llvm.org/D41341.

This patch passes the prefer vector width attribute into the X86Subtarget constructor so that we can keep it as a numeric value on the Subtarget and not just a bool flag for each width.

I've add a subtarget feature to specify a preference that should eventually be set by default for skx, cannonlake, and icelake. For now it just makes a convenient command line hook to see how the same function would be generated with and without the preference. Something that can't be done with the prefer-vector-width function attribute.

I've qualifed all known places in the X86 backend that turn 128/256-bit vectors into 512-bit vectors with the preference. Some places will only obey the preference if hasVLX is enabled. Without VLX support there sometimes isn't a way to support the operation, particularly when the operation involves a mask register.

This does not include any changes to constrain the type legalizer which we will probably still need. Hopefully the X86ISelLowering changes in this patch will mean the legalizer change only touches the X86ISelLowering constructor to qualify the setOperationAction calls.


https://reviews.llvm.org/D41895

Files:
  lib/Target/X86/X86.td
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86Subtarget.cpp
  lib/Target/X86/X86Subtarget.h
  lib/Target/X86/X86TargetMachine.cpp
  lib/Target/X86/X86TargetTransformInfo.cpp
  test/CodeGen/X86/prefer-avx256-lzcnt.ll
  test/CodeGen/X86/prefer-avx256-mask-extend.ll
  test/CodeGen/X86/prefer-avx256-mask-shuffle.ll
  test/CodeGen/X86/prefer-avx256-popcnt.ll
  test/CodeGen/X86/prefer-avx256-shift.ll
  test/CodeGen/X86/prefer-avx256-trunc.ll
  test/CodeGen/X86/prefer-avx256-wide-mul.ll
  test/Transforms/LoopVectorize/X86/avx512.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41895.129205.patch
Type: text/x-patch
Size: 87372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180110/13fceaf3/attachment.bin>


More information about the llvm-commits mailing list