[X86][SSE] Fold vselect(pshufb,pshufb) -> or(pshufb,pshufb)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Sep 2020 15:53:41 +0000 (16:53 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Sep 2020 15:55:00 +0000 (16:55 +0100)
commit888049b97a7495ba669020522bcae6691287bd9a
tree47b848255044e694260aec2caae626e36c3555b9
parent39cf83cc78ff0a017fb9de27d45b87217aa6f558
[X86][SSE] Fold vselect(pshufb,pshufb) -> or(pshufb,pshufb)

If the PSHUFBs have no other uses, then we can force the unselected elements to zero to OR them instead, avoiding both an extra mask load and a costly variable blend.

Eventually we should try to bring this into shuffle combining, once we can more easily convert between shuffles + select patterns.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-shuffle-256-v16.ll
llvm/test/CodeGen/X86/vector-shuffle-256-v32.ll
llvm/test/CodeGen/X86/vector-shuffle-combining.ll