Commit Graph

15214 Commits

Author SHA1 Message Date
Reid Spencer
761920301d PPC32GenCodeEmitter instead of PowerPCGenCodeEmitter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:59:38 +00:00
Reid Spencer
e6ffb3eda1 Add runtime directories
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17086 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:58:49 +00:00
Reid Spencer
952ba29d33 Support bytecode generation, GenCodeEmitter, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17085 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:57:12 +00:00
Reid Spencer
900aa65a91 Add runtime directory, include Makefile_rules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17084 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 14:56:15 +00:00
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
Chris Lattner
07306de06e Unify handling of constant pool indexes with the other code paths, allowing
us to use index registers for CPI's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:49:45 +00:00
Chris Lattner
0e0ed85697 Give the asmprinter the ability to print memrefs with a constant pool index,
index reg and scale


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 07:16:32 +00:00
Chris Lattner
de95c9e0bb fold:
%X = and Y, constantint
  %Z = setcc %X, 0

instead of emitting:

        and %EAX, 3
        test %EAX, %EAX
        je .LBBfoo2_2   # UnifiedReturnBlock

We now emit:

        test %EAX, 3
        je .LBBfoo2_2   # UnifiedReturnBlock

This triggers 581 times on 176.gcc for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 06:10:40 +00:00
Chris Lattner
9894cd300e All of these labels are off by one now that the unreachable instruction exists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:37:47 +00:00
Nate Begeman
1b75022cd3 Implement bitfield insert by recognizing the following pattern:
1. optional shift left
2. and x, immX
3. and y, immY
4. or z, x, y
==> rlwimi z, x, y, shift, mask begin, mask end

where immX == ~immY and immX is a run of set bits. This transformation
fires 32 times on voronoi, once on espresso, and probably several
dozen times on external benchmarks such as gcc.

To put this in terms of actual code generated for
struct B { unsigned a : 3; unsigned b : 2; };
void storeA (struct B *b, int v) { b->a = v;}
void storeB (struct B *b, int v) { b->b = v;}

Old:
_storeA:
        rlwinm r2, r4, 0, 29, 31
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 0, 28
        or r2, r4, r2
        stw r2, 0(r3)
        blr

_storeB:
        rlwinm r2, r4, 3, 0, 28
        rlwinm r2, r2, 0, 27, 28
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 29, 26
        or r2, r2, r4
        stw r2, 0(r3)
        blr

New:
_storeA:
        lwz r2, 0(r3)
        rlwimi r2, r4, 0, 29, 31
        stw r2, 0(r3)
        blr

_storeB:
        lwz r2, 0(r3)
        rlwimi r2, r4, 3, 27, 28
        stw r2, 0(r3)
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:19:20 +00:00
Chris Lattner
35f92ae3af Fix constant folding relational operators with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17077 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 04:01:51 +00:00
Chris Lattner
a78a9027f5 Reid added --version to the CommandLine lib. Don't conflict with it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17076 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:49:08 +00:00
Chris Lattner
7ff5a32a48 I forgot that sparc no longer uses the shared asmwriter. Give it support
for undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17075 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:44:45 +00:00
Chris Lattner
d14d5b4223 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17074 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:42:42 +00:00
Reid Spencer
da0a22b7ac Initial Makefile.am for building with automake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17073 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:24:24 +00:00
Reid Spencer
aa717415bf Initial Makefile.am for building with automake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17072 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:20:42 +00:00
Reid Spencer
2bf0292432 Make sure that for systems where the string functions are actually macros
that we undefine the macro before using its name in the definition. This
can happen on Linux if _GNU_SOURCE is defined.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 00:17:54 +00:00
Chris Lattner
71d3778c0b Implement constant folding of undef values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17070 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:31:32 +00:00
Chris Lattner
79a564caa7 Fix a type violation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 23:28:04 +00:00
Nate Begeman
2d4c98d79b Finally fix one of the oldest FIXMEs in the PowerPC backend: correctly
flag rotate left word immediate then mask insert (rlwimi) as a two-address
instruction, and update the ISel usage of the instruction accordingly.

This will allow us to properly schedule rlwimi, and use it to efficiently
codegen bitfield operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 20:43:38 +00:00
Chris Lattner
6e758aee74 Kill the bogon that slipped into my buffer before I committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:46:33 +00:00
Chris Lattner
061718cba8 Implement InstCombine/getelementptr.ll:test9, which is the source of many
ugly and giant constnat exprs in some programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:44:59 +00:00
Chris Lattner
51a2c5aebf New testcase, rework testcases to fail if there are any gep's other than those
involving %B instead of allowing any geps except %A's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17065 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:44:23 +00:00
Misha Brukman
a04d0a19e3 * Add a space between words
* Wrap at 80 cols


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 19:13:58 +00:00
Chris Lattner
2e7ec128f9 Do not erroneously accept revision 6 bytecode files when the format hasn't
been defined yet!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:56:02 +00:00
Chris Lattner
9b3b04f82b Update release notes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17062 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:35:57 +00:00
Chris Lattner
6542a46e6f New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17061 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:28:01 +00:00
Chris Lattner
4c554c589f Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17059 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:24:35 +00:00
Chris Lattner
9bbcf09431 testcases for undefined and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17058 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:24:11 +00:00
Chris Lattner
9270efcc5f Fix fix fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17057 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:21:50 +00:00
Chris Lattner
ec7c1ab1da Add support for unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17056 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:21:33 +00:00
Chris Lattner
bd1d382cc4 Add support for undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:19:26 +00:00
Chris Lattner
a79e7cca0d Add support for undef, unreachable, and function flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17054 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:18:16 +00:00
Chris Lattner
16710e9574 Parse undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17053 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:17:13 +00:00
Chris Lattner
c17edbdeeb Add support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17052 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:16:19 +00:00
Chris Lattner
5a083b81c4 Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17051 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:14:10 +00:00
Chris Lattner
289a49ab7d ADd support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17050 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:13:47 +00:00
Chris Lattner
30483b0c84 Teach the X86 backend about unreachable and undef. Among other things, we
now compile:

'foo() {}' into "ret" instead of "mov EAX, 0; ret"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17049 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:13:05 +00:00
Chris Lattner
a9d12c0a56 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:12:13 +00:00
Chris Lattner
e87597fb75 Optimize instructions involving undef values. For example X+undef == undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17047 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:11:37 +00:00
Chris Lattner
82731c793a Add support for UndefValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17046 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:10:31 +00:00
Chris Lattner
b20724dff4 When promoting mem2reg, make uninitialized values become undef isntead of 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:10:06 +00:00
Chris Lattner
5d356a7c82 Handle undef values as undefined on the constant lattice
ignore unreachable instructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17044 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:41 +00:00
Chris Lattner
b2f59a2af7 Add note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17043 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:25 +00:00
Chris Lattner
7a7ed0274d Add support for the undef value. Implement a new optimization based on globals
that are initialized with undef.  When promoting malloc to a global, start out
initialized to undef


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17042 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:09:00 +00:00
Chris Lattner
b976e66816 Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17041 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:08:06 +00:00
Chris Lattner
b9f18592a6 Implement UndefValue class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17040 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:07:16 +00:00
Chris Lattner
c8717b1624 Add support for the unreachable instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17039 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:06:43 +00:00
Chris Lattner
7eb8a52332 Add new UndefValueVal type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17038 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:06:07 +00:00
Chris Lattner
076b3f1693 Add new UnreachableInst class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17037 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:05:54 +00:00