LLVM backend for 6502
Go to file
Chris Lattner 56a31c69c8 Rewrite support for cast uint -> FP. In particular, we used to compile this:
double %test(uint %X) {
        %tmp.1 = cast uint %X to double         ; <double> [#uses=1]
        ret double %tmp.1
}

into:

test:
        sub %ESP, 8
        mov %EAX, DWORD PTR [%ESP + 12]
        mov %ECX, 0
        mov DWORD PTR [%ESP], %EAX
        mov DWORD PTR [%ESP + 4], %ECX
        fild QWORD PTR [%ESP]
        add %ESP, 8
        ret

... which basically zero extends to 8 bytes, then does an fild for an
8-byte signed int.

Now we generate this:


test:
        sub %ESP, 4
        mov %EAX, DWORD PTR [%ESP + 8]
        mov DWORD PTR [%ESP], %EAX
        fild DWORD PTR [%ESP]
        shr %EAX, 31
        fadd DWORD PTR [.CPItest_0 + 4*%EAX]
        add %ESP, 4
        ret

        .section .rodata
        .align  4
.CPItest_0:
        .quad   5728578726015270912

This does a 32-bit signed integer load, then adds in an offset if the sign
bit of the integer was set.

It turns out that this is substantially faster than the preceeding sequence.
Consider this testcase:

unsigned a[2]={1,2};
volatile double G;

void main() {
    int i;
    for (i=0; i<100000000; ++i )
        G += a[i&1];
}

On zion (a P4 Xeon, 3Ghz), this patch speeds up the testcase from 2.140s
to 0.94s.

On apoc, an athlon MP 2100+, this patch speeds up the testcase from 1.72s
to 1.34s.

Note that the program takes 2.5s/1.97s on zion/apoc with GCC 3.3 -O3
-fomit-frame-pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17083 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 08:01:28 +00:00
autoconf Transfer Makefile.JIT into the build tree for JIT-enabling tools and examples 2004-10-14 18:59:09 +00:00
docs * Add a space between words 2004-10-16 19:13:58 +00:00
examples Use the shared Makefile.JIT for JIT-enablement, which also enables the examples 2004-10-14 19:02:13 +00:00
include/llvm Add support for the unreachable instruction 2004-10-16 18:06:43 +00:00
lib Rewrite support for cast uint -> FP. In particular, we used to compile this: 2004-10-17 08:01:28 +00:00
projects Remove exhuberant-style comments which remained from copying file from `sample' 2004-10-11 00:56:41 +00:00
runtime Initial Makefile.am for building with automake 2004-10-17 00:24:24 +00:00
test New testcase, rework testcases to fail if there are any gep's other than those 2004-10-16 19:44:23 +00:00
tools Reid added --version to the CommandLine lib. Don't conflict with it. 2004-10-17 02:49:08 +00:00
utils Add support for undef and unreachable 2004-10-16 18:24:35 +00:00
.cvsignore Ok, try #2, this time I'll not be stupid 2003-08-03 18:33:24 +00:00
configure Add Makefile.JIT to the list of Makefiles transferred to the build dir to give 2004-10-14 18:59:42 +00:00
configure_am Changes for automake. 2004-10-13 11:56:07 +00:00
CREDITS.TXT Update email address 2004-09-23 04:39:30 +00:00
LICENSE.TXT Adjust the license files based on the actual content of llvm and llvm-test 2004-09-16 16:41:31 +00:00
llvm.spec Updated for 1.3. 2004-08-16 15:17:40 +00:00
llvm.spec.in Updated for 1.3. 2004-08-16 15:17:40 +00:00
Makefile Changed the distclean target to handle the new location of config.h. 2004-09-17 15:08:25 +00:00
Makefile_config Changes for automake. 2004-10-13 11:56:07 +00:00
Makefile_rules Get rid of the horrendous FIND_PATH macro, have libs and progs linked into 2004-10-13 11:39:51 +00:00
Makefile.am Top level makefile for building LLVM with automake. 2004-10-10 19:13:03 +00:00
Makefile.common Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
Makefile.config.in Fix typo in makefile variable name that prevents zlib from being recognized 2004-10-04 17:49:19 +00:00
Makefile.rules Fix grammar 2004-10-11 02:06:40 +00:00
README.txt Make the text of this file a little more useful. 2004-09-02 22:49:27 +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.