[X86][SSE] LowerVectorAllZero - add support for masked OR-reductions
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 30 Jun 2020 13:09:23 +0000 (14:09 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 30 Jun 2020 13:38:52 +0000 (14:38 +0100)
commit82de01895455c2ac0f2aa7397414ca96757bea06
tree8beb4005eec64dab9f19db3a488ca584d0b3a331
parent05c479491c1d3236cae4eccaa3fcd2794598522c
[X86][SSE] LowerVectorAllZero - add support for masked OR-reductions

If we're masking the result of an OR-reduction before comparing against zero, we can fold this into the PTEST() / MOVMSK(CMPEQ()) codegen by pre-masking the source value.

This works particularly well on PTEST which performs the AND as part of its operation, but the MOVMSK variant also benefits for non-V2I64 cases.

Fixes PR44781
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-reduce-or-cmp.ll