oota-llvm.git
19 years agoadded s4addl matching test
Andrew Lenharth [Wed, 13 Apr 2005 04:41:06 +0000 (04:41 +0000)]
added s4addl matching test

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

19 years agoadded all flavors of zap for anding
Andrew Lenharth [Wed, 13 Apr 2005 03:47:03 +0000 (03:47 +0000)]
added all flavors of zap for anding

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

19 years agoMake expansion of uint->fp cast assert out instead of infinitely recurse.
Chris Lattner [Wed, 13 Apr 2005 03:42:14 +0000 (03:42 +0000)]
Make expansion of uint->fp cast assert out instead of infinitely recurse.

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

19 years agoFix some mysteriously missing {}'s which cause the miscompilation of
Chris Lattner [Wed, 13 Apr 2005 03:29:53 +0000 (03:29 +0000)]
Fix some mysteriously missing {}'s which cause the miscompilation of
Olden/mst, Ptrdist/bc, Obsequi, etc.

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

19 years agoadd back the optimization that Nate added for shl X, (zext_inreg y)
Chris Lattner [Wed, 13 Apr 2005 02:58:13 +0000 (02:58 +0000)]
add back the optimization that Nate added for shl X, (zext_inreg y)

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

19 years agoOops, remove these too.
Chris Lattner [Wed, 13 Apr 2005 02:47:57 +0000 (02:47 +0000)]
Oops, remove these too.

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

19 years agoremove one more occurance of this that snuck in
Chris Lattner [Wed, 13 Apr 2005 02:46:17 +0000 (02:46 +0000)]
remove one more occurance of this that snuck in

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

19 years agoRemove support for ZERO_EXTEND_INREG. This pessimizes code, genering stuff
Chris Lattner [Wed, 13 Apr 2005 02:43:40 +0000 (02:43 +0000)]
Remove support for ZERO_EXTEND_INREG.  This pessimizes code, genering stuff
like this:

        ldah $1,1($31)
        lda $1,-1($1)
        and $0,$1,$24

instead of this:

        zap $0,252,$24

To get this back, the selector should recognize the ISD::AND case where this
happens and emit the appropriate ZAP instruction.

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

19 years agoRemove special handling of ZERO_EXTEND_INREG. This pessimizes code, causing
Chris Lattner [Wed, 13 Apr 2005 02:41:52 +0000 (02:41 +0000)]
Remove special handling of ZERO_EXTEND_INREG.  This pessimizes code, causing
things like this:

       mov r9 = 65535;;
       and r8 = r8, r9;;

To be emitted instead of:

        zxt2 r8 = r8;;

To get this back, the selector for ISD::AND should recognize this case.

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

19 years agoElimate handling of ZERO_EXTEND_INREG. This causes the PPC backend to emit
Chris Lattner [Wed, 13 Apr 2005 02:40:26 +0000 (02:40 +0000)]
Elimate handling of ZERO_EXTEND_INREG.  This causes the PPC backend to emit
andi instructions instead of rlwinm instructions for zero extend, but they
seem like they would take the same time.

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

19 years agoZ_E_I is gone
Chris Lattner [Wed, 13 Apr 2005 02:39:05 +0000 (02:39 +0000)]
Z_E_I is gone

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

19 years agoInstead of making ZERO_EXTEND_INREG nodes, use the helper method in
Chris Lattner [Wed, 13 Apr 2005 02:38:47 +0000 (02:38 +0000)]
Instead of making ZERO_EXTEND_INREG nodes, use the helper method in
SelectionDAG to do the job with AND.  Don't legalize Z_E_I anymore as
it is gone

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

19 years agoRemove all foldings of ZERO_EXTEND_INREG, moving them to work for AND nodes
Chris Lattner [Wed, 13 Apr 2005 02:38:18 +0000 (02:38 +0000)]
Remove all foldings of ZERO_EXTEND_INREG, moving them to work for AND nodes
instead.  OVerall, this increases the amount of folding we can do.

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

19 years agoAdd a new helper method which returns the and that is equivalent to what
Chris Lattner [Wed, 13 Apr 2005 02:37:19 +0000 (02:37 +0000)]
Add a new helper method which returns the and that is equivalent to what
ZERO_EXTEND_INREG was.

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

19 years agoRemove the ZERO_EXTEND_INREG node which is redundant with AND
Chris Lattner [Wed, 13 Apr 2005 02:36:41 +0000 (02:36 +0000)]
Remove the ZERO_EXTEND_INREG node which is redundant with AND

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

19 years agoFold shift x, [sz]ext(y) -> shift x, y
Nate Begeman [Tue, 12 Apr 2005 23:32:28 +0000 (23:32 +0000)]
Fold shift x, [sz]ext(y) -> shift x, y

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

19 years agoFold shift by size larger than type size to undef
Nate Begeman [Tue, 12 Apr 2005 23:12:17 +0000 (23:12 +0000)]
Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes

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

19 years agoImplement setcc op, -1 sequences
Nate Begeman [Tue, 12 Apr 2005 21:22:28 +0000 (21:22 +0000)]
Implement setcc op, -1 sequences
Remove dead setcc op, 0 sequences
Coming later: generalization of op, imm

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

19 years agopromote extload i1 -> extload i8
Chris Lattner [Tue, 12 Apr 2005 20:30:10 +0000 (20:30 +0000)]
promote extload i1 -> extload i8

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

19 years agoadd an argument to allow avoiding deleting phi nodes.
Chris Lattner [Tue, 12 Apr 2005 18:52:14 +0000 (18:52 +0000)]
add an argument to allow avoiding deleting phi nodes.

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

19 years agoadd an argument.
Chris Lattner [Tue, 12 Apr 2005 18:51:53 +0000 (18:51 +0000)]
add an argument.

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

19 years agoGet rid of this for_each loop
Chris Lattner [Tue, 12 Apr 2005 18:51:33 +0000 (18:51 +0000)]
Get rid of this for_each loop

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

19 years ago* OK, after changing to use liveIn/liveOut instead of IDEFs,
Duraid Madina [Tue, 12 Apr 2005 18:42:59 +0000 (18:42 +0000)]
* OK, after changing to use liveIn/liveOut instead of IDEFs,
to avoid redundant mov out3=r44 type instructions, we need to
tell the register allocator the truth about out? registers.

FIXME: unfortunately, since the list of allocatable registers is immutable,
we can't simply 'delete r127' from the allocation order, say, if 'out0' is
used. The only correct thing we can do is have a linear order of regs:

out7, out6 ... out2, out1, out0, r32, r33, r34 ... r126, r127

and slide a 'window' of 96 registers along this line, depending on how many
of the out? regs a function actually uses. The only downside of this is
that the out? registers will be allocated _first_, which makes the
resulting assembly ugly. :( Note this in the README. Hope this gets fixed
soon. :) (note the 3rd person speech there)

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

19 years agoGet rid of idefs for arguments (oops)
Andrew Lenharth [Tue, 12 Apr 2005 17:47:57 +0000 (17:47 +0000)]
Get rid of idefs for arguments (oops)

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

19 years agoGet rid of idefs for arguments
Andrew Lenharth [Tue, 12 Apr 2005 17:35:16 +0000 (17:35 +0000)]
Get rid of idefs for arguments

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

19 years agoPut out* into the allocation order, allowing the register allocator to
Chris Lattner [Tue, 12 Apr 2005 15:12:51 +0000 (15:12 +0000)]
Put out* into the allocation order, allowing the register allocator to
coallesce moves into outgoing args.

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

19 years agoMake sure to realize that calls use their argument regs
Chris Lattner [Tue, 12 Apr 2005 15:12:19 +0000 (15:12 +0000)]
Make sure to realize that calls use their argument regs

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

19 years agostop emitting IDEFs for args - change to using liveIn/liveOut
Duraid Madina [Tue, 12 Apr 2005 14:54:44 +0000 (14:54 +0000)]
stop emitting IDEFs for args - change to using liveIn/liveOut

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

19 years agoInitial support for allocation condition registers
Nate Begeman [Tue, 12 Apr 2005 07:04:16 +0000 (07:04 +0000)]
Initial support for allocation condition registers

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

19 years agoFix a crash analyzing MultiSource/Benchmarks/MallocBench/gs
Chris Lattner [Tue, 12 Apr 2005 03:59:27 +0000 (03:59 +0000)]
Fix a crash analyzing MultiSource/Benchmarks/MallocBench/gs

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

19 years agoRemove some redundant checks, add a couple of new ones. This allows us to
Chris Lattner [Tue, 12 Apr 2005 02:54:39 +0000 (02:54 +0000)]
Remove some redundant checks, add a couple of new ones.  This allows us to
compile this:

int foo (unsigned long a, unsigned long long g) {
  return a >= g;
}

To:

foo:
        movl 8(%esp), %eax
        cmpl %eax, 4(%esp)
        setae %al
        cmpl $0, 12(%esp)
        sete %cl
        andb %al, %cl
        movzbl %cl, %eax
        ret

instead of:

foo:
        movl 8(%esp), %eax
        cmpl %eax, 4(%esp)
        setae %al
        movzbw %al, %cx
        movl 12(%esp), %edx
        cmpl $0, %edx
        sete %al
        movzbw %al, %ax
        cmpl $0, %edx
        cmove %cx, %ax
        movzbl %al, %eax
        ret

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

19 years agoEmit comparisons against the sign bit better. Codegen this:
Chris Lattner [Tue, 12 Apr 2005 02:19:10 +0000 (02:19 +0000)]
Emit comparisons against the sign bit better.  Codegen this:

bool %test1(long %X) {
        %A = setlt long %X, 0
        ret bool %A
}

like this:

test1:
        cmpl $0, 8(%esp)
        setl %al
        movzbl %al, %eax
        ret

instead of:

test1:
        movl 8(%esp), %ecx
        cmpl $0, %ecx
        setl %al
        movzbw %al, %ax
        cmpl $0, 4(%esp)
        setb %dl
        movzbw %dl, %dx
        cmpl $0, %ecx
        cmove %dx, %ax
        movzbl %al, %eax
        ret

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

19 years agoEmit long comparison against -1 better. Instead of this (x86):
Chris Lattner [Tue, 12 Apr 2005 01:46:05 +0000 (01:46 +0000)]
Emit long comparison against -1 better.  Instead of this (x86):

test2:
        movl 8(%esp), %eax
        notl %eax
        movl 4(%esp), %ecx
        notl %ecx
        orl %eax, %ecx
        cmpl $0, %ecx
        sete %al
        movzbl %al, %eax
        ret

or this (PPC):

_test2:
        nor r2, r4, r4
        nor r3, r3, r3
        or r2, r2, r3
        cntlzw r2, r2
        srwi r3, r2, 5
        blr

Emit this:

test2:
        movl 8(%esp), %eax
        andl 4(%esp), %eax
        cmpl $-1, %eax
        sete %al
        movzbl %al, %eax
        ret

or this:

_test2:
.LBB_test2_0:   ;
        and r2, r4, r3
        cmpwi cr0, r2, -1
        li r3, 1
        li r2, 0
        beq .LBB_test2_2        ;
.LBB_test2_1:   ;
        or r3, r2, r2
.LBB_test2_2:   ;
        blr

it seems like the PPC isel could do better for R32 == -1 case.

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

19 years agocanonicalize x <u 1 -> x == 0. On this testcase:
Chris Lattner [Tue, 12 Apr 2005 00:28:49 +0000 (00:28 +0000)]
canonicalize x <u 1 -> x == 0.  On this testcase:

unsigned long long g;
unsigned long foo (unsigned long a) {
  return (a >= g) ? 1 : 0;
}

It changes the ppc code from:

_foo:
.LBB_foo_0:     ; entry
        mflr r11
        stw r11, 8(r1)
        bl "L00000$pb"
"L00000$pb":
        mflr r2
        addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
        lwz r4, 0(r2)
        lwz r2, 4(r2)
        cmplw cr0, r3, r2
        li r2, 1
        li r3, 0
        bge .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        or r2, r3, r3
.LBB_foo_2:     ; entry
        cmplwi cr0, r4, 1
        li r3, 1
        li r5, 0
        blt .LBB_foo_4  ; entry
.LBB_foo_3:     ; entry
        or r3, r5, r5
.LBB_foo_4:     ; entry
        cmpwi cr0, r4, 0
        beq .LBB_foo_6  ; entry
.LBB_foo_5:     ; entry
        or r2, r3, r3
.LBB_foo_6:     ; entry
        rlwinm r3, r2, 0, 31, 31
        lwz r11, 8(r1)
        mtlr r11
        blr

to:

_foo:
.LBB_foo_0:     ; entry
        mflr r11
        stw r11, 8(r1)
        bl "L00000$pb"
"L00000$pb":
        mflr r2
        addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
        lwz r4, 0(r2)
        lwz r2, 4(r2)
        cmplw cr0, r3, r2
        li r2, 1
        li r3, 0
        bge .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        or r2, r3, r3
.LBB_foo_2:     ; entry
        cntlzw r3, r4
        srwi r3, r3, 5
        cmpwi cr0, r4, 0
        beq .LBB_foo_4  ; entry
.LBB_foo_3:     ; entry
        or r2, r3, r3
.LBB_foo_4:     ; entry
        rlwinm r3, r2, 0, 31, 31
        lwz r11, 8(r1)
        mtlr r11
        blr

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

19 years agoImplement bitfield clears
Nate Begeman [Tue, 12 Apr 2005 00:10:02 +0000 (00:10 +0000)]
Implement bitfield clears
Implement divide by negative power of two

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

19 years agoUpdate PPC readme. Remove things that are done or aren't ppc specific
Nate Begeman [Mon, 11 Apr 2005 20:48:57 +0000 (20:48 +0000)]
Update PPC readme.  Remove things that are done or aren't ppc specific

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

19 years agoTeach the dag mechanism that this:
Chris Lattner [Mon, 11 Apr 2005 20:29:59 +0000 (20:29 +0000)]
Teach the dag mechanism that this:

long long test2(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) + B;
}

is equivalent to this:

long long test1(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) | B;
}

Now they are both codegen'd to this on ppc:

_test2:
        blr

or this on x86:

test2:
        movl 4(%esp), %edx
        movl 8(%esp), %eax
        ret

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

19 years agoFix expansion of shifts by exactly NVT bits on arch's (like X86) that have
Chris Lattner [Mon, 11 Apr 2005 20:08:52 +0000 (20:08 +0000)]
Fix expansion of shifts by exactly NVT bits on arch's (like X86) that have
masking shifts.

This fixes the miscompilation of this:

long long test1(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) | B;
}

into this:

test1:
        movl 4(%esp), %edx
        movl %edx, %eax
        orl 8(%esp), %eax
        ret

allowing us to generate this instead:

test1:
        movl 4(%esp), %edx
        movl 8(%esp), %eax
        ret

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

19 years agoIA64 supports this operation.
Chris Lattner [Mon, 11 Apr 2005 18:55:36 +0000 (18:55 +0000)]
IA64 supports this operation.

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

19 years agoORo sets CR0
Chris Lattner [Mon, 11 Apr 2005 15:03:48 +0000 (15:03 +0000)]
ORo sets CR0

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

19 years agoRevert the previous patch, which I didn't mean to check in.
Chris Lattner [Mon, 11 Apr 2005 15:03:41 +0000 (15:03 +0000)]
Revert the previous patch, which I didn't mean to check in.

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

19 years agoFix a minor bug (ORo didn't mark that it set CR0).
Chris Lattner [Mon, 11 Apr 2005 15:01:39 +0000 (15:01 +0000)]
Fix a minor bug (ORo didn't mark that it set CR0).

Refactor how . instructions are handled.  In particular, instead of passing
the RC flag all the way up the inheritance hierarchy, just make a new tblgen
class 'DOT' which can be added to an instruction definition.

For example, instead of this:

-def AND  : XForm_6<31,  28, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
-let Defs = [CR0] in
-def ANDo : XForm_6<31,  28, 1, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
-                   "and. $rA, $rS, $rB">;

We now have this:

+def AND  : XForm_6<31,  28, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
                    "and $rA, $rS, $rB">;

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

19 years agohmm, should probably change addImm() to take 64-bit arguments one day anyway.
Duraid Madina [Mon, 11 Apr 2005 07:16:39 +0000 (07:16 +0000)]
hmm, should probably change addImm() to take 64-bit arguments one day anyway.

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

19 years agorename addU64Imm() to addImm64()
Duraid Madina [Mon, 11 Apr 2005 07:14:41 +0000 (07:14 +0000)]
rename addU64Imm() to addImm64()

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

19 years agoAdd recording variants of ISD::AND and ISD::OR. This kills almost 1000
Nate Begeman [Mon, 11 Apr 2005 06:34:10 +0000 (06:34 +0000)]
Add recording variants of ISD::AND and ISD::OR.  This kills almost 1000
(1.5%) instructions in 186.crafty

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

19 years agoassorted fixes:
Duraid Madina [Mon, 11 Apr 2005 05:55:56 +0000 (05:55 +0000)]
assorted fixes:

  * clean up immediates (we use 14, 22 and 64 bit immediates now. sane.)
  * fold r0/f0/f1 registers into comparisons against 0/0.0/1.0
  * fix nasty thinko - didn't use two-address form of conditional add
    for extending bools to integers, so occasionally there would be
    garbage in the result. it's amazing how often zeros are just
    sitting around in registers ;) - this should fix a bunch of tests.

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

19 years agoEnsure that the arguments passed to sys::Program::ExecuteAndWait include
Reid Spencer [Mon, 11 Apr 2005 05:48:04 +0000 (05:48 +0000)]
Ensure that the arguments passed to sys::Program::ExecuteAndWait include
the program name as the first argument. Thanks go to Markus Oberhumer for
noticing this problem.

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

19 years agoEliminate tabs
Jeff Cohen [Mon, 11 Apr 2005 03:44:22 +0000 (03:44 +0000)]
Eliminate tabs

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

19 years agoEliminate major source of VC++ "possible loss of data" warnings.
Jeff Cohen [Mon, 11 Apr 2005 03:38:28 +0000 (03:38 +0000)]
Eliminate major source of VC++ "possible loss of data" warnings.

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

19 years agoFix libcall code to not pass a NULL Chain to LowerCallTo
Nate Begeman [Mon, 11 Apr 2005 03:01:51 +0000 (03:01 +0000)]
Fix libcall code to not pass a NULL Chain to LowerCallTo
Fix libcall code to not crash or assert looking for an ADJCALLSTACKUP node
  when it is known that there is no ADJCALLSTACKDOWN to match.
Expand i64 multiply when ISD::MULHU is legal for the target.

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

19 years agoDon't bother sign/zext_inreg'ing the result of an and operation if we know
Chris Lattner [Sun, 10 Apr 2005 23:37:16 +0000 (23:37 +0000)]
Don't bother sign/zext_inreg'ing the result of an and operation if we know
the result does change as a result of the extend.

This improves codegen for Alpha on this testcase:

int %a(ushort* %i) {
        %tmp.1 = load ushort* %i
        %tmp.2 = cast ushort %tmp.1 to int
        %tmp.4 = and int %tmp.2, 1
        ret int %tmp.4
}

Generating:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        ret $31,($26),1

instead of:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        addl $0,0,$0
        ret $31,($26),1

btw, alpha really should switch to livein/outs for args :)

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

19 years agoTeach legalize to deal with targets that don't support some SEXTLOAD/ZEXTLOADs
Chris Lattner [Sun, 10 Apr 2005 22:54:25 +0000 (22:54 +0000)]
Teach legalize to deal with targets that don't support some SEXTLOAD/ZEXTLOADs

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

19 years agoThe first argument to ExecuteAndWait should be the program name, but pointed
Chris Lattner [Sun, 10 Apr 2005 20:59:38 +0000 (20:59 +0000)]
The first argument to ExecuteAndWait should be the program name, but pointed
out by Markus F.X.J. Oberhumer.

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

19 years agofix this testcase so the regex doesn't match the function name
Chris Lattner [Sun, 10 Apr 2005 20:45:35 +0000 (20:45 +0000)]
fix this testcase so the regex doesn't match the function name

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

19 years agodon't zextload fp values!
Chris Lattner [Sun, 10 Apr 2005 17:40:35 +0000 (17:40 +0000)]
don't zextload fp values!

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

19 years ago* store immediate values as int64_t, not int. come on, we should be happy
Duraid Madina [Sun, 10 Apr 2005 09:18:55 +0000 (09:18 +0000)]
* store immediate values as int64_t, not int. come on, we should be happy
when there are immediates, let's not worry about the memory overhead of
this :)

* add addU64Imm(uint64_t val) to machineinstrbuilder

(seriously: this seems required to support 64-bit immediates cleanly. if it
_really_ gets on your nerves, feel free to pull it out ;) )

coming up next week: "all your floating point constants are belong to us"

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

19 years agoFix another fixme: factor out the constant fp generation code.
Nate Begeman [Sun, 10 Apr 2005 06:06:10 +0000 (06:06 +0000)]
Fix another fixme: factor out the constant fp generation code.

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

19 years agoFix 64 bit argument loading that straddles the args in regs / args on stack
Nate Begeman [Sun, 10 Apr 2005 05:53:14 +0000 (05:53 +0000)]
Fix 64 bit argument loading that straddles the args in regs / args on stack
boundary.

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

19 years agoUntil we have a dag combiner, promote using zextload's instead of extloads.
Chris Lattner [Sun, 10 Apr 2005 04:33:47 +0000 (04:33 +0000)]
Until we have a dag combiner, promote using zextload's instead of extloads.
This gives the optimizer a bit of information about the top-part of the
value.

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

19 years agoFold zext_inreg(zextload), likewise for sext's
Chris Lattner [Sun, 10 Apr 2005 04:33:08 +0000 (04:33 +0000)]
Fold zext_inreg(zextload), likewise for sext's

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

19 years agoadd a simple xform
Chris Lattner [Sun, 10 Apr 2005 04:04:49 +0000 (04:04 +0000)]
add a simple xform

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

19 years agoRemove unnecessary Implicit Defs. Since r0 is not in allocation, we do not
Nate Begeman [Sun, 10 Apr 2005 03:59:42 +0000 (03:59 +0000)]
Remove unnecessary Implicit Defs.  Since r0 is not in allocation, we do not
have to inform the register allocator it might be stepped on.

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

19 years agomake this harder
Chris Lattner [Sun, 10 Apr 2005 03:18:18 +0000 (03:18 +0000)]
make this harder

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

19 years agooops add ~
Chris Lattner [Sun, 10 Apr 2005 03:07:25 +0000 (03:07 +0000)]
oops add ~

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

19 years agonew testcase for previously unsupported unary complex operators
Chris Lattner [Sun, 10 Apr 2005 03:06:27 +0000 (03:06 +0000)]
new testcase for previously unsupported unary complex operators

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

19 years agoMake sure that BRCOND branches can be converted into long branches too.
Nate Begeman [Sun, 10 Apr 2005 01:48:29 +0000 (01:48 +0000)]
Make sure that BRCOND branches can be converted into long branches too.

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

19 years agoDon't hand ISD::CALL nodes off to SelectExprFP. This fixes siod.
Nate Begeman [Sun, 10 Apr 2005 01:14:13 +0000 (01:14 +0000)]
Don't hand ISD::CALL nodes off to SelectExprFP.  This fixes siod.

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

19 years agoFix a thinko. If the operand is promoted, pass the promoted value into
Chris Lattner [Sun, 10 Apr 2005 01:13:15 +0000 (01:13 +0000)]
Fix a thinko.  If the operand is promoted, pass the promoted value into
the new zero extend, not the original operand.  This fixes cast bool -> long
on ppc.

Add an unrelated fixme

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

19 years agorename getPPCOpcodeForSetCCNumber -> getPPCOpcodeForSetCCOpode to be more
Chris Lattner [Sun, 10 Apr 2005 01:03:31 +0000 (01:03 +0000)]
rename getPPCOpcodeForSetCCNumber -> getPPCOpcodeForSetCCOpode to be more
correct.  Remove the EmitComparison retvalue, as it is always the first arg.

Fix a place where we incorrectly passed in the setcc opcode instead of the
setcc number, causing us to miscompile crafty.  Crafty now works!

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

19 years agofix ISD::BRCONDTWOWAY codegen to not deference the end() iterator
Nate Begeman [Sat, 9 Apr 2005 23:35:05 +0000 (23:35 +0000)]
fix ISD::BRCONDTWOWAY codegen to not deference the end() iterator

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

19 years agoFix CodeGen/Generic/2005-05-09-GlobalInPHI.ll, which was reduced from 254.gap.
Chris Lattner [Sat, 9 Apr 2005 22:05:17 +0000 (22:05 +0000)]
Fix CodeGen/Generic/2005-05-09-GlobalInPHI.ll, which was reduced from 254.gap.
This caused the "use before a def" assertion on some programs.

With this patch, 254.gap now passes with the PPC backend.

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

19 years agonew testcase that used to crash the ppc fe. It could effect any simpleisel
Chris Lattner [Sat, 9 Apr 2005 22:03:10 +0000 (22:03 +0000)]
new testcase that used to crash the ppc fe.  It could effect any simpleisel
that is not careful, so I'm checking it into the generic tests.

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

19 years agoadd a little peephole optimization. This allows us to codegen:
Chris Lattner [Sat, 9 Apr 2005 21:43:54 +0000 (21:43 +0000)]
add a little peephole optimization.  This allows us to codegen:

int a(short i) {
        return i & 1;
}

as

_a:
        andi. r3, r3, 1
        blr

instead of:

_a:
        rlwinm r2, r3, 0, 16, 31
        andi. r3, r2, 1
        blr

on ppc.  It should also help the other risc targets.

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

19 years agodo not set the root to null if an argument is dead
Chris Lattner [Sat, 9 Apr 2005 21:23:24 +0000 (21:23 +0000)]
do not set the root to null if an argument is dead

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

19 years agoAdd rlwnm instruction for variable rotate
Nate Begeman [Sat, 9 Apr 2005 20:09:12 +0000 (20:09 +0000)]
Add rlwnm instruction for variable rotate
Generate rotate left/right immediate
Generate code for brcondtwoway
Use new livein/liveout functionality

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

19 years agoFix a crash on 173.applu by asking for a constant bigger than 32-bits.
Chris Lattner [Sat, 9 Apr 2005 19:47:21 +0000 (19:47 +0000)]
Fix a crash on 173.applu by asking for a constant bigger than 32-bits.

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

19 years agoSwitch this instruction selector over to using liveins and liveouts, eliminating
Chris Lattner [Sat, 9 Apr 2005 16:32:30 +0000 (16:32 +0000)]
Switch this instruction selector over to using liveins and liveouts, eliminating
implicit defs on entry to the function.  yaay :)

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

19 years agothere is no need to remove this instruction, linscan does it already as it
Chris Lattner [Sat, 9 Apr 2005 16:24:20 +0000 (16:24 +0000)]
there is no need to remove this instruction, linscan does it already as it
removes noop moves.

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

19 years agoAdjust live intervals to support a livein set
Chris Lattner [Sat, 9 Apr 2005 16:17:50 +0000 (16:17 +0000)]
Adjust live intervals to support a livein set

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

19 years agoUse live out sets for return values instead of imp_defs, which is cleaner and faster.
Chris Lattner [Sat, 9 Apr 2005 15:23:56 +0000 (15:23 +0000)]
Use live out sets for return values instead of imp_defs, which is cleaner and faster.

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

19 years agoConsider the livein/out set for a function, allowing targets to not have to
Chris Lattner [Sat, 9 Apr 2005 15:23:25 +0000 (15:23 +0000)]
Consider the livein/out set for a function, allowing targets to not have to
use ugly imp_def/imp_uses for arguments and return values.

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

19 years agoadd routines to track the livein/out set for a function
Chris Lattner [Sat, 9 Apr 2005 15:22:53 +0000 (15:22 +0000)]
add routines to track the livein/out set for a function

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

19 years agook, the "ia64 has a boatload of registers" joke stopped being funny today ;)
Duraid Madina [Sat, 9 Apr 2005 11:53:00 +0000 (11:53 +0000)]
ok, the "ia64 has a boatload of registers" joke stopped being funny today ;)

  * fix overallocation of integer (stacked) registers: we can't allocate
  registers for local use if they are required as output registers

this fixes 'toast' in the test suite, and all sorts of larger programs
like bzip2 etc.

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

19 years agoOptimize FSEL a bit for fneg arguments. This fixes the recently added test
Nate Begeman [Sat, 9 Apr 2005 09:33:07 +0000 (09:33 +0000)]
Optimize FSEL a bit for fneg arguments.  This fixes the recently added test
case so that we emit

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fsel f1, f1, f3, f2
        blr

instead of:

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fneg f0, f1
        fneg f0, f0
        fsel f1, f0, f3, f2
        blr

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

19 years agoAdd a testcase to make sure that we don't emit two fneg instructions back
Nate Begeman [Sat, 9 Apr 2005 09:30:09 +0000 (09:30 +0000)]
Add a testcase to make sure that we don't emit two fneg instructions back
to back for certain fsel instructions.

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

19 years agoAdd cases to cover the rest of the patterns we should be matching
Nate Begeman [Sat, 9 Apr 2005 08:29:59 +0000 (08:29 +0000)]
Add cases to cover the rest of the patterns we should be matching

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

19 years agoFix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
Chris Lattner [Sat, 9 Apr 2005 06:27:14 +0000 (06:27 +0000)]
Fix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
lets hope this doesn't break other programs with induced entropy

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

19 years agoNew testcase that the sparc backend crashes on
Chris Lattner [Sat, 9 Apr 2005 06:26:27 +0000 (06:26 +0000)]
New testcase that the sparc backend crashes on

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

19 years agorecognize some patterns as fabs operations, so that fabs at the source level
Chris Lattner [Sat, 9 Apr 2005 05:15:53 +0000 (05:15 +0000)]
recognize some patterns as fabs operations, so that fabs at the source level
is deconstructed then reconstructed here.  This catches 19 fabs's in 177.mesa
9 in 168.wupwise, 5 in 171.swim, 3 in 172.mgrid, and 14 in 173.applu out of
specfp2000.

This allows the X86 code generator to make MUCH better code than before for
each of these and saves one instr on ppc.

This depends on the previous CFE patch to expose these correctly.

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

19 years agomake this test more interesting
Chris Lattner [Sat, 9 Apr 2005 04:55:14 +0000 (04:55 +0000)]
make this test more interesting

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

19 years agoadd a test for fnabs
Chris Lattner [Sat, 9 Apr 2005 04:03:16 +0000 (04:03 +0000)]
add a test for fnabs

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

19 years agoadd a partial test for the fma operations that ppc supports. I'm sure I'm
Chris Lattner [Sat, 9 Apr 2005 04:01:32 +0000 (04:01 +0000)]
add a partial test for the fma operations that ppc supports.  I'm sure I'm
missing some and not all of these match yet, but I'm sure that Nate will
clean up my mess :)

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

19 years agoEmit BRCONDTWOWAY when possible.
Chris Lattner [Sat, 9 Apr 2005 03:30:29 +0000 (03:30 +0000)]
Emit BRCONDTWOWAY when possible.

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

19 years agoLegalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.
Chris Lattner [Sat, 9 Apr 2005 03:30:19 +0000 (03:30 +0000)]
Legalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.

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

19 years agoprint and fold BRCONDTWOWAY correctly
Chris Lattner [Sat, 9 Apr 2005 03:27:28 +0000 (03:27 +0000)]
print and fold BRCONDTWOWAY correctly

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

19 years agoThis target does not support/want ISD::BRCONDTWOWAY
Chris Lattner [Sat, 9 Apr 2005 03:22:37 +0000 (03:22 +0000)]
This target does not support/want ISD::BRCONDTWOWAY

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

19 years agoThis target does not yet support ISD::BRCONDTWOWAY
Chris Lattner [Sat, 9 Apr 2005 03:22:30 +0000 (03:22 +0000)]
This target does not yet support ISD::BRCONDTWOWAY

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

19 years agoAdd a new node
Chris Lattner [Sat, 9 Apr 2005 03:21:50 +0000 (03:21 +0000)]
Add a new node

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

19 years ago64b: Expand S/UREM
Nate Begeman [Sat, 9 Apr 2005 03:05:51 +0000 (03:05 +0000)]
64b: Expand S/UREM
32b: No longer pattern match fneg(fsub(fmul)) as fnmsub
     Pattern match fsub a, mul(b, c) as fnmsub
     Pattern match fadd a, mul(b, c) as fmadd
Those changes speed up hydro2d by 2.5%, distray by 6%, and scimark by 8%

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

19 years agocanonicalize a bunch of operations involving fneg
Chris Lattner [Sat, 9 Apr 2005 03:02:46 +0000 (03:02 +0000)]
canonicalize a bunch of operations involving fneg

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