[PATCH] D54073: [x86] allow vector load narrowing with multi-use values

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 3 10:26:49 PDT 2018


spatel created this revision.
spatel added reviewers: craig.topper, niravd, RKSimon.
Herald added subscribers: kristof.beyls, tpr, javed.absar, nhaehnle, jvesely, mcrosier, arsenm.

This is a long-awaited follow-up suggested in https://reviews.llvm.org/D33578. Since then, I think we've picked up even more opportunities for vector narrowing from changes like https://reviews.llvm.org/D53784, so there are a lot of test diffs. Apart from 2-3 strange cases, I think these are all wins.

I've structured this to be no-functional-change-intended for any target except for x86 because I couldn't tell if AArch64, ARM, and AMDGPU would improve or not. All of those targets have existing regression tests (4, 4, 10 files respectively) that would be affected. Also, Hexagon overrides the shouldReduceLoadWidth() hook, but doesn't show any regression test diffs. The trade-off is deciding if an extra vector load is better than a single wide load + extract_subvector.

For x86, this is almost always better (on paper at least) because we often can fold loads into subsequent ops and not increase the official instruction count. There's also some unknown -- but potentially large -- benefit from using narrower vector ops if wide ops are implemented with multiple uops and/or frequency throttling is avoided.


https://reviews.llvm.org/D54073

Files:
  include/llvm/CodeGen/TargetLowering.h
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  lib/Target/Hexagon/HexagonISelLowering.cpp
  test/CodeGen/X86/2012-01-12-extract-sv.ll
  test/CodeGen/X86/avg.ll
  test/CodeGen/X86/avx-load-store.ll
  test/CodeGen/X86/avx-vzeroupper.ll
  test/CodeGen/X86/avx512-cvt.ll
  test/CodeGen/X86/avx512-extract-subvector-load-store.ll
  test/CodeGen/X86/avx512-insert-extract.ll
  test/CodeGen/X86/avx512-shuffles/partial_permute.ll
  test/CodeGen/X86/fma.ll
  test/CodeGen/X86/insert-into-constant-vector.ll
  test/CodeGen/X86/madd.ll
  test/CodeGen/X86/nontemporal-loads.ll
  test/CodeGen/X86/oddshuffles.ll
  test/CodeGen/X86/pmaddubsw.ll
  test/CodeGen/X86/pr22774.ll
  test/CodeGen/X86/pr34653.ll
  test/CodeGen/X86/sad.ll
  test/CodeGen/X86/sandybridge-loads.ll
  test/CodeGen/X86/shrink_vmul.ll
  test/CodeGen/X86/shuffle-strided-with-offset-256.ll
  test/CodeGen/X86/shuffle-strided-with-offset-512.ll
  test/CodeGen/X86/shuffle-vs-trunc-256.ll
  test/CodeGen/X86/shuffle-vs-trunc-512.ll
  test/CodeGen/X86/sse2.ll
  test/CodeGen/X86/var-permute-256.ll
  test/CodeGen/X86/vec_int_to_fp.ll
  test/CodeGen/X86/vector-compare-results.ll
  test/CodeGen/X86/vector-shuffle-combining-avx.ll
  test/CodeGen/X86/vector-trunc.ll
  test/CodeGen/X86/viabs.ll
  test/CodeGen/X86/widen_load-3.ll
  test/CodeGen/X86/x86-interleaved-access.ll





More information about the llvm-commits mailing list