[PATCH] D87912: [X86] Use shuffle to widen truncate of 128-bit and smaller vectors

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 09:04:52 PDT 2020


foad created this revision.
foad added reviewers: craig.topper, RKSimon.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
foad requested review of this revision.

This uses BITCAST (and maybe CONCAT_VECTORS) and VECTOR_SHUFFLE instead
of scalarizing the vector with EXTRACT_VECTOR_ELTs and rebuilding it
with BUILD_VECTOR. This generates more efficient code in the majority of
affected test cases.

The original motivation for this was to avoid some redundant AND
instructions introduced by D87502 <https://reviews.llvm.org/D87502>, which were due to EXTRACT_VECTOR_ELT
sometimes being optimized to a constant, which makes it harder to
optimize away the scalarize-and-then-rebuild sequence.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87912

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx512-vec-cmp.ll
  llvm/test/CodeGen/X86/bitcast-and-setcc-256.ll
  llvm/test/CodeGen/X86/bitcast-and-setcc-512.ll
  llvm/test/CodeGen/X86/extract-concat.ll
  llvm/test/CodeGen/X86/masked_store_trunc.ll
  llvm/test/CodeGen/X86/masked_store_trunc_usat.ll
  llvm/test/CodeGen/X86/psubus.ll
  llvm/test/CodeGen/X86/vec_cast.ll
  llvm/test/CodeGen/X86/vector-reduce-and-bool.ll
  llvm/test/CodeGen/X86/vector-reduce-mul.ll
  llvm/test/CodeGen/X86/vector-reduce-or-bool.ll
  llvm/test/CodeGen/X86/vector-reduce-xor-bool.ll
  llvm/test/CodeGen/X86/vector-trunc-math.ll
  llvm/test/CodeGen/X86/vector-trunc-packus.ll
  llvm/test/CodeGen/X86/vector-trunc-usat.ll
  llvm/test/CodeGen/X86/vector-trunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87912.292819.patch
Type: text/x-patch
Size: 82054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/9806c43b/attachment-0001.bin>


More information about the llvm-commits mailing list