[DAGCombiner] Fold xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) anytime...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 11 Apr 2016 21:10:33 +0000 (21:10 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 11 Apr 2016 21:10:33 +0000 (21:10 +0000)
commit82e54871d03e29fd9c0477c2b4906765a17fce08
treebce51478f705ae9c8b7e7d6a6284361a10f4c7b2
parent5751814edada5a6490e7c00ad34ddc0faf01d73c
[DAGCombiner] Fold xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) anytime before LegalizeVectorOprs

xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) was only being combined at the AfterLegalizeTypes stage, this patch permits the combine to occur anytime before then as well.

The main aim with this to improve the ability to recognise bitmasks that can be converted to shuffles.

I had to modify a number of AVX512 mask tests as the basic bitcast to/from scalar pattern was being stripped out, preventing testing of the mmask bitops. By replacing the bitcasts with loads we can get almost the same result.

Differential Revision: http://reviews.llvm.org/D18944

llvm-svn: 265998
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/avx512-mask-op.ll
llvm/test/CodeGen/X86/avx512-select.ll
llvm/test/CodeGen/X86/avx512bw-mask-op.ll
llvm/test/CodeGen/X86/avx512dq-mask-op.ll
llvm/test/CodeGen/X86/vector-shuffle-128-v4.ll
llvm/test/CodeGen/X86/vector-shuffle-128-v8.ll
llvm/test/CodeGen/X86/widen_bitops-0.ll
llvm/test/CodeGen/X86/widen_bitops-1.ll