llvm-project/llvm
Bill Wendling 6517f88f25 Micro-optimization:
This code:

float floatingPointComparison(float x, float y) {
    double product = (double)x * y;
    if (product == 0.0)
        return product;
    return product - 1.0;
}

produces this:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jne             0x00000004
0000000000000016        jp              0x00000002
0000000000000018        jmp             0x00000008
000000000000001a        addsd           0x00000006(%rip),%xmm0
0000000000000022        cvtsd2ss        %xmm0,%xmm0
0000000000000026        ret

The "jne/jp/jmp" sequence can be reduced to this instead:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jp              0x00000002
0000000000000016        je              0x00000008
0000000000000018        addsd           0x00000006(%rip),%xmm0
0000000000000020        cvtsd2ss        %xmm0,%xmm0
0000000000000024        ret

for a savings of 2 bytes.

This xform can happen when we recognize that jne and jp jump to the same "true"
MBB, the unconditional jump would jump to the "false" MBB, and the "true" branch
is the fall-through MBB.

llvm-svn: 97766
2010-03-05 00:24:26 +00:00
..
autoconf Move the docsdir to /usr/share/doc/llvm to match other projects. 2010-03-02 05:17:21 +00:00
bindings Expose the rest of the llvm-c scalar opts to ocaml. 2010-03-03 23:51:34 +00:00
cmake Update CMake LibDeps 2010-01-22 18:14:14 +00:00
docs Add metadata example. 2010-03-04 23:44:48 +00:00
examples Roll back r96959 again. 2010-02-23 20:53:37 +00:00
include inline CannotYetSelectIntrinsic into CannotYetSelect and simplify. 2010-03-04 00:21:16 +00:00
lib Micro-optimization: 2010-03-05 00:24:26 +00:00
projects Testing subversion commit access 2010-02-23 15:11:17 +00:00
runtime Switch .bc/.ll Makefile rules to use LLVM{CC,CXX} instead of LLVMG{CC,XX} 2010-02-23 10:28:06 +00:00
test Micro-optimization: 2010-03-05 00:24:26 +00:00
tools Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153. 2010-03-04 20:56:19 +00:00
unittests Stop leaking MDStrings. 2010-03-04 23:24:19 +00:00
utils Simplify the condition-checking logic and hopefully clear up a build failure 2010-03-04 11:48:42 +00:00
website
CMakeLists.txt CMake: Add MCParser directory. 2010-01-22 02:04:33 +00:00
CREDITS.TXT Adding the MicroBlaze backend. 2010-02-23 19:15:24 +00:00
LICENSE.TXT 2010 is upon us. 2010-01-09 18:40:31 +00:00
Makefile Try r96559 for the third time. This time the shared library is only built if 2010-02-25 06:34:33 +00:00
Makefile.common
Makefile.config.in Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153. 2010-03-04 20:56:19 +00:00
Makefile.rules Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153. 2010-03-04 20:56:19 +00:00
ModuleInfo.txt
README.txt Give packagers some advice about how to build LLVM so it's useful to 2010-02-26 00:54:42 +00:00
build-for-llvm-top.sh
configure Move the docsdir to /usr/share/doc/llvm to match other projects. 2010-03-02 05:17:21 +00:00
llvm.spec.in

README.txt

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.