oota-llvm.git
18 years agoFold (zext (load x) to (zextload x).
Evan Cheng [Wed, 14 Dec 2005 02:19:23 +0000 (02:19 +0000)]
Fold (zext (load x) to (zextload x).

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

18 years agoAdd support for fmul node of type v4f32.
Nate Begeman [Wed, 14 Dec 2005 00:34:09 +0000 (00:34 +0000)]
Add support for fmul node of type v4f32.

void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = mul <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

Is selected to:

_foo:
        li r2, 0
        lvx v0, r2, r3
        vxor v1, v1, v1
        vmaddfp v0, v0, v0, v1
        stvx v0, r2, r3
        blr

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

18 years agoPrepare support for AltiVec multiply, divide, and sqrt.
Nate Begeman [Tue, 13 Dec 2005 22:55:22 +0000 (22:55 +0000)]
Prepare support for AltiVec multiply, divide, and sqrt.

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

18 years agoAdjust the constructor to the Linker class to take an argument that names
Reid Spencer [Tue, 13 Dec 2005 20:00:37 +0000 (20:00 +0000)]
Adjust the constructor to the Linker class to take an argument that names
the module being constructed. This is used to correctly name the module.
Previously the name of the linker tool was used which produces confusing
output when the module identifier is used in an error message.

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

18 years agoImprove ResolveFunctions to:
Reid Spencer [Tue, 13 Dec 2005 19:56:51 +0000 (19:56 +0000)]
Improve ResolveFunctions to:
a) use better local variable names (OldMT -> OldFT) where "M" is used to
   mean "Function" (perhaps it was previously "Method"?)
b) print out the module identifier in a warning message so that it is
   possible to track down in which module the error occurred.

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

18 years agoDon't lump the filename and working dir together
Chris Lattner [Tue, 13 Dec 2005 17:40:33 +0000 (17:40 +0000)]
Don't lump the filename and working dir together

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

18 years agoAdd load + store folding srl and sra patterns.
Evan Cheng [Tue, 13 Dec 2005 07:24:22 +0000 (07:24 +0000)]
Add load + store folding srl and sra patterns.

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

18 years agoUse the shared asmprinter code for printing special llvm globals
Chris Lattner [Tue, 13 Dec 2005 06:32:50 +0000 (06:32 +0000)]
Use the shared asmprinter code for printing special llvm globals

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

18 years agoAdd a couple more fields, move ctor init list to .cpp file, add support
Chris Lattner [Tue, 13 Dec 2005 06:32:10 +0000 (06:32 +0000)]
Add a couple more fields, move ctor init list to .cpp file, add support
for emitting the ctor/dtor list for common targets.

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

18 years agoAdd ELF and darwin support for static ctors and dtors
Chris Lattner [Tue, 13 Dec 2005 04:53:51 +0000 (04:53 +0000)]
Add ELF and darwin support for static ctors and dtors

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

18 years agoreindent a loop, unswitch a loop. No functionality changes
Chris Lattner [Tue, 13 Dec 2005 04:33:58 +0000 (04:33 +0000)]
reindent a loop, unswitch a loop.  No functionality changes

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

18 years agoLowering constant pool entries on ppc exposed a bug in the recently added
Nate Begeman [Tue, 13 Dec 2005 03:03:23 +0000 (03:03 +0000)]
Lowering constant pool entries on ppc exposed a bug in the recently added
ConstantVec legalizing code, which would return constantpool nodes that
were not of the target's pointer type.

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

18 years agoBeautify a few patterns.
Evan Cheng [Tue, 13 Dec 2005 02:40:18 +0000 (02:40 +0000)]
Beautify a few patterns.

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

18 years agoSome shl patterns which do load + store folding.
Evan Cheng [Tue, 13 Dec 2005 02:34:51 +0000 (02:34 +0000)]
Some shl patterns which do load + store folding.

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

18 years agoA few helper fragments for loads. e.g. (i8 (load addr:$src)) -> (loadi8 addr:$src...
Evan Cheng [Tue, 13 Dec 2005 01:57:51 +0000 (01:57 +0000)]
A few helper fragments for loads. e.g. (i8 (load addr:$src)) -> (loadi8 addr:$src). Only to improve readibility.

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

18 years agoAdd and, or, and xor patterns which fold load + stores.
Evan Cheng [Tue, 13 Dec 2005 01:41:36 +0000 (01:41 +0000)]
Add and, or, and xor patterns which fold load + stores.

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

18 years agoAdd inc + dec patterns which fold load + stores.
Evan Cheng [Tue, 13 Dec 2005 01:02:47 +0000 (01:02 +0000)]
Add inc + dec patterns which fold load + stores.

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

18 years agoAdd neg and not patterns which fold load + stores.
Evan Cheng [Tue, 13 Dec 2005 00:54:44 +0000 (00:54 +0000)]
Add neg and not patterns which fold load + stores.

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

18 years agoMissed a couple redundant explicit type casts.
Evan Cheng [Tue, 13 Dec 2005 00:25:07 +0000 (00:25 +0000)]
Missed a couple redundant explicit type casts.

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

18 years agoFix some bad choice of names: i16SExt8 ->i16immSExt8, etc.
Evan Cheng [Tue, 13 Dec 2005 00:14:11 +0000 (00:14 +0000)]
Fix some bad choice of names: i16SExt8 ->i16immSExt8, etc.

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

18 years ago* Split immSExt8 to i16SExt8 and i32SExt8 for i16 and i32 immediate operands.
Evan Cheng [Tue, 13 Dec 2005 00:01:09 +0000 (00:01 +0000)]
* Split immSExt8 to i16SExt8 and i32SExt8 for i16 and i32 immediate operands.
  This enables the removal of some explicit type casts.
* Rename immZExt8 to i16ZExt8 as well.

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

18 years agoAdd some integer mul patterns.
Evan Cheng [Mon, 12 Dec 2005 23:47:46 +0000 (23:47 +0000)]
Add some integer mul patterns.

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

18 years agoBug fix: CodeGenMap[N] = ... -> CodeGenMap[N.getValue(0)] = ...
Evan Cheng [Mon, 12 Dec 2005 23:45:21 +0000 (23:45 +0000)]
Bug fix: CodeGenMap[N] = ... -> CodeGenMap[N.getValue(0)] = ...

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

18 years agoAt top of generated isel SelectCode() is this:
Evan Cheng [Mon, 12 Dec 2005 23:22:48 +0000 (23:22 +0000)]
At top of generated isel SelectCode() is this:

  if (!N.Val->hasOneUse()) {
    std::map<SDOperand, SDOperand>::iterator CGMI = CodeGenMap.find(N);
    if (CGMI != CodeGenMap.end()) return CGMI->second;
  }

Suppose a DAG like this:

           X
         ^   ^
        /     \
      USE1    USE2

Suppose USE1 is being selected first and during which X is selected and
returned a new node. After this, USE1 is no longer an use of X. During USE2
selection, X will be selected again since it has only one use!

The fix is to always query CodeGenMap.

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

18 years agoAccept and ignore prefetches for now
Chris Lattner [Mon, 12 Dec 2005 22:51:16 +0000 (22:51 +0000)]
Accept and ignore prefetches for now

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

18 years agoFix CodeGen/Generic/2005-12-12-ExpandSextInreg.ll
Chris Lattner [Mon, 12 Dec 2005 22:27:43 +0000 (22:27 +0000)]
Fix CodeGen/Generic/2005-12-12-ExpandSextInreg.ll

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

18 years agoTestcase for a problem that reid ran into
Chris Lattner [Mon, 12 Dec 2005 22:27:22 +0000 (22:27 +0000)]
Testcase for a problem that reid ran into

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

18 years agoAdd some sub patterns.
Evan Cheng [Mon, 12 Dec 2005 21:54:05 +0000 (21:54 +0000)]
Add some sub patterns.

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

18 years agoWhen SelectLEAAddr() fails, it shouldn't cause the side effect of having the
Evan Cheng [Mon, 12 Dec 2005 21:49:40 +0000 (21:49 +0000)]
When SelectLEAAddr() fails, it shouldn't cause the side effect of having the
base or index operands being selected.

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

18 years agoFor ISD::RET, if # of operands >= 2, try selection the real data dep. operand
Evan Cheng [Mon, 12 Dec 2005 20:32:18 +0000 (20:32 +0000)]
For ISD::RET, if # of operands >= 2, try selection the real data dep. operand
first before the chain.
e.g.
int X;

int foo(int x)
{
  x += X + 37;
  return x;
}

If chain operand is selected first, we would generate:
movl X, %eax
movl 4(%esp), %ecx
leal 37(%ecx,%eax), %eax

rather than
movl $37, %eax
addl 4(%esp), %eax
addl X, %eax

which does not require %ecx. (Due to ADD32rm not matching.)

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

18 years agofix FP selects
Andrew Lenharth [Mon, 12 Dec 2005 20:30:09 +0000 (20:30 +0000)]
fix FP selects

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

18 years agoremove some never-completed and now-obsolete code.
Chris Lattner [Mon, 12 Dec 2005 20:12:20 +0000 (20:12 +0000)]
remove some never-completed and now-obsolete code.

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

18 years agoAdd a few more add / store patterns. e.g. ADD32mi8.
Evan Cheng [Mon, 12 Dec 2005 19:45:23 +0000 (19:45 +0000)]
Add a few more add / store patterns. e.g. ADD32mi8.

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

18 years agoBug fix: finding the correct incoming chain for pattern with nested src operand....
Evan Cheng [Mon, 12 Dec 2005 19:37:43 +0000 (19:37 +0000)]
Bug fix: finding the correct incoming chain for pattern with nested src operand. And a minor change to make output code slightly more readible.

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

18 years agorestore a more restricted select
Andrew Lenharth [Mon, 12 Dec 2005 17:43:52 +0000 (17:43 +0000)]
restore a more restricted select

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

18 years agoImplement a little hack for parity with GCC on crafty. This speeds up
Chris Lattner [Mon, 12 Dec 2005 07:19:13 +0000 (07:19 +0000)]
Implement a little hack for parity with GCC on crafty.  This speeds up
186.crafty by about 16% (from 15.109s to 13.045s) on my system.

This turns allocas with unions/casts into scalars.  For example crafty has
something like this:

    union doub {
      unsigned short i[4];
      long long d;
    };
int f(long long a) {
  return ((union doub){.d=a}).i[1];
}

Instead of generating loads and stores to an alloca, we now promote the
whole thing to a scalar long value.

This implements: Transforms/ScalarRepl/AggregatePromote.ll

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

18 years agonew testcase: sra should be able to eliminate all of these alloca's, despite
Chris Lattner [Mon, 12 Dec 2005 07:18:59 +0000 (07:18 +0000)]
new testcase: sra should be able to eliminate all of these alloca's, despite
the presense of pointer casts

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

18 years agoSend an indicator to llvm-testresults if the build failed
Chris Lattner [Sun, 11 Dec 2005 19:55:39 +0000 (19:55 +0000)]
Send an indicator to llvm-testresults if the build failed

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

18 years agoFix typo :(
Chris Lattner [Sun, 11 Dec 2005 18:43:13 +0000 (18:43 +0000)]
Fix typo :(

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

18 years agoMinor tweak to get isel opt
Chris Lattner [Sun, 11 Dec 2005 09:05:13 +0000 (09:05 +0000)]
Minor tweak to get isel opt

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

18 years agoadd selectcc
Chris Lattner [Sun, 11 Dec 2005 08:35:54 +0000 (08:35 +0000)]
add selectcc

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

18 years agoRemove type casts that are no longer needed
Chris Lattner [Sun, 11 Dec 2005 07:45:47 +0000 (07:45 +0000)]
Remove type casts that are no longer needed

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

18 years agoRealize the constant pool & global addrs must always be ptr type
Chris Lattner [Sun, 11 Dec 2005 07:45:04 +0000 (07:45 +0000)]
Realize the constant pool & global addrs must always be ptr type

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

18 years agoFix the JIT failures from last night.
Chris Lattner [Sun, 11 Dec 2005 07:37:41 +0000 (07:37 +0000)]
Fix the JIT failures from last night.

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

18 years agoFP select improvements (and likely breakage), oh and crazy people might want to ...
Andrew Lenharth [Sun, 11 Dec 2005 03:54:31 +0000 (03:54 +0000)]
FP select improvements (and likely breakage), oh and crazy people might want to *return* floating point values.  Don't see why myself

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

18 years agoAdd support for TargetConstantPool nodes to the dag isel emitter, and use
Nate Begeman [Sat, 10 Dec 2005 02:36:00 +0000 (02:36 +0000)]
Add support for TargetConstantPool nodes to the dag isel emitter, and use
them in the PPC backend, to simplify some logic out of Select and
SelectAddr.

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

18 years agoUse SDTCisPtrTy type property for store address.
Evan Cheng [Sat, 10 Dec 2005 01:59:36 +0000 (01:59 +0000)]
Use SDTCisPtrTy type property for store address.

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

18 years agoStop emitting a redudant type check for complex pattern node.
Evan Cheng [Sat, 10 Dec 2005 01:57:33 +0000 (01:57 +0000)]
Stop emitting a redudant type check for complex pattern node.

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

18 years ago* Added X86 store patterns.
Evan Cheng [Sat, 10 Dec 2005 00:48:20 +0000 (00:48 +0000)]
* Added X86 store patterns.
* Added X86 dec patterns.

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

18 years agoAdded new getNode and getTargetNode variants for X86 stores.
Evan Cheng [Sat, 10 Dec 2005 00:37:58 +0000 (00:37 +0000)]
Added new getNode and getTargetNode variants for X86 stores.

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

18 years agoFor instructions which produce no result, e.g. store, chain's Resno == 0.
Evan Cheng [Sat, 10 Dec 2005 00:09:17 +0000 (00:09 +0000)]
For instructions which produce no result, e.g. store, chain's Resno == 0.

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

18 years agoAdd support patterns to many load and store instructions which will
Nate Begeman [Fri, 9 Dec 2005 23:54:18 +0000 (23:54 +0000)]
Add support patterns to many load and store instructions which will
hopefully use patterns in the near future.

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

18 years agoAdd SDTCisPtrTy and use it for loads, to indicate that the operand of a load
Chris Lattner [Fri, 9 Dec 2005 22:58:42 +0000 (22:58 +0000)]
Add SDTCisPtrTy and use it for loads, to indicate that the operand of a load
must be a pointer.  This removes a type check out of the code generated by
tblgen for load matching.

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

18 years agoAdd a new SDTCisPtrTy constraint, which indicates that an operand must have
Chris Lattner [Fri, 9 Dec 2005 22:57:42 +0000 (22:57 +0000)]
Add a new SDTCisPtrTy constraint, which indicates that an operand must have
the same type as the pointer type for a target.

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

18 years agoAdded patterns for ADD8rm, etc. These fold load operands. e.g. addb 4(%esp), %al
Evan Cheng [Fri, 9 Dec 2005 22:48:48 +0000 (22:48 +0000)]
Added patterns for ADD8rm, etc. These fold load operands. e.g. addb 4(%esp), %al

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

18 years ago* Do not allow nodes which produce chain results (e.g. loads) to be folded if
Evan Cheng [Fri, 9 Dec 2005 22:45:35 +0000 (22:45 +0000)]
* Do not allow nodes which produce chain results (e.g. loads) to be folded if
  it has more than one real use (non-chain uses).
* Record folded chain producing node in CodeGenMap.
* Do not fold a chain producing node if it has already been selected as an
  operand of a chain use.

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

18 years agoAvoid emitting two tabs when switching to a named section
Chris Lattner [Fri, 9 Dec 2005 19:28:49 +0000 (19:28 +0000)]
Avoid emitting two tabs when switching to a named section

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

18 years agoTeach the PPC backend about the ctor and dtor list when not using __main and
Chris Lattner [Fri, 9 Dec 2005 18:24:29 +0000 (18:24 +0000)]
Teach the PPC backend about the ctor and dtor list when not using __main and
linking the entire program into one bc file.

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

18 years agoTeach legalize how to promote sext_inreg to fix a problem Andrew pointed
Chris Lattner [Fri, 9 Dec 2005 17:32:47 +0000 (17:32 +0000)]
Teach legalize how to promote sext_inreg to fix a problem Andrew pointed
out to me.

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

18 years agoPrevent folding of instructions which produce chains that have more than 1 real use
Evan Cheng [Fri, 9 Dec 2005 06:06:08 +0000 (06:06 +0000)]
Prevent folding of instructions which produce chains that have more than 1 real use

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

18 years ago* Make sure complex pattern operands are selected first since their select
Evan Cheng [Fri, 9 Dec 2005 00:48:42 +0000 (00:48 +0000)]
* Make sure complex pattern operands are selected first since their select
functions can return false and causing the instruction pattern match to fail.
* Code clean up.

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

18 years agoit helps if your conditionals are not reversed
Andrew Lenharth [Fri, 9 Dec 2005 00:45:42 +0000 (00:45 +0000)]
it helps if your conditionals are not reversed

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

18 years agoimprove code insertion in two ways:
Chris Lattner [Thu, 8 Dec 2005 08:00:12 +0000 (08:00 +0000)]
improve code insertion in two ways:
1. Only forward subst offsets into loads and stores, not into arbitrary
   things, where it will likely become a load.
2. If the source is a cast from pointer, forward subst the cast as well,
   allowing us to fold the cast away (improving cases when the cast is
   from an alloca or global).

This hasn't been fully tested, but does appear to further reduce register
pressure and improve code.  Lets let the testers grind on it a bit. :)

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

18 years agoAdd another important case we miss
Chris Lattner [Thu, 8 Dec 2005 07:13:28 +0000 (07:13 +0000)]
Add another important case we miss

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

18 years agoAdded support for ComplexPattern.
Evan Cheng [Thu, 8 Dec 2005 04:28:48 +0000 (04:28 +0000)]
Added support for ComplexPattern.

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

18 years agoAdded explicit type field to ComplexPattern.
Evan Cheng [Thu, 8 Dec 2005 02:15:07 +0000 (02:15 +0000)]
Added explicit type field to ComplexPattern.

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

18 years ago* Added an explicit type field to ComplexPattern.
Evan Cheng [Thu, 8 Dec 2005 02:14:08 +0000 (02:14 +0000)]
* Added an explicit type field to ComplexPattern.
* Renamed MatchingNodes to RootNodes.

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

18 years ago* Added intelligence to X86 LEA addressing mode matching routine so it returns
Evan Cheng [Thu, 8 Dec 2005 02:01:35 +0000 (02:01 +0000)]
* Added intelligence to X86 LEA addressing mode matching routine so it returns
false if the match is not profitable. e.g. leal 1(%eax), %eax.
* Added patterns for X86 integer loads and LEA32.

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

18 years agoAdded support for ComplexPattern. These are patterns that require C++ pattern
Evan Cheng [Thu, 8 Dec 2005 02:00:36 +0000 (02:00 +0000)]
Added support for ComplexPattern. These are patterns that require C++ pattern
matching code that is not currently auto-generated by tblgen, e.g. X86
addressing mode. Selection routines for complex patterns can return multiple operands, e.g. X86 addressing mode returns 4.

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

18 years agoFix a crash where ConstantVec nodes were being generated with the wrong
Nate Begeman [Wed, 7 Dec 2005 19:48:11 +0000 (19:48 +0000)]
Fix a crash where ConstantVec nodes were being generated with the wrong
type when the target did not support them.  Also teach Legalize how to
expand ConstantVecs.

This allows us to generate

_test:
        lwz r2, 12(r3)
        lwz r4, 8(r3)
        lwz r5, 4(r3)
        lwz r6, 0(r3)
        addi r2, r2, 4
        addi r4, r4, 3
        addi r5, r5, 2
        addi r6, r6, 1
        stw r2, 12(r3)
        stw r4, 8(r3)
        stw r5, 4(r3)
        stw r6, 0(r3)
        blr

For:

void %test(%v4i *%P) {
        %T = load %v4i* %P
        %S = add %v4i %T, <int 1, int 2, int 3, int 4>
        store %v4i %S, %v4i * %P
        ret void
}

On PowerPC.

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

18 years agoOnly transform (sext (truncate x)) -> (sextinreg x) if before legalize or
Chris Lattner [Wed, 7 Dec 2005 18:02:05 +0000 (18:02 +0000)]
Only transform (sext (truncate x)) -> (sextinreg x) if before legalize or
if the target supports the resultant sextinreg

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

18 years agoX86 doesn't support sextinreg for 8-bit things either.
Chris Lattner [Wed, 7 Dec 2005 17:59:14 +0000 (17:59 +0000)]
X86 doesn't support sextinreg for 8-bit things either.

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

18 years agoTeach the dag combiner to turn a truncate/sign_extend pair into a sextinreg
Chris Lattner [Wed, 7 Dec 2005 07:11:03 +0000 (07:11 +0000)]
Teach the dag combiner to turn a truncate/sign_extend pair into a sextinreg
when the types match up.  This allows the X86 backend to compile:

sbyte %toggle_value(sbyte* %tmp.1) {
        %tmp.2 = load sbyte* %tmp.1
        ret sbyte %tmp.2
}

to this:

_toggle_value:
        mov %EAX, DWORD PTR [%ESP + 4]
        movsx %EAX, BYTE PTR [%EAX]
        ret

instead of this:

_toggle_value:
        mov %EAX, DWORD PTR [%ESP + 4]
        movsx %EAX, BYTE PTR [%EAX]
        movsx %EAX, %AL
        ret

noticed in Shootout/objinst.

-Chris

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

18 years agoRemove a now-dead map, patch by Saem Ghani, thanks!
Chris Lattner [Wed, 7 Dec 2005 05:41:44 +0000 (05:41 +0000)]
Remove a now-dead map, patch by Saem Ghani, thanks!

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

18 years agofix divide and remainder
Andrew Lenharth [Tue, 6 Dec 2005 23:27:39 +0000 (23:27 +0000)]
fix divide and remainder

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

18 years agoSilence another annoying GCC warning
Chris Lattner [Tue, 6 Dec 2005 20:56:18 +0000 (20:56 +0000)]
Silence another annoying GCC warning

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

18 years agoThis solves the problem of the CBE renaming symbols that start with . but the assembl...
Andrew Lenharth [Tue, 6 Dec 2005 20:51:30 +0000 (20:51 +0000)]
This solves the problem of the CBE renaming symbols that start with . but the assembly side still trying to reference them by their old names.  Should be safe untill we hit a language front end that lets you specify such a name.

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

18 years agomore decent branches for FP. I might have to make some intermediate nodes to actuall...
Andrew Lenharth [Tue, 6 Dec 2005 20:43:30 +0000 (20:43 +0000)]
more decent branches for FP.  I might have to make some intermediate nodes to actually be able to use the DAG for FPcmp

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

18 years agoOK, this does wonders for broken stuff
Andrew Lenharth [Tue, 6 Dec 2005 20:40:34 +0000 (20:40 +0000)]
OK, this does wonders for broken stuff

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

18 years agoAdded comment for removing assert
Sumant Kowshik [Tue, 6 Dec 2005 18:16:08 +0000 (18:16 +0000)]
Added comment for removing assert

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

18 years agoCollapsing node if variable length struct with final field of length zero
Sumant Kowshik [Tue, 6 Dec 2005 18:04:30 +0000 (18:04 +0000)]
Collapsing node if variable length struct with final field of length zero

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

18 years agoHandling of zero length last fields in struct used for growing it arbitrarily
Sumant Kowshik [Tue, 6 Dec 2005 18:01:20 +0000 (18:01 +0000)]
Handling of zero length last fields in struct used for growing it arbitrarily

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

18 years agoFix test/Regression/Linker/2005-12-06-AppendingZeroLengthArrays.ll and
Chris Lattner [Tue, 6 Dec 2005 17:30:58 +0000 (17:30 +0000)]
Fix test/Regression/Linker/2005-12-06-AppendingZeroLengthArrays.ll and
PR662.  Thanks to Markus for providing me with a ton of files to
reproduce the problem!

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

18 years agonew testcase for PR662
Chris Lattner [Tue, 6 Dec 2005 17:29:54 +0000 (17:29 +0000)]
new testcase for PR662

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

18 years agoImplement external storage for post-order iteration, implementing PR267
Chris Lattner [Tue, 6 Dec 2005 07:05:27 +0000 (07:05 +0000)]
Implement external storage for post-order iteration, implementing PR267
Patch by Saem Ghani, thanks!

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

18 years agoTeach the SelectionDAG ISel how to turn ConstantPacked values into
Nate Begeman [Tue, 6 Dec 2005 06:18:55 +0000 (06:18 +0000)]
Teach the SelectionDAG ISel how to turn ConstantPacked values into
constant nodes with vector types.  Also teach the asm printer how to print
ConstantPacked constant pool entries.  This allows us to generate altivec
code such as the following, which adds a vector constantto a packed float.

LCPI1_0:  <4 x float> < float 0.0e+0, float 0.0e+0, float 0.0e+0, float 1.0e+0 >
        .space  4
        .space  4
        .space  4
        .long   1065353216      ; float 1
        .text
        .align  4
        .globl  _foo
_foo:
        lis r2, ha16(LCPI1_0)
        la r2, lo16(LCPI1_0)(r2)
        li r4, 0
        lvx v0, r4, r2
        lvx v1, r4, r3
        vaddfp v0, v1, v0
        stvx v0, r4, r3
        blr

For the llvm code:

void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, < float 0.0, float 0.0, float 0.0, float 1.0 >
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

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

18 years agoUse new PPC-specific nodes to represent shifts which require the 6-bit
Chris Lattner [Tue, 6 Dec 2005 02:10:38 +0000 (02:10 +0000)]
Use new PPC-specific nodes to represent shifts which require the 6-bit
amount handling that PPC provides.  These are generated by the lowering code
and prevents the dag combiner from assuming (rightfully) that the shifts
don't only look at 5 bits.  This fixes a miscompilation of crafty with
the new front-end.

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

18 years agoadded instructions with inverted immediates
Andrew Lenharth [Tue, 6 Dec 2005 00:33:53 +0000 (00:33 +0000)]
added instructions with inverted immediates

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

18 years agoyea, it helps to have your path set right when testing
Andrew Lenharth [Mon, 5 Dec 2005 23:41:45 +0000 (23:41 +0000)]
yea, it helps to have your path set right when testing

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

18 years agoThese never trigger, but whatever
Andrew Lenharth [Mon, 5 Dec 2005 23:19:44 +0000 (23:19 +0000)]
These never trigger, but whatever

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

18 years agoRemove unnecessary let hasCtrlDep=1 now it can be inferred.
Evan Cheng [Mon, 5 Dec 2005 23:09:43 +0000 (23:09 +0000)]
Remove unnecessary let hasCtrlDep=1 now it can be inferred.

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

18 years ago* Infer instruction property hasCtrlDep from pattern if it has one.
Evan Cheng [Mon, 5 Dec 2005 23:08:55 +0000 (23:08 +0000)]
* Infer instruction property hasCtrlDep from pattern if it has one.
* Fixed a bug related to hasCtrlDep property use.

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

18 years agomove this over to the dag
Andrew Lenharth [Mon, 5 Dec 2005 20:50:53 +0000 (20:50 +0000)]
move this over to the dag

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

18 years agogetRawValue zero extens for unsigned values, use getsextvalue so that we
Chris Lattner [Mon, 5 Dec 2005 18:23:57 +0000 (18:23 +0000)]
getRawValue zero extens for unsigned values, use getsextvalue so that we
know that small negative values fit into the immediate field of addressing
modes.

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

18 years agofix constant pool loads
Andrew Lenharth [Mon, 5 Dec 2005 17:51:02 +0000 (17:51 +0000)]
fix constant pool loads

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

18 years agoFix the #1 code quality problem that I have seen on X86 (and it also affects
Chris Lattner [Mon, 5 Dec 2005 07:10:48 +0000 (07:10 +0000)]
Fix the #1 code quality problem that I have seen on X86 (and it also affects
PPC and other targets).  In a particular, consider code like this:

struct Vector3 { double x, y, z; };
struct Matrix3 { Vector3 a, b, c; };
double dot(Vector3 &a, Vector3 &b) {
   return a.x * b.x  +  a.y * b.y  +  a.z * b.z;
}
Vector3 mul(Vector3 &a, Matrix3 &b) {
   Vector3 r;
   r.x = dot( a, b.a );
   r.y = dot( a, b.b );
   r.z = dot( a, b.c );
   return r;
}
void transform(Matrix3 &m, Vector3 *x, int n) {
   for (int i = 0; i < n; i++)
      x[i] = mul( x[i], m );
}

we compile transform to a loop with all of the GEP instructions for indexing
into 'm' pulled out of the loop (9 of them).  Because isel occurs a bb at a time
we are unable to fold the constant index into the loads in the loop, leading to
PPC code that looks like this:

LBB3_1: ; no_exit.preheader
        li r2, 0
        addi r6, r3, 64        ;; 9 values live across the loop body!
        addi r7, r3, 56
        addi r8, r3, 48
        addi r9, r3, 40
        addi r10, r3, 32
        addi r11, r3, 24
        addi r12, r3, 16
        addi r30, r3, 8
LBB3_2: ; no_exit
        lfd f0, 0(r30)
        lfd f1, 8(r4)
        fmul f0, f1, f0
        lfd f2, 0(r3)        ;; no constant indices folded into the loads!
        lfd f3, 0(r4)
        lfd f4, 0(r10)
        lfd f5, 0(r6)
        lfd f6, 0(r7)
        lfd f7, 0(r8)
        lfd f8, 0(r9)
        lfd f9, 0(r11)
        lfd f10, 0(r12)
        lfd f11, 16(r4)
        fmadd f0, f3, f2, f0
        fmul f2, f1, f4
        fmadd f0, f11, f10, f0
        fmadd f2, f3, f9, f2
        fmul f1, f1, f6
        stfd f0, 0(r4)
        fmadd f0, f11, f8, f2
        fmadd f1, f3, f7, f1
        stfd f0, 8(r4)
        fmadd f0, f11, f5, f1
        addi r29, r4, 24
        stfd f0, 16(r4)
        addi r2, r2, 1
        cmpw cr0, r2, r5
        or r4, r29, r29
        bne cr0, LBB3_2 ; no_exit

uh, yuck.  With this patch, we now sink the constant offsets into the loop, producing
this code:

LBB3_1: ; no_exit.preheader
        li r2, 0
LBB3_2: ; no_exit
        lfd f0, 8(r3)
        lfd f1, 8(r4)
        fmul f0, f1, f0
        lfd f2, 0(r3)
        lfd f3, 0(r4)
        lfd f4, 32(r3)       ;; much nicer.
        lfd f5, 64(r3)
        lfd f6, 56(r3)
        lfd f7, 48(r3)
        lfd f8, 40(r3)
        lfd f9, 24(r3)
        lfd f10, 16(r3)
        lfd f11, 16(r4)
        fmadd f0, f3, f2, f0
        fmul f2, f1, f4
        fmadd f0, f11, f10, f0
        fmadd f2, f3, f9, f2
        fmul f1, f1, f6
        stfd f0, 0(r4)
        fmadd f0, f11, f8, f2
        fmadd f1, f3, f7, f1
        stfd f0, 8(r4)
        fmadd f0, f11, f5, f1
        addi r6, r4, 24
        stfd f0, 16(r4)
        addi r2, r2, 1
        cmpw cr0, r2, r5
        or r4, r6, r6
        bne cr0, LBB3_2 ; no_exit

This is much nicer as it reduces register pressure in the loop a lot.  On X86,
this takes the function from having 9 spilled registers to 2.  This should help
some spec programs on X86 (gzip?)

This is currently only enabled with -enable-gep-isel-opt to allow perf testing
tonight.

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

18 years agoAdd a flag to Module::getGlobalVariable to allow it to return vars with
Chris Lattner [Mon, 5 Dec 2005 05:30:21 +0000 (05:30 +0000)]
Add a flag to Module::getGlobalVariable to allow it to return vars with
internal linkage.

Patch provided by Evan Jones, thanks!

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

18 years agoattribute((used)) is now supported
Chris Lattner [Mon, 5 Dec 2005 05:23:06 +0000 (05:23 +0000)]
attribute((used)) is now supported

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

18 years agoWrap a long line, never internalize llvm.used.
Chris Lattner [Mon, 5 Dec 2005 05:07:38 +0000 (05:07 +0000)]
Wrap a long line, never internalize llvm.used.

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

18 years agoNew testcase for PR660
Chris Lattner [Mon, 5 Dec 2005 04:48:12 +0000 (04:48 +0000)]
New testcase for PR660

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