diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-08-16 18:51:30 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-08-16 18:51:30 +0000 |
commit | 39eb2324f7ec48bd455c370dcb26ffcf9f8dfc48 (patch) | |
tree | 510034cc5300b1435c485863f011157e20791035 /llvm/lib/Transforms/Instrumentation | |
parent | 3550da79ecdbc2b2a41aa305c659a5f90eb0b3c5 (diff) | |
download | bcm5719-llvm-39eb2324f7ec48bd455c370dcb26ffcf9f8dfc48.tar.gz bcm5719-llvm-39eb2324f7ec48bd455c370dcb26ffcf9f8dfc48.zip |
[InstCombine] canonicalize a scalar-select-of-vectors to vector select
This pattern may arise more frequently with an enhancement to SLP vectorization suggested in PR42755:
https://bugs.llvm.org/show_bug.cgi?id=42755
...but we should handle this pattern to make things easier for the backend either way.
For all in-tree targets that I looked at, codegen for typical vector sizes looks better when we change
to a vector select, so this is safe to do without a cost model (in other words, as a target-independent
canonicalization).
For example, if the condition of the select is a scalar, we end up with something like this on x86:
vpcmpgtd %xmm0, %xmm1, %xmm0
vpextrb $12, %xmm0, %eax
testb $1, %al
jne LBB0_2
## %bb.1:
vmovaps %xmm3, %xmm2
LBB0_2:
vmovaps %xmm2, %xmm0
Rather than the splat-condition variant:
vpcmpgtd %xmm0, %xmm1, %xmm0
vpshufd $255, %xmm0, %xmm0 ## xmm0 = xmm0[3,3,3,3]
vblendvps %xmm0, %xmm2, %xmm3, %xmm0
Differential Revision: https://reviews.llvm.org/D66095
llvm-svn: 369140
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
0 files changed, 0 insertions, 0 deletions