[X86] Use parity flag from byte test/cmp instruction for __builtin_parity when input...
authorCraig Topper <craig.topper@intel.com>
Sun, 2 Aug 2020 16:58:55 +0000 (09:58 -0700)
committerCraig Topper <craig.topper@intel.com>
Sun, 2 Aug 2020 17:45:04 +0000 (10:45 -0700)
commit64516ec7c1298a4cb16980db49c2f9466f0f3ab5
tree5540fe9c0ee4895e6d9a1b0e96d9b3693a96c32a
parenta258338d627170f204c40ebe93ea7fb18c7c1197
[X86] Use parity flag from byte test/cmp instruction for __builtin_parity when input fits in 8 bits.

If the upper bits of the __builtin_parity idiom are known to be
0 we were previously emitting an xor with 0 to get the parity flag.
But we can use cmp/test instead which may expose opportunities for
load folding or combining an AND.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/parity.ll
llvm/test/CodeGen/X86/vector-reduce-xor-bool.ll