llvm-project/llvm
Craig Topper feb2a58860 [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
2018-08-03 18:00:29 +00:00
..
bindings
cmake Add llvm-rc to LLVM_TOOLCHAIN_TOOLS (PR38386) 2018-08-01 07:51:55 +00:00
docs [llvm-mca][docs] Move the code marker text into its own subsection. NFC. 2018-08-03 15:56:07 +00:00
examples
include [WebAssembly] Cleanup of the way globals and global flags are handled 2018-08-03 14:33:37 +00:00
lib [X86] Add a DAG combine for the __builtin_parity idiom used by clang to enable better codegen 2018-08-03 18:00:29 +00:00
projects
resources
runtimes Revert "[CMake] Pass Clang defaults to runtimes builds" 2018-07-13 20:01:55 +00:00
test [X86] Add a DAG combine for the __builtin_parity idiom used by clang to enable better codegen 2018-08-03 18:00:29 +00:00
tools [llvm-mca] Speed up the computation of the wait/ready/issued sets in the Scheduler. 2018-08-03 12:55:28 +00:00
unittests [Dominators] Make RemoveUnreachableBlocks return false if the BasicBlock is already awaiting deletion 2018-08-03 12:45:29 +00:00
utils build_llvm_package.bat: Add OpenMP back 2018-08-03 07:00:08 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt CMake: Remove LLVM_DYLIB_SYMBOL_VERSIONING 2018-08-02 18:16:10 +00:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.