oota-llvm.git
18 years agoMove some methods out of line so that MutexGuard.h isn't needed in a public header.
Chris Lattner [Mon, 8 May 2006 22:00:52 +0000 (22:00 +0000)]
Move some methods out of line so that MutexGuard.h isn't needed in a public header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28179 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove methods out of line so that MutexGuard.h isn't required in the header.
Chris Lattner [Mon, 8 May 2006 22:00:26 +0000 (22:00 +0000)]
Move methods out of line so that MutexGuard.h isn't required in the header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28178 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAnother bad case I noticed
Chris Lattner [Mon, 8 May 2006 21:39:45 +0000 (21:39 +0000)]
Another bad case I noticed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28177 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoadd a note
Chris Lattner [Mon, 8 May 2006 21:24:21 +0000 (21:24 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28176 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake the case I just checked in stronger. Now we compile this:
Chris Lattner [Mon, 8 May 2006 21:18:59 +0000 (21:18 +0000)]
Make the case I just checked in stronger.  Now we compile this:

short test2(short X, short x) {
  int Y = (short)(X+x);
  return Y >> 1;
}

to:

_test2:
        add r2, r3, r4
        extsh r2, r2
        srawi r3, r2, 1
        blr

instead of:

_test2:
        add r2, r3, r4
        extsh r2, r2
        srwi r2, r2, 1
        extsh r3, r2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28175 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement and_sext.ll:test3, generating:
Chris Lattner [Mon, 8 May 2006 20:59:41 +0000 (20:59 +0000)]
Implement and_sext.ll:test3, generating:

_test4:
        srawi r3, r3, 16
        blr

instead of:

_test4:
        srwi r2, r3, 16
        extsh r3, r2
        blr

for:

short test4(unsigned X) {
  return (X >> 16);
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28174 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase
Chris Lattner [Mon, 8 May 2006 20:58:58 +0000 (20:58 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28173 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoYet more readme updating
Nate Begeman [Mon, 8 May 2006 20:54:02 +0000 (20:54 +0000)]
Yet more readme updating

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28172 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoCompile this:
Chris Lattner [Mon, 8 May 2006 20:51:54 +0000 (20:51 +0000)]
Compile this:

short test4(unsigned X) {
  return (X >> 16);
}

to:

_test4:
        movl 4(%esp), %eax
        sarl $16, %eax
        ret

instead of:

_test4:
        movl $-65536, %eax
        andl 4(%esp), %eax
        sarl $16, %eax
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28171 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNew note about something bad happening in target independent optimizers
Nate Begeman [Mon, 8 May 2006 20:08:28 +0000 (20:08 +0000)]
New note about something bad happening in target independent optimizers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28170 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoProving once again that I am not as smart as the compiler
Nate Begeman [Mon, 8 May 2006 19:09:24 +0000 (19:09 +0000)]
Proving once again that I am not as smart as the compiler

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28169 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold more shifts into inserts, and update the README
Nate Begeman [Mon, 8 May 2006 17:38:32 +0000 (17:38 +0000)]
Fold more shifts into inserts, and update the README

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28168 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold shifts with undef operands.
Chris Lattner [Mon, 8 May 2006 17:29:49 +0000 (17:29 +0000)]
Fold shifts with undef operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28167 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoWhen tracking demanded bits, if any bits from the sext of an SRA are demanded,
Chris Lattner [Mon, 8 May 2006 17:22:53 +0000 (17:22 +0000)]
When tracking demanded bits, if any bits from the sext of an SRA are demanded,
then so is the input sign bit.  This fixes mediabench/g721 on X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28166 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake emission of jump tables a bit less conservative; they are now required
Nate Begeman [Mon, 8 May 2006 16:51:36 +0000 (16:51 +0000)]
Make emission of jump tables a bit less conservative; they are now required
to be only 31.25% dense, rather than 75% dense.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28165 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFixing truncate. Previously we were emitting truncate from r16 to r8 as
Evan Cheng [Mon, 8 May 2006 08:01:26 +0000 (08:01 +0000)]
Fixing truncate. Previously we were emitting truncate from r16 to r8 as
movw. That is we promote the destination operand to r16. So
        %CH = TRUNC_R16_R8 %BP
is emitted as
        movw %bp, %cx.

This is incorrect. If %cl is live, it would be clobbered.
Ideally we want to do the opposite, that is emitted it as
        movb ??, %ch
But this is not possible since %bp does not have a r8 sub-register.

We are now defining a new register class R16_ which is a subclass of R16
containing only those 16-bit registers that have r8 sub-registers (i.e.
AX - DX). We isel the truncate to two instructions, a MOV16to16_ to copy the
value to the R16_ class, followed by a TRUNC_R16_R8.

Due to bug 770, the register colaescer is not going to coalesce between R16 and
R16_. That will be fixed later so we can eliminate the MOV16to16_. Right now, it
can only be eliminated if we are lucky that source and destination registers are
the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28164 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove the definition of value_use_iterator::getOperandNo to User.h where the
Chris Lattner [Mon, 8 May 2006 05:59:36 +0000 (05:59 +0000)]
Move the definition of value_use_iterator::getOperandNo to User.h where the
definition of the User class is available, this fixes the  build with some
compiler versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28163 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoUpdate some stuff now that the new rlwimi code has gone in
Nate Begeman [Mon, 8 May 2006 02:52:38 +0000 (02:52 +0000)]
Update some stuff now that the new rlwimi code has gone in

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28162 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix PR772
Nate Begeman [Mon, 8 May 2006 01:35:01 +0000 (01:35 +0000)]
Fix PR772

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28161 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove unncessary include
Nate Begeman [Mon, 8 May 2006 01:33:11 +0000 (01:33 +0000)]
Remove unncessary include

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28160 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThis test passes now, remove xfail marker
Chris Lattner [Sun, 7 May 2006 18:16:31 +0000 (18:16 +0000)]
This test passes now, remove xfail marker

Change test to be a positive test instead of a negative test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28159 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoTypo's
Evan Cheng [Sun, 7 May 2006 10:10:20 +0000 (10:10 +0000)]
Typo's

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28158 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoUnlike Unix, Windows won't let a file be implicitly replaced via renaming without...
Jeff Cohen [Sun, 7 May 2006 02:51:51 +0000 (02:51 +0000)]
Unlike Unix, Windows won't let a file be implicitly replaced via renaming without explicit permission.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28157 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNew rlwimi implementation, which is superior to the old one. There are
Nate Begeman [Sun, 7 May 2006 00:23:38 +0000 (00:23 +0000)]
New rlwimi implementation, which is superior to the old one. There are
still a couple missed optimizations, but we now generate all the possible
rlwimis for multiple inserts into the same bitfield.  More regression tests
to come.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28156 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoUse ComputeMaskedBits to determine # sign bits as a fallback. This allows us
Chris Lattner [Sat, 6 May 2006 23:48:13 +0000 (23:48 +0000)]
Use ComputeMaskedBits to determine # sign bits as a fallback.  This allows us
to handle all kinds of stuff, including silly things like:
sextinreg(setcc,i16) -> setcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28155 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd some more sign propagation cases
Chris Lattner [Sat, 6 May 2006 23:40:29 +0000 (23:40 +0000)]
Add some more sign propagation cases

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28154 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoApply bug fix supplied by Greg Pettyjohn for a bug he found: '<invalid>' is not...
Jeff Cohen [Sat, 6 May 2006 23:25:53 +0000 (23:25 +0000)]
Apply bug fix supplied by Greg Pettyjohn for a bug he found:  '<invalid>' is not a legal path on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28153 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSimplify some code, add a couple minor missed folds
Chris Lattner [Sat, 6 May 2006 23:06:26 +0000 (23:06 +0000)]
Simplify some code, add a couple minor missed folds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28152 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoconstant fold sign_extend_inreg
Chris Lattner [Sat, 6 May 2006 23:05:41 +0000 (23:05 +0000)]
constant fold sign_extend_inreg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28151 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoremove cases handled elsewhere
Chris Lattner [Sat, 6 May 2006 22:43:44 +0000 (22:43 +0000)]
remove cases handled elsewhere

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28150 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd some more simple sign bit propagation cases.
Chris Lattner [Sat, 6 May 2006 22:39:59 +0000 (22:39 +0000)]
Add some more simple sign bit propagation cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28149 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix some loose ends in MASM support.
Jeff Cohen [Sat, 6 May 2006 21:27:14 +0000 (21:27 +0000)]
Fix some loose ends in MASM support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28148 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase we handle right now.
Chris Lattner [Sat, 6 May 2006 18:15:50 +0000 (18:15 +0000)]
new testcase we handle right now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28147 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoUse the new TargetLowering::ComputeNumSignBits method to eliminate
Chris Lattner [Sat, 6 May 2006 09:30:03 +0000 (09:30 +0000)]
Use the new TargetLowering::ComputeNumSignBits method to eliminate
sign_extend_inreg operations.  Though ComputeNumSignBits is still rudimentary,
this is enough to compile this:

short test(short X, short x) {
  int Y = X+x;
  return (Y >> 1);
}
short test2(short X, short x) {
  int Y = (short)(X+x);
  return Y >> 1;
}

into:

_test:
        add r2, r3, r4
        srawi r3, r2, 1
        blr
_test2:
        add r2, r3, r4
        extsh r2, r2
        srawi r3, r2, 1
        blr

instead of:

_test:
        add r2, r3, r4
        srawi r2, r2, 1
        extsh r3, r2
        blr
_test2:
        add r2, r3, r4
        extsh r2, r2
        srawi r2, r2, 1
        extsh r3, r2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28146 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd some really really simple code for computing sign-bit propagation.
Chris Lattner [Sat, 6 May 2006 09:27:13 +0000 (09:27 +0000)]
Add some really really simple code for computing sign-bit propagation.

This will certainly be enhanced in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28145 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd some new methods for computing sign bit information.
Chris Lattner [Sat, 6 May 2006 09:26:22 +0000 (09:26 +0000)]
Add some new methods for computing sign bit information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28144 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoWhen inserting casts, be careful of where we put them. We cannot insert
Chris Lattner [Sat, 6 May 2006 09:10:37 +0000 (09:10 +0000)]
When inserting casts, be careful of where we put them.  We cannot insert
a cast immediately before a PHI node.

This fixes Regression/CodeGen/Generic/2006-05-06-GEP-Cast-Sink-Crash.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28143 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase
Chris Lattner [Sat, 6 May 2006 09:09:47 +0000 (09:09 +0000)]
new testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28142 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove some code around.
Chris Lattner [Sat, 6 May 2006 09:00:16 +0000 (09:00 +0000)]
Move some code around.

Make the "fold (and (cast A), (cast B)) -> (cast (and A, B))" transformation
only apply when both casts really will cause code to be generated.  If one or
both doesn't, then this xform doesn't remove a cast.

This fixes Transforms/InstCombine/2006-05-06-Infloop.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28141 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase from ghostscript that inf looped instcombine
Chris Lattner [Sat, 6 May 2006 08:58:06 +0000 (08:58 +0000)]
new testcase from ghostscript that inf looped instcombine

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28140 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoTeach the X86 backend about non-i32 inline asm register classes.
Chris Lattner [Sat, 6 May 2006 00:29:37 +0000 (00:29 +0000)]
Teach the X86 backend about non-i32 inline asm register classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28139 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold (trunc (srl x, c)) -> (srl (trunc x), c)
Chris Lattner [Sat, 6 May 2006 00:11:52 +0000 (00:11 +0000)]
Fold (trunc (srl x, c)) -> (srl (trunc x), c)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28138 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold trunc(any_ext). This gives stuff like:
Chris Lattner [Fri, 5 May 2006 22:56:26 +0000 (22:56 +0000)]
Fold trunc(any_ext).  This gives stuff like:

27,28c27
<       movzwl %di, %edi
<       movl %edi, %ebx
---
>       movw %di, %bx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28137 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoShrink shifts when possible.
Chris Lattner [Fri, 5 May 2006 22:53:17 +0000 (22:53 +0000)]
Shrink shifts when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28136 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement ComputeMaskedBits/SimplifyDemandedBits for ISD::TRUNCATE
Chris Lattner [Fri, 5 May 2006 22:32:12 +0000 (22:32 +0000)]
Implement ComputeMaskedBits/SimplifyDemandedBits for ISD::TRUNCATE

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28135 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoPrint a grouping around inline asm blocks so that we can tell when we are
Chris Lattner [Fri, 5 May 2006 21:50:04 +0000 (21:50 +0000)]
Print a grouping around inline asm blocks so that we can tell when we are
using them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28134 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoPrint *some* grouping around inline asm blocks so we know where they are.
Chris Lattner [Fri, 5 May 2006 21:48:50 +0000 (21:48 +0000)]
Print *some* grouping around inline asm blocks so we know where they are.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28133 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoIndent multiline asm strings more nicely
Chris Lattner [Fri, 5 May 2006 21:47:05 +0000 (21:47 +0000)]
Indent multiline asm strings more nicely

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28132 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoTeach the code generator to use cvtss2sd as extload f32 -> f64
Chris Lattner [Fri, 5 May 2006 21:35:18 +0000 (21:35 +0000)]
Teach the code generator to use cvtss2sd as extload f32 -> f64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28131 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold (fpext (load x)) -> (extload x)
Chris Lattner [Fri, 5 May 2006 21:34:35 +0000 (21:34 +0000)]
Fold (fpext (load x)) -> (extload x)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28130 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMore aggressively sink GEP offsets into loops. For example, before we
Chris Lattner [Fri, 5 May 2006 21:17:49 +0000 (21:17 +0000)]
More aggressively sink GEP offsets into loops.  For example, before we
generated:

        movl 8(%esp), %eax
        movl %eax, %edx
        addl $4316, %edx
        cmpb $1, %cl
        ja LBB1_2       #cond_false
LBB1_1: #cond_true
        movl L_QuantizationTables720$non_lazy_ptr, %ecx
        movl %ecx, (%edx)
        movl L_QNOtoQuantTableShift720$non_lazy_ptr, %edx
        movl %edx, 4460(%eax)
        ret
...

Now we generate:

        movl 8(%esp), %eax
        cmpb $1, %cl
        ja LBB1_2       #cond_false
LBB1_1: #cond_true
        movl L_QuantizationTables720$non_lazy_ptr, %ecx
        movl %ecx, 4316(%eax)
        movl L_QNOtoQuantTableShift720$non_lazy_ptr, %ecx
        movl %ecx, 4460(%eax)
        ret

... which uses one fewer register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28129 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix an infinite loop compiling oggenc last night.
Chris Lattner [Fri, 5 May 2006 20:51:30 +0000 (20:51 +0000)]
Fix an infinite loop compiling oggenc last night.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28128 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNeed extload patterns after Chris' DAG combiner changes
Evan Cheng [Fri, 5 May 2006 08:23:07 +0000 (08:23 +0000)]
Need extload patterns after Chris' DAG combiner changes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28127 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement InstCombine/cast.ll:test29
Chris Lattner [Fri, 5 May 2006 06:39:07 +0000 (06:39 +0000)]
Implement InstCombine/cast.ll:test29

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28126 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNew testcase
Chris Lattner [Fri, 5 May 2006 06:38:40 +0000 (06:38 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28125 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFold some common code.
Chris Lattner [Fri, 5 May 2006 06:32:04 +0000 (06:32 +0000)]
Fold some common code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28124 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement:
Chris Lattner [Fri, 5 May 2006 06:31:05 +0000 (06:31 +0000)]
Implement:

  // fold (and (sext x), (sext y)) -> (sext (and x, y))
  // fold (or  (sext x), (sext y)) -> (sext (or  x, y))
  // fold (xor (sext x), (sext y)) -> (sext (xor x, y))
  // fold (and (aext x), (aext y)) -> (aext (and x, y))
  // fold (or  (aext x), (aext y)) -> (aext (or  x, y))
  // fold (xor (aext x), (aext y)) -> (aext (xor x, y))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28123 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoPull and through and/or/xor. This compiles some bitfield code to:
Chris Lattner [Fri, 5 May 2006 06:10:43 +0000 (06:10 +0000)]
Pull and through and/or/xor.  This compiles some bitfield code to:

        mov EAX, DWORD PTR [ESP + 4]
        mov ECX, DWORD PTR [EAX]
        mov EDX, ECX
        add EDX, EDX
        or EDX, ECX
        and EDX, -2147483648
        and ECX, 2147483647
        or EDX, ECX
        mov DWORD PTR [EAX], EDX
        ret

instead of:

        sub ESP, 4
        mov DWORD PTR [ESP], ESI
        mov EAX, DWORD PTR [ESP + 8]
        mov ECX, DWORD PTR [EAX]
        mov EDX, ECX
        add EDX, EDX
        mov ESI, ECX
        and ESI, -2147483648
        and EDX, -2147483648
        or EDX, ESI
        and ECX, 2147483647
        or EDX, ECX
        mov DWORD PTR [EAX], EDX
        mov ESI, DWORD PTR [ESP]
        add ESP, 4
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28122 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoImplement a variety of simplifications for ANY_EXTEND.
Chris Lattner [Fri, 5 May 2006 05:58:59 +0000 (05:58 +0000)]
Implement a variety of simplifications for ANY_EXTEND.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28121 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFactor some code, add these transformations:
Chris Lattner [Fri, 5 May 2006 05:51:50 +0000 (05:51 +0000)]
Factor some code, add these transformations:

  // fold (and (trunc x), (trunc y)) -> (trunc (and x, y))
  // fold (or  (trunc x), (trunc y)) -> (trunc (or  x, y))
  // fold (xor (trunc x), (trunc y)) -> (trunc (xor x, y))

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28120 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoBetter implementation of truncate. ISel matches it to a pseudo instruction
Evan Cheng [Fri, 5 May 2006 05:40:20 +0000 (05:40 +0000)]
Better implementation of truncate. ISel matches it to a pseudo instruction
that gets emitted as movl (for r32 to i16, i8) or a movw (for r16 to i8). And
if the destination gets allocated a subregister of the source operand, then
the instruction will not be emitted at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28119 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoNew note, Nate, please check to see if I'm full of it :)
Chris Lattner [Fri, 5 May 2006 05:36:15 +0000 (05:36 +0000)]
New note, Nate, please check to see if I'm full of it :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28118 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix VC++ compilation error.
Jeff Cohen [Fri, 5 May 2006 01:47:05 +0000 (01:47 +0000)]
Fix VC++ compilation error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28117 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSomehow, I missed this part of the checkin a couple days ago
Nate Begeman [Fri, 5 May 2006 01:13:11 +0000 (01:13 +0000)]
Somehow, I missed this part of the checkin a couple days ago

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28116 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSink noop copies into the basic block that uses them. This reduces the number
Chris Lattner [Fri, 5 May 2006 01:04:50 +0000 (01:04 +0000)]
Sink noop copies into the basic block that uses them.  This reduces the number
of cross-block live ranges, and allows the bb-at-a-time selector to always
coallesce these away, at isel time.

This reduces the load on the coallescer and register allocator.  For example
on a codec on X86, we went from:

   1643 asm-printer           - Number of machine instrs printed
    419 liveintervals         - Number of loads/stores folded into instructions
   1144 liveintervals         - Number of identity moves eliminated after coalescing
   1022 liveintervals         - Number of interval joins performed
    282 liveintervals         - Number of intervals after coalescing
   1304 liveintervals         - Number of original intervals
     86 regalloc              - Number of times we had to backtrack
1.90232 regalloc              - Ratio of intervals processed over total intervals
     40 spiller               - Number of values reused
    182 spiller               - Number of loads added
    121 spiller               - Number of stores added
    132 spiller               - Number of register spills
      6 twoaddressinstruction - Number of instructions commuted to coalesce
    360 twoaddressinstruction - Number of two-address instructions

to:

   1636 asm-printer           - Number of machine instrs printed
    403 liveintervals         - Number of loads/stores folded into instructions
   1155 liveintervals         - Number of identity moves eliminated after coalescing
   1033 liveintervals         - Number of interval joins performed
    279 liveintervals         - Number of intervals after coalescing
   1312 liveintervals         - Number of original intervals
     76 regalloc              - Number of times we had to backtrack
1.88998 regalloc              - Ratio of intervals processed over total intervals
      1 spiller               - Number of copies elided
     41 spiller               - Number of values reused
    191 spiller               - Number of loads added
    114 spiller               - Number of stores added
    128 spiller               - Number of register spills
      4 twoaddressinstruction - Number of instructions commuted to coalesce
    356 twoaddressinstruction - Number of two-address instructions

On this testcase, this change provides a modest reduction in spill code,
regalloc iterations, and total instructions emitted.  It increases the number
of register coallesces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28115 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdd a helper method.
Chris Lattner [Fri, 5 May 2006 00:51:42 +0000 (00:51 +0000)]
Add a helper method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28114 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agowrap long line
Chris Lattner [Thu, 4 May 2006 23:35:31 +0000 (23:35 +0000)]
wrap long line

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28113 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAdjust to use proper TargetData copy ctor
Chris Lattner [Thu, 4 May 2006 21:18:40 +0000 (21:18 +0000)]
Adjust to use proper TargetData copy ctor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28112 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix this to be a proper copy ctor
Chris Lattner [Thu, 4 May 2006 21:17:35 +0000 (21:17 +0000)]
Fix this to be a proper copy ctor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28111 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFinal pass of minor cleanups for MachineInstr
Chris Lattner [Thu, 4 May 2006 19:36:09 +0000 (19:36 +0000)]
Final pass of minor cleanups for MachineInstr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28110 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoInitial support for register pressure aware scheduling. The register reduction
Evan Cheng [Thu, 4 May 2006 19:16:39 +0000 (19:16 +0000)]
Initial support for register pressure aware scheduling. The register reduction
scheduler can go into a "vertical mode" (i.e. traversing up the two-address
chain, etc.) when the register pressure is low.
This does seem to reduce the number of spills in the cases I've looked at. But
with x86, it's no guarantee the performance of the code improves.
It can be turned on with -sched-vertically option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28108 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove redundancy and a level of indirection when creating machine operands
Chris Lattner [Thu, 4 May 2006 19:14:44 +0000 (19:14 +0000)]
Remove redundancy and a level of indirection when creating machine operands

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28107 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove register numbers out of "extra" into "contents". Other minor cleanup.
Chris Lattner [Thu, 4 May 2006 18:25:20 +0000 (18:25 +0000)]
Move register numbers out of "extra" into "contents".  Other minor cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28106 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove and simplify some more machineinstr/machineoperand stuff.
Chris Lattner [Thu, 4 May 2006 18:16:01 +0000 (18:16 +0000)]
Remove and simplify some more machineinstr/machineoperand stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28105 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRename MO_VirtualRegister -> MO_Register. Clean up immediate handling.
Chris Lattner [Thu, 4 May 2006 18:05:43 +0000 (18:05 +0000)]
Rename MO_VirtualRegister -> MO_Register.  Clean up immediate handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28104 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoremove hasAllocatedReg
Chris Lattner [Thu, 4 May 2006 17:56:20 +0000 (17:56 +0000)]
remove hasAllocatedReg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28103 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMove some methods out of MachineInstr into MachineOperand
Chris Lattner [Thu, 4 May 2006 17:52:23 +0000 (17:52 +0000)]
Move some methods out of MachineInstr into MachineOperand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28102 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll
Chris Lattner [Thu, 4 May 2006 17:33:35 +0000 (17:33 +0000)]
Fix Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28101 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agonew testcase that crashes the instcombine pass
Chris Lattner [Thu, 4 May 2006 17:33:24 +0000 (17:33 +0000)]
new testcase that crashes the instcombine pass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28100 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoThere shalt be only one "immediate" operand type!
Chris Lattner [Thu, 4 May 2006 17:21:20 +0000 (17:21 +0000)]
There shalt be only one "immediate" operand type!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28099 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoChange "value" in MachineOperand to be a GlobalValue, as that is the only
Chris Lattner [Thu, 4 May 2006 17:02:51 +0000 (17:02 +0000)]
Change "value" in MachineOperand to be a GlobalValue, as that is the only
thing that can be in it.  Remove a dead method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28098 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRevert Nate's CR patch from last night, which caused many regressions (e.g. fhourstones).
Chris Lattner [Thu, 4 May 2006 16:56:45 +0000 (16:56 +0000)]
Revert Nate's CR patch from last night, which caused many regressions (e.g. fhourstones).

Loading and storing off R0 isn't what we wanted.  Also, taking some CR's out of
CRRC seems to cause failures as well.  Further investigation is required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28097 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake external globals public; other minor cleanup.
Jeff Cohen [Thu, 4 May 2006 16:20:22 +0000 (16:20 +0000)]
Make external globals public; other minor cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28096 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoMake Intel syntax the default when LLVM is built with VC++.
Jeff Cohen [Thu, 4 May 2006 16:19:27 +0000 (16:19 +0000)]
Make Intel syntax the default when LLVM is built with VC++.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28095 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove a bunch more dead V9 specific stuff
Chris Lattner [Thu, 4 May 2006 01:26:39 +0000 (01:26 +0000)]
Remove a bunch more dead V9 specific stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28094 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove a bunch more SparcV9 specific stuff
Chris Lattner [Thu, 4 May 2006 01:15:02 +0000 (01:15 +0000)]
Remove a bunch more SparcV9 specific stuff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28093 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove some more V9-specific stuff.
Chris Lattner [Thu, 4 May 2006 00:49:59 +0000 (00:49 +0000)]
Remove some more V9-specific stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28092 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoRemove some more unused stuff from MachineInstr that was leftover from V9.
Chris Lattner [Thu, 4 May 2006 00:44:25 +0000 (00:44 +0000)]
Remove some more unused stuff from MachineInstr that was leftover from V9.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28091 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSimplify handling of relocations
Chris Lattner [Thu, 4 May 2006 00:42:08 +0000 (00:42 +0000)]
Simplify handling of relocations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28090 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoUse movsd to shuffle in the lowest two elements of a v4f32 / v4i32 vector when
Evan Cheng [Wed, 3 May 2006 20:32:03 +0000 (20:32 +0000)]
Use movsd to shuffle in the lowest two elements of a v4f32 / v4i32 vector when
movlps cannot be used (e.g. when load from m64 has multiple uses).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28089 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoChange from using MachineRelocation ctors to using static methods
Chris Lattner [Wed, 3 May 2006 20:30:20 +0000 (20:30 +0000)]
Change from using MachineRelocation ctors to using static methods
in MachineRelocation to create Relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28088 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agominor cleanups, no functionality change
Chris Lattner [Wed, 3 May 2006 18:55:56 +0000 (18:55 +0000)]
minor cleanups, no functionality change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28087 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoCleanup the internal implementation of MachineRelocation. No interface or
Chris Lattner [Wed, 3 May 2006 18:52:31 +0000 (18:52 +0000)]
Cleanup the internal implementation of MachineRelocation.  No interface or
functionality changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28086 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoAttempt to get this script working on Darwin.
Reid Spencer [Wed, 3 May 2006 18:16:01 +0000 (18:16 +0000)]
Attempt to get this script working on Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28085 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFor PR764:
Reid Spencer [Wed, 3 May 2006 17:49:50 +0000 (17:49 +0000)]
For PR764:
Don't check in the LibDeps.txt and FinalLibDeps.txt files to CVS because
the content differs from platform to platform. Instead, adjust the makefile
so that a dummy llvm-config is built if Perl is not available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28084 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoinline a simple method
Chris Lattner [Wed, 3 May 2006 17:21:32 +0000 (17:21 +0000)]
inline a simple method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28083 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoSuck block address tracking out of targets into the JIT Emitter. This
Chris Lattner [Wed, 3 May 2006 17:10:41 +0000 (17:10 +0000)]
Suck block address tracking out of targets into the JIT Emitter.  This
simplifies the MachineCodeEmitter interface just a little bit and makes
BasicBlocks work like constant pools and jump tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28082 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFix a bug in Owen's checkin that broke the CBE on all non sparc v9 platforms.
Chris Lattner [Wed, 3 May 2006 05:48:41 +0000 (05:48 +0000)]
Fix a bug in Owen's checkin that broke the CBE on all non sparc v9 platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28081 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoTeach the x86 jit how to handle jump tables not directly used by a jump
Nate Begeman [Wed, 3 May 2006 04:52:47 +0000 (04:52 +0000)]
Teach the x86 jit how to handle jump tables not directly used by a jump
instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28080 91177308-0d34-0410-b5e6-96231b3b80d8

18 years agoFinish up the initial jump table implementation by allowing jump tables to
Nate Begeman [Wed, 3 May 2006 03:48:02 +0000 (03:48 +0000)]
Finish up the initial jump table implementation by allowing jump tables to
not be 100% dense.  Increase the minimum threshold for the number of cases
in a switch statement from 4 to 6 in order to create a jump table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28079 91177308-0d34-0410-b5e6-96231b3b80d8