aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Compression.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-08-03 18:00:29 +0000
committerCraig Topper <craig.topper@intel.com>2018-08-03 18:00:29 +0000
commitfeb2a5886047f5188ba61c44b6f12222bdb83f18 (patch)
treedea31d7db4d0d6d43d9fd170b2148c6ea21524d7 /llvm/lib/Support/Compression.cpp
parentb0ad9b9fd73d7b4dfa243e3213b581993111e501 (diff)
downloadllvm-feb2a5886047f5188ba61c44b6f12222bdb83f18.zip
llvm-feb2a5886047f5188ba61c44b6f12222bdb83f18.tar.gz
llvm-feb2a5886047f5188ba61c44b6f12222bdb83f18.tar.bz2
[X86] Add a DAG combine for the __builtin_parity idiom used by clang to enable better codegen
Clang uses "ctpop & 1" to implement __builtin_parity. If the popcnt instruction isn't supported this generates a large amount of code to calculate the population count. Instead we can bisect the data down to a single byte using xor and then check the parity flag. Even when popcnt is supported, its still a good idea to split 64-bit data on 32-bit targets using an xor in front of a single popcnt. Otherwise we get two popcnts and an add before the and. I've specifically targeted this at the sizes supported by clang builtins, but we could generalize this if we think that's useful. Differential Revision: https://reviews.llvm.org/D50165 llvm-svn: 338907
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
0 files changed, 0 insertions, 0 deletions