Fork of llvm with experimental commits and workarounds for RPCS3
Go to file
Evan Cheng b409a61574 For something like
uint32_t hi(uint64_t res)
{
        uint_32t hi = res >> 32;
        return !hi;
}

llvm IR looks like this:
define i32 @hi(i64 %res) nounwind uwtable ssp {
entry:
  %lnot = icmp ult i64 %res, 4294967296
  %lnot.ext = zext i1 %lnot to i32
  ret i32 %lnot.ext
}

The optimizer has optimize away the right shift and truncate but the resulting
constant is too large to fit in the 32-bit immediate field. The resulting x86
code is worse as a result:
        movabsq $4294967296, %rax       ## imm = 0x100000000
        cmpq    %rax, %rdi
        sbbl    %eax, %eax
        andl    $1, %eax

This patch teaches the x86 lowering code to handle ult against a large immediate
with trailing zeros. It will issue a right shift and a truncate followed by
a comparison against a shifted immediate.
        shrq    $32, %rdi
        testl   %edi, %edi
        sete    %al
        movzbl  %al, %eax

It also handles a ugt comparison against a large immediate with trailing bits
set. i.e. X >  0x0ffffffff -> (X >> 32) >= 1

rdar://11866926

llvm-svn: 160312
2012-07-16 19:35:43 +00:00
autoconf Revert "Build script changes for R600/SI Codegen v6" 2012-07-16 18:19:46 +00:00
bindings [python] Add negative MemoryBuffer testcase 2012-03-22 11:23:52 +00:00
cmake detabify 2012-07-12 13:18:13 +00:00
docs ReleaseNotes.html: add note about specifying TLS models 2012-07-13 12:44:23 +00:00
examples Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h 2012-06-29 12:38:19 +00:00
include MIPS: Create two definitions for __builtin_mips_shll_qb builtin. 2012-07-16 18:51:39 +00:00
lib For something like 2012-07-16 19:35:43 +00:00
projects Revert "Build script changes for R600/SI Codegen v6" 2012-07-16 18:19:46 +00:00
runtime Free the allocated filename. Found by clang static analyzer. 2012-06-15 09:11:47 +00:00
test For something like 2012-07-16 19:35:43 +00:00
tools Target option DisableJumpTables is a gross hack. Move it to TargetLowering instead. 2012-07-02 22:39:56 +00:00
unittests make ConstantRange::getSetSize() properly compute the size of wrapped and full sets. 2012-07-16 18:08:12 +00:00
utils TableGen: Assembly matcher 'insufficient operands' diagnostic. 2012-07-12 21:37:20 +00:00
.gitignore Add tools/lld to .gitignore. 2012-05-02 21:25:32 +00:00
CMakeLists.txt Revert "Build script changes for R600/SI Codegen v6" 2012-07-16 18:19:46 +00:00
configure Revert "Build script changes for R600/SI Codegen v6" 2012-07-16 18:19:46 +00:00
CREDITS.TXT Alphabetize. 2012-06-19 23:47:58 +00:00
LICENSE.TXT Add YAML parser to Support. 2012-04-03 23:09:22 +00:00
llvm.spec.in Tidy up. s/Low Level Virtual Machine/LLVM/. 2012-01-25 22:00:23 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile Do not install llvm-config-host for cross-builds of clang. rdar://11317847 2012-05-09 00:07:02 +00:00
Makefile.common [docs] Remove unsupported references to ExtraSource variable. 2012-05-15 21:32:27 +00:00
Makefile.config.in Remove autoconf support for runtest and tclsh, some of the last vestigal 2012-06-27 23:53:41 +00:00
Makefile.rules Remove 'check-dg', a wrapper around 'check-local-dg' which was just 2012-06-28 00:03:13 +00:00
README.txt test commit 2012-07-11 17:34:12 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level
Virtual Machine, 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 HTML documentation provided in docs/index.html for further
assistance with LLVM.

If you're writing a package for LLVM, see docs/Packaging.html for our
suggestions.