llvm-project/llvm/test/Transforms/PhaseOrdering/X86
Sanjay Patel b6315aee5b [VectorCombine] try to form vector compare and binop to eliminate scalar ops
binop i1 (cmp Pred (ext X, Index0), C0), (cmp Pred (ext X, Index1), C1)
-->
vcmp = cmp Pred X, VecC
ext (binop vNi1 vcmp, (shuffle vcmp, Index1)), Index0

This is a larger pattern than the existing extractelement folds because we can't
reasonably vectorize the sub-patterns with constants based on cost model calcs
(it doesn't usually make sense to replace a single extracted scalar op with
constant operand with a vector op).

I salvaged as much of the existing logic as I could, but there might be better
ways to share and reduce code.

The motivating case from PR43745:
https://bugs.llvm.org/show_bug.cgi?id=43745
...is the special case of a 2-way reduction. We tried to get SLP to handle that
particular pattern in D59710, but that caused crashing and regressions.
This patch is more general, but hopefully safer.

The v2f64 test with SSE2 surprised me - the cost model accounting looks like this:
OldCost = 0 (free extract of f64 at index 0) + 1 (extract of f64 at index 1) + 2 (scalar fcmps) + 1 (and of bools) = 4
NewCost = 2 (vector fcmp) + 1 (shuffle) + 1 (vector 'and') + 1 (extract of bool) = 5

Differential Revision: https://reviews.llvm.org/D82474
2020-06-29 10:38:52 -04:00
..
addsub.ll [PhaseOrdering] adjust test to use default alias analysis with new pass manager; NFC 2020-05-24 11:28:15 -04:00
horiz-math.ll [VectorCombine] position pass after SLP in the optimization pipeline rather than before 2020-05-22 12:22:44 -04:00
lit.local.cfg [PhaseOrdering] add test for missing vector/CSE transforms (PR45015); NFC 2020-02-25 09:13:49 -05:00
scalarization.ll [VectorCombine] scalarizeBinop - support an all-constant src vector operand 2020-06-09 19:02:05 +01:00
shuffle.ll [VectorCombine] add helper to replace uses and rename 2020-06-22 09:58:49 -04:00
vdiv.ll [PhaseOrdering] add test for hoisting/CSE (PR46115); NFC 2020-05-31 10:34:18 -04:00
vector-reductions-expanded.ll [x86] form reduction intrinsics from vectorizers instead of raw IR 2020-06-05 12:38:49 -04:00
vector-reductions.ll [VectorCombine] try to form vector compare and binop to eliminate scalar ops 2020-06-29 10:38:52 -04:00