Go to file
Evan Cheng 75315b877c 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
clang Add libEdit dependency on ClangDiagnosticCommon. Hopefully this will unbreak the VS build. 2012-07-16 18:53:42 +00:00
compiler-rt tsan: add platform suffix to Go runtime library 2012-07-16 18:25:43 +00:00
debuginfo-tests Fix this for buggy gdb behavior alongside the change 2012-06-05 18:16:03 +00:00
libclc configure.py: Add an install rule. 2012-06-01 17:29:59 +00:00
libcxx Relax the complete-type checks that are happening under __invokable<Fp, Args...> to only check Fp, and not Args... . This should be sufficient to give the desired high quality diagnostics under both bind and function. And this allows a test reported by Rich E on cfe-dev to pass. Tracked by <rdar://problem/11880602>. 2012-07-16 16:17:34 +00:00
libcxxabi Add missing #include <stdlib.h> into test which uses ::exit. 2012-07-11 09:37:56 +00:00
lld Add missing LLVMSupport 2012-07-04 02:16:35 +00:00
lldb Fix an off by one error when handling a packet where our read buffer size truncates the first chunk of the packet 2012-07-16 18:56:05 +00:00
llvm For something like 2012-07-16 19:35:43 +00:00
polly Allow cast instructions within scops 2012-07-16 10:57:32 +00:00