llvm-project/llvm
Craig Topper 8983db15a3 [RISCV] Optimize (brcond (seteq (and X, 1 << C), 0))
If C > 10, this will require a constant to be materialized for the
And. To avoid this, we can shift X left by XLen-1-C bits to put the
tested bit in the MSB, then we can do a signed compare with 0 to
determine if the MSB is 0 or 1. Thanks to @reames for the suggestion.

I've implemented this inside of translateSetCCForBranch which is
called when setcc+brcond or setcc+select is converted to br_cc or
select_cc during lowering. It doesn't make sense to do this for
general setcc since we lack a sgez instruction.

I've tested bit 10, 11, 31, 32, 63 and a couple bits betwen 11 and 31
and between 32 and 63 for both i32 and i64 where applicable. Select
has some deficiencies where we receive (and (srl X, C), 1) instead.
This doesn't happen for br_cc due to the call to rebuildSetCC in the
generic DAGCombiner for brcond. I'll explore improving select in a
future patch.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D130203
2022-07-20 18:40:49 -07:00
..
benchmarks
bindings [IR] Remove support for float binop constant expressions 2022-07-12 09:40:49 +02:00
cmake [llvm] [cmake] Skip driver-related code unless LLVM_TOOL_LLVM_DRIVER_BUILD 2022-07-20 22:17:48 +02:00
docs Revert "Don't treat readnone call in presplit coroutine as not access memory" 2022-07-20 17:00:58 +08:00
examples [Kaleidoscope] Remove unused function argument 2022-06-30 20:47:01 +00:00
include [ORC] Add a new MemoryMapper-based JITLinkMemoryManager implementation. 2022-07-20 17:52:37 -07:00
lib [RISCV] Optimize (brcond (seteq (and X, 1 << C), 0)) 2022-07-20 18:40:49 -07:00
projects
resources
runtimes
test [RISCV] Optimize (brcond (seteq (and X, 1 << C), 0)) 2022-07-20 18:40:49 -07:00
tools llvm-reduce: Fix register mask test 2022-07-20 18:19:14 -04:00
unittests [ORC] Add a new MemoryMapper-based JITLinkMemoryManager implementation. 2022-07-20 17:52:37 -07:00
utils [gn build] Port 4fcf8434dd 2022-07-21 00:53:15 +00:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [llvm] add zstd to `llvm::compression` namespace 2022-07-19 10:54:36 -07:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.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.