Commit Graph

864 Commits

Author SHA1 Message Date
Chris Lattner
cc65beeb39 Two changes here:
1. Add new instructions for checking parity flags: JP, JNP, SETP, SETNP.
2. Set the isCommutable and isPromotableTo3Address bits on several
   instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19246 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-02 02:35:46 +00:00
Chris Lattner
6b4f501470 Remove unused enum value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19024 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 22:41:46 +00:00
Chris Lattner
8cdbc35216 Change the sentinal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19007 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 00:46:51 +00:00
Chris Lattner
11cf7aa775 Create a stack slot for the return address lazily instead of eagerly. This
save small amounts of time for functions that don't call llvm.returnaddress
or llvm.frameaddress (which is almost all functions).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19006 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 00:07:46 +00:00
Chris Lattner
84b85c8262 Adjust to changes in asmwriter filenames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18987 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 17:33:24 +00:00
Chris Lattner
c0354c904b Set the rounding mode for the X86 FPU to 64-bits instead of 80-bits. We
don't support long double anyway, and this gives us FP results closer to
other targets.

This also speeds up 179.art from 41.4s to 18.32s, by eliminating a problem
with extra precision that causes an FP == comparison to fail (leading to
extra loop iterations).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18895 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 17:23:11 +00:00
Chris Lattner
3ea78c4276 Use the target triple to pick this target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 17:40:28 +00:00
Chris Lattner
223d4c4b3a Fix a regression caused by the previous patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18449 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 05:13:15 +00:00
Chris Lattner
45de191b0b Spill/restore X86 floating point stack registers with 64-bits of precision
instead of 80-bits of precision.  This fixes PR467.

This change speeds up fldry on X86 with LLC from 7.32s on apoc to 4.68s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18433 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 18:17:31 +00:00
Chris Lattner
3986924e0b Consider 64-bit registers to be FP as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18432 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 17:57:21 +00:00
Tanya Lattner
9855b84469 Reverting this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041122/021428.html

It broke Mutlisource/Applications/obsequi


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18407 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-01 18:27:03 +00:00
Chris Lattner
928b47ae2e Revamp long/ulong comparisons to use a much more efficient sequence (thanks
to Brian and the Sun compiler for pointing out that the obvious works :)

This also enables folding all long comparisons into setcc and branch
instructions: before we could only do == and !=

For example, for:
void test(unsigned long long A, unsigned long long B) {
   if (A < B) foo();
 }

We now generate:

test:
        subl $4, %esp
        movl %esi, (%esp)
        movl 8(%esp), %eax
        movl 12(%esp), %ecx
        movl 16(%esp), %edx
        movl 20(%esp), %esi
        subl %edx, %eax
        sbbl %esi, %ecx
        jae .LBBtest_2  # UnifiedReturnBlock
.LBBtest_1:     # then
        call foo
        movl (%esp), %esi
        addl $4, %esp
        ret
.LBBtest_2:     # UnifiedReturnBlock
        movl (%esp), %esi
        addl $4, %esp
        ret

Instead of:

test:
        subl $12, %esp
        movl %esi, 8(%esp)
        movl %ebx, 4(%esp)
        movl 16(%esp), %eax
        movl 20(%esp), %ecx
        movl 24(%esp), %edx
        movl 28(%esp), %esi
        cmpl %edx, %eax
        setb %al
        cmpl %esi, %ecx
        setb %bl
        cmove %ax, %bx
        testb %bl, %bl
        je .LBBtest_2   # UnifiedReturnBlock
.LBBtest_1:     # then
        call foo
        movl 4(%esp), %ebx
        movl 8(%esp), %esi
        addl $12, %esp
        ret
.LBBtest_2:     # UnifiedReturnBlock
        movl 4(%esp), %ebx
        movl 8(%esp), %esi
        addl $12, %esp
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18330 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 05:55:24 +00:00
Chris Lattner
90b1b457ef Do not push two return addresses on the stack when we call external functions who have their addresses taken. This fixes test-call.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18134 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 22:25:30 +00:00
Chris Lattner
88f9386cfe There is no reason to emit function stubs for direct calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 03:46:06 +00:00
Chris Lattner
7fc3824835 ignore generated files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18073 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 00:01:54 +00:00
Chris Lattner
e72e445ed5 Remove all JIT specific code and switch the code generator over to emitting
relocations for global references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18068 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:55:15 +00:00
Chris Lattner
7ddde32ead Implement the X86 JIT interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18067 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:54:33 +00:00
Chris Lattner
8dad013038 Describe the X86 target-specific relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:54:19 +00:00
Chris Lattner
89d64e262c We implement these interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18065 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:53:56 +00:00
Chris Lattner
3104db054a Dont' forget to switch back to decimal output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18010 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 20:57:07 +00:00
Chris Lattner
39a83dc37c Fix a major bug in the signed shr code, which apparently only breaks 134.perl!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17902 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 18:40:52 +00:00
Chris Lattner
8f1ac9f90d Remove a dead function, which died when we got GAS emission working (phwew,
hold your nose!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17869 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 04:34:29 +00:00
Chris Lattner
f2d552eca6 Implement a simple FIXME: if we are emitting a basic block address that has
already been emitted, we don't have to remember it and deal with it later,
just emit it directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17868 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 04:30:51 +00:00
Chris Lattner
16fe6f5f24 * Merge some win32 ifdefs together
* Get rid of "emitMaybePCRelativeValue", either we want to emit a PC relative
  value or not: drop the maybe BS.  As it turns out, the only places where
  the bool was a variable coming in, the bool was a dynamic constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17867 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 04:21:18 +00:00
Chris Lattner
5aa3ed92de Add debug-only=jit printout, so we see when lazily resolved symbols are
set up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17862 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 23:16:55 +00:00
Chris Lattner
36c625d3a5 Simplify and rearrange long shift code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17861 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 23:16:34 +00:00
Misha Brukman
d2691fdf18 GhostLinkage should not reach asm printing stage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17750 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 21:03:49 +00:00
Chris Lattner
4b2c09fa22 Don't print unneeded labels
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17714 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 23:27:11 +00:00
Chris Lattner
ce7cafa960 shld is a very high latency operation. Instead of emitting it for shifts of
two or three, open code the equivalent operation which is faster on athlon
and P4 (by a substantial margin).

For example, instead of compiling this:

long long X2(long long Y) { return Y << 2; }

to:

X3_2:
        movl 4(%esp), %eax
        movl 8(%esp), %edx
        shldl $2, %eax, %edx
        shll $2, %eax
        ret

Compile it to:

X2:
        movl 4(%esp), %eax
        movl 8(%esp), %ecx
        movl %eax, %edx
        shrl $30, %edx
        leal (%edx,%ecx,4), %edx
        shll $2, %eax
        ret

Likewise, for << 3, compile to:

X3:
        movl 4(%esp), %eax
        movl 8(%esp), %ecx
        movl %eax, %edx
        shrl $29, %edx
        leal (%edx,%ecx,8), %edx
        shll $3, %eax
        ret

This matches icc, except that icc open codes the shifts as adds on the P4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17707 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 20:48:57 +00:00
Chris Lattner
62f5a9402c Add missing check
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17706 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 20:04:38 +00:00
Chris Lattner
44205cadba Compile:
long long X3_2(long long Y) { return Y+Y; }
int X(int Y) { return Y+Y; }

into:

X3_2:
        movl 4(%esp), %eax
        movl 8(%esp), %edx
        addl %eax, %eax
        adcl %edx, %edx
        ret
X:
        movl 4(%esp), %eax
        addl %eax, %eax
        ret

instead of:

X3_2:
        movl 4(%esp), %eax
        movl 8(%esp), %edx
        shldl $1, %eax, %edx
        shll $1, %eax
        ret

X:
        movl 4(%esp), %eax
        shll $1, %eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17705 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 20:03:48 +00:00
John Criswell
546faca4ef Correct the name of stosd for the AT&T syntax:
It's stosl (l for long == 32 bit).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17658 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-10 04:48:15 +00:00
John Criswell
e5cda8e727 Fix compilation problem; make the cast and the LHS be the same type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17488 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 16:17:06 +00:00
Chris Lattner
141e3fd81d Quiet VC++ warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17484 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 04:50:59 +00:00
Chris Lattner
a62869b064 Fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17431 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-02 15:27:57 +00:00
Chris Lattner
7cc372bfc3 Add placeholder variable to make Win32 work, applied for Morten Ofstad
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17406 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-01 20:10:20 +00:00
Reid Spencer
6cb21d443e Change Library Names Not To Conflict With Others When Installed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17286 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 23:18:45 +00:00
Reid Spencer
8c2c3152d6 Adjust to changes in Makefile.rules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17167 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-22 21:02:08 +00:00
Reid Spencer
cac731ecbe We won't use automake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17155 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-22 03:35:04 +00:00
Reid Spencer
86d341b204 Initial automake generated Makefile template
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17136 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 23:55:41 +00:00
Chris Lattner
7d0974b9a0 Improve compatibility with VC++, patch contributed by Morten Ofstad!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17126 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 15:54:17 +00:00
Chris Lattner
611fb259ba Don't print stuff out from the code generator. This broke the JIT horribly
last night. :)  bork!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17093 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 17:40:50 +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
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
358a9027a8 Instruction select globals with offsets better. For example, on this test
case:

int C[100];
int foo() {
  return C[4];
}

We now codegen:

foo:
        mov %EAX, DWORD PTR [C + 16]
        ret

instead of:

foo:
        mov %EAX, OFFSET C
        mov %EAX, DWORD PTR [%EAX + 16]
        ret

Other impressive features may be coming later.

This patch is contributed by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17011 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 05:05:29 +00:00
Chris Lattner
8cce7cd0ae Give the X86 JIT the ability to encode global+disp constants. Patch
contributed by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17010 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:53:13 +00:00
Chris Lattner
d416f086cc Give the X86 asm printer the ability to print out addressing modes that have
constant displacements from global variables.  Patch by Jeff Cohen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17009 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-15 04:44:53 +00:00