Commit Graph

20070 Commits

Author SHA1 Message Date
Nate Begeman a3da8c4819 Remove a bogus piece of my AssertSext/AssertZext patch. oops.
llvm-svn: 23148
2005-08-30 02:54:28 +00:00
Nate Begeman 43144a2fe0 Add support for AssertSext and AssertZext, folding other extensions with
them.  This allows for elminination of redundant extends in the entry
blocks of functions on PowerPC.

Add support for i32 x i32 -> i64 multiplies, by recognizing when the inputs
to ISD::MUL in ExpandOp are actually just extended i32 values and not real
i64 values.  this allows us to codegen

int mulhs(int a, int b) { return ((long long)a * b) >> 32; }
as:
_mulhs:
        mulhw r3, r4, r3
        blr

instead of:
_mulhs:
        mulhwu r2, r4, r3
        srawi r5, r3, 31
        mullw r5, r4, r5
        add r2, r2, r5
        srawi r4, r4, 31
        mullw r3, r4, r3
        add r3, r2, r3
        blr

with a similar improvement on x86.

llvm-svn: 23147
2005-08-30 02:44:00 +00:00
Nate Begeman c9d1e370a5 Add AssertSext, AssertZext nodes for targets that pass arguments in
registers, and the incoming values have already been zero or sign extended
from the appopriate type to the register width.

llvm-svn: 23146
2005-08-30 02:39:32 +00:00
Chris Lattner 08a1e38730 Name this variable to be what it really is!
llvm-svn: 23145
2005-08-30 01:58:51 +00:00
Chris Lattner 04cb82278a Handle CopyToReg nodes with flag operands correctly
llvm-svn: 23144
2005-08-30 01:57:23 +00:00
Chris Lattner 7a59b1cf90 Make sure the selector emits register register copies with flag operands
linking them to calls when appropriate, this prevents the scheduler from
pulling these copies away from the call.

This fixes Ptrdist/yacr2

llvm-svn: 23143
2005-08-30 01:57:02 +00:00
Chris Lattner 709190d540 add some method variants
llvm-svn: 23142
2005-08-30 01:56:13 +00:00
Chris Lattner e413b60632 The first operand to AND does not always have more than two operands. This
fixes MediaBench/toast with the dag selector

llvm-svn: 23141
2005-08-30 00:59:16 +00:00
Chris Lattner e75b5e63a7 Fix a bug in my patch for legalizing to fsel. It cannot handle seteq/setne,
which I failed to include when I moved the code over.  This fixes
MallocBench/gs.

llvm-svn: 23140
2005-08-30 00:45:18 +00:00
Chris Lattner 61f7c3e843 emit FMR instructions to convert f64<->f32 instructions, so things like
STOREs, know the right type to store.

llvm-svn: 23139
2005-08-30 00:30:43 +00:00
Chris Lattner 62b9a5d1f8 Fix some really strange indentation that xcode likes to use.
no xcode, this is not right:

   if (!foo) break;
     X;

llvm-svn: 23138
2005-08-30 00:19:00 +00:00
Chris Lattner 12357281b8 fix a crash in cfrac
llvm-svn: 23137
2005-08-29 23:49:25 +00:00
Chris Lattner 1cbbe1015a Implement DYNAMIC_STACKALLOC, wrap some long lines
llvm-svn: 23136
2005-08-29 23:30:11 +00:00
Chris Lattner f7e5ec84c6 Add a hack to avoid some horrible code in some cases by always emitting
token chains first.  For this C function:

int test() {
  int i;
  for (i = 0; i < 100000; ++i)
    foo();
}

Instead of emitting this (condition before call)

.LBB_test_1:    ; no_exit
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr2, r30, r2
        bl L_foo$stub
        bne cr2, .LBB_test_1    ; no_exit

Emit this:

.LBB_test_1:    ; no_exit
        bl L_foo$stub
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr0, r30, r2
        bne cr0, .LBB_test_1    ; no_exit

Which makes it so we don't have to save/restore cr2 in the prolog/epilog of
the function.

This also makes the code much more similar to what the pattern isel produces.

llvm-svn: 23135
2005-08-29 23:21:29 +00:00
Chris Lattner 0d45ee4a06 improve comment
llvm-svn: 23134
2005-08-29 22:48:32 +00:00
Chris Lattner b2b418509b Fix a dumb bug of mine where we were mishandling the PPC ABI (undef handling).
This fixes voronoi and bh in Olden, allowing all of olden to pass!

llvm-svn: 23133
2005-08-29 22:22:57 +00:00
Chris Lattner 3439ccce4d Add a new API for nate
llvm-svn: 23132
2005-08-29 22:00:00 +00:00
Chris Lattner c738d000d5 Add a new API for Nate
llvm-svn: 23131
2005-08-29 21:59:31 +00:00
Andrew Lenharth 835cbb364d Some of us cared about the the promote path
llvm-svn: 23130
2005-08-29 20:46:51 +00:00
Chris Lattner dcde1b2b6a Fix an infinite loop on x86
llvm-svn: 23129
2005-08-29 17:30:00 +00:00
Chris Lattner 1a1ecf0679 Allow bugpoint+PPC codegen to use fsqrt
llvm-svn: 23128
2005-08-29 13:14:24 +00:00
Chris Lattner c429ab2fb1 Fix a bug the last patch exposed in treeadd among others
llvm-svn: 23127
2005-08-29 01:07:02 +00:00
Chris Lattner d4d683a47b A hack to fix a problem folding immedaites. This fixes Olden/power.
llvm-svn: 23126
2005-08-29 01:01:01 +00:00
Chris Lattner 3ccad3fb8c Fix order of operands for copytoreg node when emitting calls. This fixes
Olden/msFix order of operands for copytoreg node when emitting calls.  This fixes
Olden/mstt.

llvm-svn: 23125
2005-08-29 00:26:57 +00:00
Chris Lattner 46d4c75cd1 Fix a bug in my previous patch that was using the wrong iterator. This fixes
Olden/bisort among others.

llvm-svn: 23124
2005-08-29 00:10:46 +00:00
Chris Lattner 66ddc8d3bf add operands in the correct order
llvm-svn: 23123
2005-08-29 00:02:01 +00:00
Chris Lattner 87421c8658 Fix a bug in ReplaceAllUsesWith
llvm-svn: 23122
2005-08-28 23:59:36 +00:00
Chris Lattner dfcde88d07 Fix a bug in FP_EXTEND, implement FP_TO_SINT
llvm-svn: 23121
2005-08-28 23:59:09 +00:00
Chris Lattner 38660c6666 fix an assertion failure in treeadd
llvm-svn: 23120
2005-08-28 23:39:22 +00:00
Reid Spencer aa7fbca285 Adjust to member variable name change.
llvm-svn: 23119
2005-08-27 19:09:48 +00:00
Reid Spencer 85d93a3ec9 Change the names of member variables per Chris' instructions, and document
them more clearly.

llvm-svn: 23118
2005-08-27 19:09:02 +00:00
Reid Spencer 3f0a2493a5 Fix a typo.
llvm-svn: 23117
2005-08-27 19:06:05 +00:00
Reid Spencer dfb3fb4a25 Implement PR614:
These changes modify the makefiles so that the output of flex and bison are
placed in the SRC directory, not the OBJ directory. It is intended that they
be checked in as any other LLVM source so that platforms without convenient
access to flex/bison can be compiled. From now on, if you change a .y or
.l file you *must* also commit the generated .cpp and .h files.

llvm-svn: 23115
2005-08-27 18:50:39 +00:00
Chris Lattner 075250bda1 Disable this code, which broke many tests last night
llvm-svn: 23114
2005-08-27 16:16:51 +00:00
Chris Lattner 5ee85e89b6 fix PHI node emission for basic blocks that have select_cc's in them on ppc32
llvm-svn: 23113
2005-08-27 00:58:02 +00:00
Chris Lattner 787e962795 The condition register being branched on may not be cr0, as such, print it.
This fixes: UnitTests/2005-07-17-INT-To-FP.c

llvm-svn: 23112
2005-08-26 23:42:05 +00:00
Chris Lattner 29bfaa7ef0 Propagate cr# from COND_BRANCH to the actual branch instruction as appropriate
llvm-svn: 23111
2005-08-26 23:41:27 +00:00
Chris Lattner 56ca46ee04 Nate noticed that Andrew never did this. This fixes PR600
llvm-svn: 23110
2005-08-26 22:50:40 +00:00
Chris Lattner e7a2998064 Don't copy regs that are only used in the entry block into a vreg. This
changes the code generated for:

short %test(short %A) {
  %B = xor short %A, -32768
  ret short %B
}

to:

_test:
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 16, 31
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr

llvm-svn: 23109
2005-08-26 22:49:59 +00:00
Chris Lattner d4f43f7967 Make this code safe for when loadRegFromStackSlot inserts multiple instructions.
llvm-svn: 23108
2005-08-26 22:18:32 +00:00
Chris Lattner 422e23dd02 allow code using mtcrf to assemble
llvm-svn: 23107
2005-08-26 22:05:54 +00:00
Nate Begeman 72f23815bc Remove operand type 'crbit', since it is no longer used
llvm-svn: 23106
2005-08-26 22:04:17 +00:00
Chris Lattner c3d1bdd0a9 teach getClass what a condition reg is
llvm-svn: 23105
2005-08-26 21:51:29 +00:00
Chris Lattner 97345405a6 Minor cleanups:
* avoid calling getClass() multiple times (it is relatively expensive)
  * Allow -disable-fp-elim to turn of frame pointer elimination.

llvm-svn: 23104
2005-08-26 21:49:18 +00:00
Chris Lattner 4a5ebe94ba Checking types here is not safe, because multiple types can map to the same
register class.

llvm-svn: 23103
2005-08-26 21:39:15 +00:00
Chris Lattner 9b577f108a implement SELECT_CC fully for the DAG->DAG isel!
llvm-svn: 23101
2005-08-26 21:23:58 +00:00
Chris Lattner db88626603 add some forward defs
llvm-svn: 23100
2005-08-26 21:06:40 +00:00
Chris Lattner c6a0338c04 spell this right
llvm-svn: 23099
2005-08-26 20:55:40 +00:00
Chris Lattner 13d7c252e5 Call the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
flag is set on an instruction.

llvm-svn: 23098
2005-08-26 20:54:47 +00:00
Chris Lattner 17c28fa36b spell this right!
llvm-svn: 23097
2005-08-26 20:53:44 +00:00