[VectorUtils] move x86's scaleShuffleMask to generic VectorUtils
authorSanjay Patel <spatel@rotateright.com>
Mon, 23 Mar 2020 13:47:16 +0000 (09:47 -0400)
committerSanjay Patel <spatel@rotateright.com>
Mon, 23 Mar 2020 13:58:55 +0000 (09:58 -0400)
commit0eeee83d7513d1d9b5e6916c2f15cc67bd0707e2
tree755c0b2948ce41f76e77c4512c498d08a21ee28a
parent7693a9b9314083eafd9b5b1e19b02aac06962eb2
[VectorUtils] move x86's scaleShuffleMask to generic VectorUtils

We have some long-standing missing shuffle optimizations that could
use this transform via VectorCombine now:
https://bugs.llvm.org/show_bug.cgi?id=35454
(and we still don't get that case in the backend either)

This function is apparently templated because there's existing code
in IR that treats mask values as unsigned and backend code that
treats masks values as signed.

The mask values are not endian-dependent (as shown by the existing
bitcast transform from DAGCombiner).

Differential Revision: https://reviews.llvm.org/D76508
llvm/include/llvm/Analysis/VectorUtils.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/unittests/Analysis/VectorUtilsTest.cpp