1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 22:42:46 +02:00
Commit Graph

418 Commits

Author SHA1 Message Date
Nate Begeman
d754412b26 Remove some unnecessary casts, and add the AssertZext case to
MaskedValueIsZero.

llvm-svn: 23164
2005-08-31 00:27:53 +00:00
Chris Lattner
87d45af685 Allow physregs to occur in the dag with multiple types. Though I don't likethis, it is a requirement on PPC, which can have an f32 value in r3 at onepoint in a function and a f64 value in r3 at another point. :(
This fixes compilation of mesa

llvm-svn: 23161
2005-08-30 22:38:38 +00:00
Chris Lattner
6a990c392c Fix FreeBench/fourinarow with the dag isel, by not adding a bogus result
to SHIFT_PARTS nodes

llvm-svn: 23151
2005-08-30 17:21:17 +00:00
Chris Lattner
772c8814b6 Fix a miscompile of PtrDist/bc. Sign extending bools is not the right thing,
at least tends to expose problems elsewhere.

llvm-svn: 23149
2005-08-30 16:56:19 +00:00
Nate Begeman
25755f7f00 Remove a bogus piece of my AssertSext/AssertZext patch. oops.
llvm-svn: 23148
2005-08-30 02:54:28 +00:00
Nate Begeman
dc36f47d99 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
Chris Lattner
a611caeec8 Name this variable to be what it really is!
llvm-svn: 23145
2005-08-30 01:58:51 +00:00
Chris Lattner
56051a0f92 Handle CopyToReg nodes with flag operands correctly
llvm-svn: 23144
2005-08-30 01:57:23 +00:00
Chris Lattner
774b9718dc 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
32609690c3 Add a new API for Nate
llvm-svn: 23131
2005-08-29 21:59:31 +00:00
Andrew Lenharth
f580b078b6 Some of us cared about the the promote path
llvm-svn: 23130
2005-08-29 20:46:51 +00:00
Chris Lattner
b0e46fa671 Fix an infinite loop on x86
llvm-svn: 23129
2005-08-29 17:30:00 +00:00
Chris Lattner
44dcf508a1 Fix a bug in ReplaceAllUsesWith
llvm-svn: 23122
2005-08-28 23:59:36 +00:00
Chris Lattner
e0eae3d244 Disable this code, which broke many tests last night
llvm-svn: 23114
2005-08-27 16:16:51 +00:00
Chris Lattner
6bf97cff13 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
35a82f5f79 Nate noticed that Andrew never did this. This fixes PR600
llvm-svn: 23110
2005-08-26 22:50:40 +00:00
Chris Lattner
e9cc12f5c4 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
7efca0c312 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
faa96209d8 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
3e0bfc0cc1 Revampt ReplaceAllUsesWith to be more efficient and easier to use.
llvm-svn: 23087
2005-08-26 18:36:28 +00:00
Chris Lattner
a31708e6b3 Change ConstantPoolSDNode to actually hold the Constant itself instead of
putting it into the constant pool.  This allows the isel machinery to
create constants that it will end up deciding are not needed, without them
ending up in the resultant function constant pool.

llvm-svn: 23081
2005-08-26 17:15:30 +00:00
Chris Lattner
929c00e9e9 Fix a huge annoyance: SelectNodeTo took types before the opcode unlike
every other SD API.  Fix it to take the opcode before the types.

llvm-svn: 23079
2005-08-26 16:36:26 +00:00
Chris Lattner
6d22117d76 the 5th operand is the 4th number
llvm-svn: 23074
2005-08-26 00:43:46 +00:00
Chris Lattner
f25ec1b7b9 Add support for targets that want to custom expand select_cc in some cases.
llvm-svn: 23071
2005-08-26 00:23:59 +00:00
Chris Lattner
7e68d39877 Allow LowerOperation to return a null SDOperand in case it wants to lower
some things given to it, but not all.

llvm-svn: 23070
2005-08-26 00:14:16 +00:00
Chris Lattner
2c3fbbab05 Fix a nasty bug from a previous patch of mine
llvm-svn: 23069
2005-08-26 00:13:12 +00:00
Nate Begeman
54f44ad750 New fold for SELECT_CC
llvm-svn: 23058
2005-08-25 20:04:38 +00:00
Chris Lattner
18572f3c67 Don't auto-cse nodes that return flags
llvm-svn: 23055
2005-08-25 19:12:10 +00:00
Chris Lattner
7c7a447220 simplify the code a bit using isOperationLegal
llvm-svn: 23053
2005-08-25 17:54:58 +00:00
Chris Lattner
7598a14e0c Add support for flag operands
llvm-svn: 23050
2005-08-25 17:48:54 +00:00
Chris Lattner
0168c8df11 ADd support for TargetConstantPool nodes
llvm-svn: 23041
2005-08-25 05:03:06 +00:00
Chris Lattner
813f6ddaf8 add a new TargetFrameIndex node
llvm-svn: 23035
2005-08-25 00:43:01 +00:00
Chris Lattner
22c6c99e5d add a method
llvm-svn: 23027
2005-08-24 23:00:29 +00:00
Chris Lattner
786ec10dfb Add ReplaceAllUsesWith that can take a vector of replacement values.
Add some foldings to hopefully help the illegal setcc issue, and move some code around.

llvm-svn: 23025
2005-08-24 22:44:39 +00:00
Chris Lattner
92b560cfee Add support for external symbols, and support for variable arity instructions
llvm-svn: 23022
2005-08-24 22:02:41 +00:00
Chris Lattner
55fb48f5ee Fix pasto that prevented VT ndoes from showing up in -view-isel-dags correctly
llvm-svn: 23021
2005-08-24 18:30:00 +00:00
Chris Lattner
6d4cd33447 teach selection dag mask tracking about the fact that select_cc operates like
select.  Also teach it that the bit count instructions can only set the low bits
of the result, depending on the size of the input.

This allows us to compile this:

int %eq0(int %a) {
        %tmp.1 = seteq int %a, 0                ; <bool> [#uses=1]
        %tmp.2 = cast bool %tmp.1 to int                ; <int> [#uses=1]
        ret int %tmp.2
}

To this:

_eq0:
        cntlzw r2, r3
        srwi r3, r2, 5
        blr

instead of this:

_eq0:
        cntlzw r2, r3
        rlwinm r3, r2, 27, 31, 31
        blr

when setcc is marked illegal on ppc (which restores parity to non-illegal
setcc).  Thanks to Nate for pointing this out.

llvm-svn: 23013
2005-08-24 16:46:55 +00:00
Chris Lattner
014e001f23 Start using isOperationLegal and isTypeLegal to simplify the code
llvm-svn: 23012
2005-08-24 16:35:28 +00:00
Nate Begeman
2fc750ca45 Teach SelectionDAG how to simplify a few more setcc-equivalent select_cc
nodes so that backends don't have to.

llvm-svn: 22999
2005-08-24 04:57:57 +00:00
Chris Lattner
64f7f0beac Make -view-isel-dags show the dag before instruction selecting, in case
the target isel crashes due to unimplemented features like calls :)

llvm-svn: 22997
2005-08-24 00:34:29 +00:00
Nate Begeman
d4fcf86262 Fix optimization of select_cc seteq X, 0, 1, 0 -> srl (ctlz X), log2 X size
llvm-svn: 22995
2005-08-24 00:21:28 +00:00
Nate Begeman
f1581c11e9 Teach the SelectionDAG how to transform select_cc eq, X, 0, 1, 0 into
either seteq X, 0 or srl (ctlz X), size(X-1), depending on what's legal
for the target.

llvm-svn: 22978
2005-08-23 05:41:12 +00:00
Nate Begeman
885680bafb Teach Legalize how to turn setcc into select_cc
llvm-svn: 22977
2005-08-23 04:29:48 +00:00
Chris Lattner
d73a5042d9 Fix a problem where constant expr shifts would not have their shift amount
promoted to the right type.  This fixes: IA64/2005-08-22-LegalizerCrash.ll

llvm-svn: 22969
2005-08-22 17:28:31 +00:00
Chris Lattner
7ce81741ff Add a fast-path for register values. Add support for constant pool entries,
allowing us to compile this:

float %test2(float* %P) {
        %Q = load float* %P
        %R = add float %Q, 10.1
        ret float %R
}

to this:

_test2:
        lfs r2, 0(r3)
        lis r3, ha16(.CPI_test2_0)
        lfs r3, lo16(.CPI_test2_0)(r3)
        fadds f1, r2, r3
        blr

llvm-svn: 22962
2005-08-22 01:04:32 +00:00
Chris Lattner
8927bf468d add anew method
llvm-svn: 22957
2005-08-21 22:30:30 +00:00
Chris Lattner
7a04eff613 Add support for frame index nodes
llvm-svn: 22956
2005-08-21 19:56:04 +00:00
Chris Lattner
cbbd212622 add a method
llvm-svn: 22955
2005-08-21 19:48:59 +00:00
Chris Lattner
481b47fc75 add a method
llvm-svn: 22949
2005-08-21 18:49:33 +00:00
Chris Lattner
3f6df51c19 Add support for basic blocks, fix a bug in result # computation
llvm-svn: 22948
2005-08-21 18:49:29 +00:00