oota-llvm.git
17 years agoFix jump tables to match gcc (and the ABI and whatnot)
Andrew Lenharth [Sun, 24 Sep 2006 19:46:56 +0000 (19:46 +0000)]
Fix jump tables to match gcc (and the ABI and whatnot)

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

17 years agoAdd support for other relocation bases to jump tables, as well as custom asm directives
Andrew Lenharth [Sun, 24 Sep 2006 19:45:58 +0000 (19:45 +0000)]
Add support for other relocation bases to jump tables, as well as custom asm directives

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

17 years agobasic jump table test
Andrew Lenharth [Sun, 24 Sep 2006 19:42:02 +0000 (19:42 +0000)]
basic jump table test

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

17 years agojump table note
Andrew Lenharth [Sun, 24 Sep 2006 13:13:10 +0000 (13:13 +0000)]
jump table note

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

17 years agoPIC jump table entries are always 32-bit. This fixes PIC jump table support on X86-64.
Evan Cheng [Sun, 24 Sep 2006 05:22:38 +0000 (05:22 +0000)]
PIC jump table entries are always 32-bit. This fixes PIC jump table support on X86-64.

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

17 years agoEnable 'predsimplify' optimization.
Nick Lewycky [Sun, 24 Sep 2006 00:08:16 +0000 (00:08 +0000)]
Enable 'predsimplify' optimization.

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

17 years agoStyle changes only. Remove dead code, fix a comment.
Nick Lewycky [Sat, 23 Sep 2006 15:13:08 +0000 (15:13 +0000)]
Style changes only. Remove dead code, fix a comment.

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

17 years agoBe far more careful when splitting a loop header, either to form a preheader
Chris Lattner [Sat, 23 Sep 2006 08:19:21 +0000 (08:19 +0000)]
Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)

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

17 years agoTeach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
Chris Lattner [Sat, 23 Sep 2006 07:40:52 +0000 (07:40 +0000)]
Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.

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

17 years agoremove misleading comment
Chris Lattner [Sat, 23 Sep 2006 06:09:45 +0000 (06:09 +0000)]
remove misleading comment

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

17 years agoadd method, correct comment
Chris Lattner [Sat, 23 Sep 2006 04:03:45 +0000 (04:03 +0000)]
add method, correct comment

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

17 years agoDelete dead code; fix 80 col violations.
Evan Cheng [Fri, 22 Sep 2006 21:43:59 +0000 (21:43 +0000)]
Delete dead code; fix 80 col violations.

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

17 years agoadd a note
Rafael Espindola [Fri, 22 Sep 2006 11:36:17 +0000 (11:36 +0000)]
add a note

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

17 years agoUse "%llvmgxx" instead of "llvm-g++".
Bill Wendling [Fri, 22 Sep 2006 07:09:01 +0000 (07:09 +0000)]
Use "%llvmgxx" instead of "llvm-g++".

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

17 years agoTestcase for better rotate left and mask support
Nate Begeman [Fri, 22 Sep 2006 05:49:57 +0000 (05:49 +0000)]
Testcase for better rotate left and mask support

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

17 years agoRegression testcase for PR855.
Bill Wendling [Fri, 22 Sep 2006 05:34:25 +0000 (05:34 +0000)]
Regression testcase for PR855.

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

17 years agoFold AND and ROTL more often
Nate Begeman [Fri, 22 Sep 2006 05:01:56 +0000 (05:01 +0000)]
Fold AND and ROTL more often

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

17 years agoremove extra white spaces.
Devang Patel [Fri, 22 Sep 2006 01:07:57 +0000 (01:07 +0000)]
remove extra white spaces.

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

17 years agoUse iterative algorith to assign DFS number. This reduces
Devang Patel [Fri, 22 Sep 2006 01:05:33 +0000 (01:05 +0000)]
Use iterative algorith to assign DFS number. This reduces
call stack depth.

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

17 years agodon't allow 'imm' or specific imms, like '1' on the LHS of a binop.
Chris Lattner [Thu, 21 Sep 2006 20:46:13 +0000 (20:46 +0000)]
don't allow 'imm' or specific imms, like '1' on the LHS of a binop.
This shrinks X86GenDAGISel by ~330 lines.

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

17 years agoMake it work for DAG combine of multi-value nodes.
Evan Cheng [Thu, 21 Sep 2006 19:04:05 +0000 (19:04 +0000)]
Make it work for DAG combine of multi-value nodes.

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

17 years agoFit to 80 columns.
Chris Lattner [Thu, 21 Sep 2006 18:28:27 +0000 (18:28 +0000)]
Fit to 80 columns.

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

17 years agocore corrections
Jim Laskey [Thu, 21 Sep 2006 17:35:47 +0000 (17:35 +0000)]
core corrections

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

17 years agoUse abstract class to facilitate dlopen() interface.
Devang Patel [Thu, 21 Sep 2006 17:22:55 +0000 (17:22 +0000)]
Use abstract class to facilitate dlopen() interface.

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

17 years agoBasic "in frame" alias analysis.
Jim Laskey [Thu, 21 Sep 2006 16:28:59 +0000 (16:28 +0000)]
Basic "in frame" alias analysis.

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

17 years agomore condition codes
Rafael Espindola [Thu, 21 Sep 2006 13:06:26 +0000 (13:06 +0000)]
more condition codes

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

17 years agoif a constant can't be an immediate, add it to the constant pool
Rafael Espindola [Thu, 21 Sep 2006 11:29:52 +0000 (11:29 +0000)]
if a constant can't be an immediate, add it to the constant pool

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

17 years agofold (aext (and (trunc x), cst)) -> (and x, cst).
Chris Lattner [Thu, 21 Sep 2006 06:40:43 +0000 (06:40 +0000)]
fold (aext (and (trunc x), cst)) -> (and x, cst).

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

17 years agoCheck the right value type. This fixes 186.crafty on x86
Chris Lattner [Thu, 21 Sep 2006 06:17:39 +0000 (06:17 +0000)]
Check the right value type.  This fixes 186.crafty on x86

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

17 years agoimplemented
Chris Lattner [Thu, 21 Sep 2006 06:14:54 +0000 (06:14 +0000)]
implemented

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

17 years agoCompile:
Chris Lattner [Thu, 21 Sep 2006 06:14:31 +0000 (06:14 +0000)]
Compile:

int %test(ulong *%tmp) {
        %tmp = load ulong* %tmp         ; <ulong> [#uses=1]
        %tmp.mask = shr ulong %tmp, ubyte 50            ; <ulong> [#uses=1]
        %tmp.mask = cast ulong %tmp.mask to ubyte
        %tmp2 = and ubyte %tmp.mask, 3          ; <ubyte> [#uses=1]
        %tmp2 = cast ubyte %tmp2 to int         ; <int> [#uses=1]
        ret int %tmp2
}

to:

_test:
        movl 4(%esp), %eax
        movl 4(%eax), %eax
        shrl $18, %eax
        andl $3, %eax
        ret

instead of:

_test:
        movl 4(%esp), %eax
        movl 4(%eax), %eax
        shrl $18, %eax
        # TRUNCATE movb %al, %al
        andb $3, %al
        movzbl %al, %eax
        ret

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

17 years agoGeneralize (zext (truncate x)) and (sext (truncate x)) folding to work when
Chris Lattner [Thu, 21 Sep 2006 06:00:20 +0000 (06:00 +0000)]
Generalize (zext (truncate x)) and (sext (truncate x)) folding to work when
the src/dst are not the same size.  This catches things like "truncate
32-bit X to 8 bits, then zext to 16", which happens a bit on X86.

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

17 years agoFit in 80-cols
Chris Lattner [Thu, 21 Sep 2006 05:46:00 +0000 (05:46 +0000)]
Fit in 80-cols

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

17 years agoFix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll
Chris Lattner [Thu, 21 Sep 2006 05:12:20 +0000 (05:12 +0000)]
Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll

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

17 years agonew testcase
Chris Lattner [Thu, 21 Sep 2006 05:11:01 +0000 (05:11 +0000)]
new testcase

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

17 years agoFix compile error.
Nick Lewycky [Thu, 21 Sep 2006 02:08:31 +0000 (02:08 +0000)]
Fix compile error.

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

17 years agoDon't rewrite ConstantExpr::get.
Nick Lewycky [Thu, 21 Sep 2006 01:05:35 +0000 (01:05 +0000)]
Don't rewrite ConstantExpr::get.

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

17 years agoOnce we're down to "setcc type constant1, constant2", at least come up
Nick Lewycky [Wed, 20 Sep 2006 23:02:24 +0000 (23:02 +0000)]
Once we're down to "setcc type constant1, constant2", at least come up
with the right answer.

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

17 years agoAdding codegeneration for StdCall & FastCall calling conventions
Anton Korobeynikov [Wed, 20 Sep 2006 22:03:51 +0000 (22:03 +0000)]
Adding codegeneration for StdCall & FastCall calling conventions

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

17 years agoAccount for pseudo-ops correctly
Andrew Lenharth [Wed, 20 Sep 2006 20:08:52 +0000 (20:08 +0000)]
Account for pseudo-ops correctly

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

17 years agoThe DarwinAsmPrinter need not check for isDarwin. createPPCAsmPrinterPass
Chris Lattner [Wed, 20 Sep 2006 17:12:19 +0000 (17:12 +0000)]
The DarwinAsmPrinter need not check for isDarwin.  createPPCAsmPrinterPass
should create the right asmprinter subclass.

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

17 years agoWrap some darwin'isms with isDarwin checks.
Chris Lattner [Wed, 20 Sep 2006 17:07:15 +0000 (17:07 +0000)]
Wrap some darwin'isms with isDarwin checks.

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

17 years agoUse a total ordering to compare instructions.
Nick Lewycky [Wed, 20 Sep 2006 17:04:01 +0000 (17:04 +0000)]
Use a total ordering to compare instructions.
Fixes infinite loop in resolve().

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

17 years agosimplify
Andrew Lenharth [Wed, 20 Sep 2006 15:37:57 +0000 (15:37 +0000)]
simplify

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

17 years agocatch constants more often
Andrew Lenharth [Wed, 20 Sep 2006 15:05:49 +0000 (15:05 +0000)]
catch constants more often

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

17 years agocatch another constant
Andrew Lenharth [Wed, 20 Sep 2006 15:04:55 +0000 (15:04 +0000)]
catch another constant

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

17 years agoclarify with test case
Andrew Lenharth [Wed, 20 Sep 2006 14:48:00 +0000 (14:48 +0000)]
clarify with test case

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

17 years agoAdd Note
Andrew Lenharth [Wed, 20 Sep 2006 14:40:01 +0000 (14:40 +0000)]
Add Note

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

17 years agoTrim the home directory from the dejagnu test
Jim Laskey [Wed, 20 Sep 2006 09:20:22 +0000 (09:20 +0000)]
Trim the home directory from the dejagnu test

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

17 years agoitem done
Chris Lattner [Wed, 20 Sep 2006 06:41:56 +0000 (06:41 +0000)]
item done

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

17 years agoCompile:
Chris Lattner [Wed, 20 Sep 2006 06:41:35 +0000 (06:41 +0000)]
Compile:
int test3(int a, int b) { return (a < 0) ? a : 0; }

to:

_test3:
        srawi r2, r3, 31
        and r3, r2, r3
        blr

instead of:

_test3:
        cmpwi cr0, r3, 1
        li r2, 0
        blt cr0, LBB2_2 ;entry
LBB2_1: ;entry
        mr r3, r2
LBB2_2: ;entry
        blr

This implements: PowerPC/select_lt0.ll:seli32_a_a

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

17 years agonew testcase
Chris Lattner [Wed, 20 Sep 2006 06:40:37 +0000 (06:40 +0000)]
new testcase

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

17 years agoadd a note
Chris Lattner [Wed, 20 Sep 2006 06:32:10 +0000 (06:32 +0000)]
add a note

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

17 years agoFold the full generality of (any_extend (truncate x))
Chris Lattner [Wed, 20 Sep 2006 06:29:17 +0000 (06:29 +0000)]
Fold the full generality of (any_extend (truncate x))

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

17 years agoTwo things:
Chris Lattner [Wed, 20 Sep 2006 06:19:26 +0000 (06:19 +0000)]
Two things:
1. teach SimplifySetCC that '(srl (ctlz x), 5) == 0' is really x != 0.
2. Teach visitSELECT_CC to use SimplifySetCC instead of calling it and
   ignoring the result.  This allows us to compile:

bool %test(ulong %x) {
  %tmp = setlt ulong %x, 4294967296
  ret bool %tmp
}

to:

_test:
        cntlzw r2, r3
        cmplwi cr0, r3, 1
        srwi r2, r2, 5
        li r3, 0
        beq cr0, LBB1_2 ;
LBB1_1: ;
        mr r3, r2
LBB1_2: ;
        blr

instead of:

_test:
        addi r2, r3, -1
        cntlzw r2, r2
        cntlzw r3, r3
        srwi r2, r2, 5
        cmplwi cr0, r2, 0
        srwi r2, r3, 5
        li r3, 0
        bne cr0, LBB1_2 ;
LBB1_1: ;
        mr r3, r2
LBB1_2: ;
        blr

This isn't wonderful, but it's an improvement.

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

17 years agoThis is already done
Chris Lattner [Wed, 20 Sep 2006 04:59:33 +0000 (04:59 +0000)]
This is already done

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

17 years agoWe went through all that trouble to compute whether it was safe to transform
Chris Lattner [Wed, 20 Sep 2006 04:44:59 +0000 (04:44 +0000)]
We went through all that trouble to compute whether it was safe to transform
this comparison, but never checked it.  Whoops, no wonder we miscompiled
177.mesa!

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

17 years agoImprove PPC64 equality comparisons like PPC32 comparisons.
Chris Lattner [Wed, 20 Sep 2006 04:33:27 +0000 (04:33 +0000)]
Improve PPC64 equality comparisons like PPC32 comparisons.

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

17 years agoTwo improvements:
Chris Lattner [Wed, 20 Sep 2006 04:25:47 +0000 (04:25 +0000)]
Two improvements:

1. Codegen this comparison:
     if (X == 0x8000)

as:

        cmplwi cr0, r3, 32768
        bne cr0, LBB1_2 ;cond_next

instead of:

        lis r2, 0
        ori r2, r2, 32768
        cmpw cr0, r3, r2
        bne cr0, LBB1_2 ;cond_next

2. Codegen this comparison:
      if (X == 0x12345678)

as:

        xoris r2, r3, 4660
        cmplwi cr0, r2, 22136
        bne cr0, LBB1_2 ;cond_next

instead of:

        lis r2, 4660
        ori r2, r2, 22136
        cmpw cr0, r3, r2
        bne cr0, LBB1_2 ;cond_next

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

17 years agoAdd a note that we should match rlwnm better
Chris Lattner [Wed, 20 Sep 2006 03:59:25 +0000 (03:59 +0000)]
Add a note that we should match rlwnm better

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

17 years agoLegalize is no longer limited to cleverness with just constant shift amounts.
Chris Lattner [Wed, 20 Sep 2006 03:47:40 +0000 (03:47 +0000)]
Legalize is no longer limited to cleverness with just constant shift amounts.
Allow it to be clever when possible and fall back to the gross code when needed.

This allows us to compile:

long long foo1(long long X, int C) {
  return X << (C|32);
}
long long foo2(long long X, int C) {
  return X << (C&~32);
}

to:
_foo1:
        rlwinm r2, r5, 0, 27, 31
        slw r3, r4, r2
        li r4, 0
        blr

        .globl  _foo2
        .align  4
_foo2:
        rlwinm r2, r5, 0, 27, 25
        subfic r5, r2, 32
        slw r3, r3, r2
        srw r5, r4, r5
        or r3, r3, r5
        slw r4, r4, r2
        blr

instead of:

_foo1:
        ori r2, r5, 32
        subfic r5, r2, 32
        addi r6, r2, -32
        srw r5, r4, r5
        slw r3, r3, r2
        slw r6, r4, r6
        or r3, r3, r5
        slw r4, r4, r2
        or r3, r3, r6
        blr

        .globl  _foo2
        .align  4
_foo2:
        rlwinm r2, r5, 0, 27, 25
        subfic r5, r2, 32
        addi r6, r2, -32
        srw r5, r4, r5
        slw r3, r3, r2
        slw r6, r4, r6
        or r3, r3, r5
        slw r4, r4, r2
        or r3, r3, r6
        blr

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

17 years agoExpand 64-bit shifts more optimally if we know that the high bit of the
Chris Lattner [Wed, 20 Sep 2006 03:38:48 +0000 (03:38 +0000)]
Expand 64-bit shifts more optimally if we know that the high bit of the
shift amount is one or zero.  For example, for:

long long foo1(long long X, int C) {
  return X << (C|32);
}

long long foo2(long long X, int C) {
  return X << (C&~32);
}

we get:

_foo1:
        movb $31, %cl
        movl 4(%esp), %edx
        andb 12(%esp), %cl
        shll %cl, %edx
        xorl %eax, %eax
        ret
_foo2:
        movb $223, %cl
        movl 4(%esp), %eax
        movl 8(%esp), %edx
        andb 12(%esp), %cl
        shldl %cl, %eax, %edx
        shll %cl, %eax
        ret

instead of:

_foo1:
        subl $4, %esp
        movl %ebx, (%esp)
        movb $32, %bl
        movl 8(%esp), %eax
        movl 12(%esp), %edx
        movb %bl, %cl
        orb 16(%esp), %cl
        shldl %cl, %eax, %edx
        shll %cl, %eax
        xorl %ecx, %ecx
        testb %bl, %bl
        cmovne %eax, %edx
        cmovne %ecx, %eax
        movl (%esp), %ebx
        addl $4, %esp
        ret
_foo2:
        subl $4, %esp
        movl %ebx, (%esp)
        movb $223, %cl
        movl 8(%esp), %eax
        movl 12(%esp), %edx
        andb 16(%esp), %cl
        shldl %cl, %eax, %edx
        shll %cl, %eax
        xorl %ecx, %ecx
        xorb %bl, %bl
        testb %bl, %bl
        cmovne %eax, %edx
        cmovne %ecx, %eax
        movl (%esp), %ebx
        addl $4, %esp
        ret

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

17 years agoBack out Chris' last set of changes. This breaks 177.mesa and povray somehow.
Evan Cheng [Wed, 20 Sep 2006 01:39:40 +0000 (01:39 +0000)]
Back out Chris' last set of changes. This breaks 177.mesa and povray somehow.

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

17 years ago80 col.
Evan Cheng [Wed, 20 Sep 2006 01:10:02 +0000 (01:10 +0000)]
80 col.

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

17 years agoAllow PatFrag to be a leaf node.
Evan Cheng [Tue, 19 Sep 2006 19:08:04 +0000 (19:08 +0000)]
Allow PatFrag to be a leaf node.

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

17 years agoAdd result of a Xform to isel queue.
Evan Cheng [Tue, 19 Sep 2006 18:40:15 +0000 (18:40 +0000)]
Add result of a Xform to isel queue.

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

17 years agoIf we have an add, do it in the pointer realm, not the int realm. This is critical...
Andrew Lenharth [Tue, 19 Sep 2006 18:24:51 +0000 (18:24 +0000)]
If we have an add, do it in the pointer realm, not the int realm.  This is critical in the linux kernel for pointer analysis correctness

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

17 years agoInspired by the linux kernel, the more we keep adds in the pointer realm, the better...
Andrew Lenharth [Tue, 19 Sep 2006 18:23:39 +0000 (18:23 +0000)]
Inspired by the linux kernel, the more we keep adds in the pointer realm, the better pointer analysis works.

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

17 years agoFix UnitTests/2005-05-12-Int64ToFP.c with llc-beta. In particular, do not
Chris Lattner [Tue, 19 Sep 2006 18:02:01 +0000 (18:02 +0000)]
Fix UnitTests/2005-05-12-Int64ToFP.c with llc-beta.  In particular, do not
allow it to go into an infinite loop, filling up the disk!

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

17 years agofix header
Rafael Espindola [Tue, 19 Sep 2006 16:41:40 +0000 (16:41 +0000)]
fix header
add comments
untabify

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

17 years agoImplement a MachineFunctionPass to fix the mul instruction
Rafael Espindola [Tue, 19 Sep 2006 15:49:25 +0000 (15:49 +0000)]
Implement a MachineFunctionPass to fix the mul instruction

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

17 years agonumber test right
Chris Lattner [Tue, 19 Sep 2006 06:19:19 +0000 (06:19 +0000)]
number test right

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

17 years agoitem done
Chris Lattner [Tue, 19 Sep 2006 06:19:03 +0000 (06:19 +0000)]
item done

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

17 years agoimplement select.ll:test19-22
Chris Lattner [Tue, 19 Sep 2006 06:18:21 +0000 (06:18 +0000)]
implement select.ll:test19-22

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

17 years agomake this harder
Chris Lattner [Tue, 19 Sep 2006 06:17:55 +0000 (06:17 +0000)]
make this harder

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

17 years agonew testcases
Chris Lattner [Tue, 19 Sep 2006 06:16:46 +0000 (06:16 +0000)]
new testcases

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

17 years agoFold the PPCISD shifts when presented with 0 inputs. This occurs for code
Chris Lattner [Tue, 19 Sep 2006 05:22:59 +0000 (05:22 +0000)]
Fold the PPCISD shifts when presented with 0 inputs.  This occurs for code
like:
long long test(long long X, int Y) {
  return 1ULL << Y;
}
long long test2(long long X, int Y) {
  return -1LL << Y;
}

which we used to compile to:

_test:
        li r2, 1
        subfic r3, r5, 32
        li r4, 0
        addi r6, r5, -32
        srw r3, r2, r3
        slw r4, r4, r5
        slw r6, r2, r6
        or r3, r4, r3
        slw r4, r2, r5
        or r3, r3, r6
        blr
_test2:
        li r2, -1
        subfic r3, r5, 32
        addi r6, r5, -32
        srw r3, r2, r3
        slw r4, r2, r5
        slw r2, r2, r6
        or r3, r4, r3
        or r3, r3, r2
        blr

Now we produce:

_test:
        li r2, 1
        addi r3, r5, -32
        subfic r4, r5, 32
        slw r3, r2, r3
        srw r4, r2, r4
        or r3, r4, r3
        slw r4, r2, r5
        blr
_test2:
        li r2, -1
        subfic r3, r5, 32
        addi r6, r5, -32
        srw r3, r2, r3
        slw r4, r2, r5
        slw r2, r2, r6
        or r3, r4, r3
        or r3, r3, r2
        blr

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

17 years agoFold extract_element(cst) to cst
Chris Lattner [Tue, 19 Sep 2006 05:02:39 +0000 (05:02 +0000)]
Fold extract_element(cst) to cst

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

17 years agoMinor speedup for legalize by avoiding some malloc traffic
Chris Lattner [Tue, 19 Sep 2006 04:51:23 +0000 (04:51 +0000)]
Minor speedup for legalize by avoiding some malloc traffic

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

17 years agoIf multiple predicates are listed, they must all pass
Chris Lattner [Tue, 19 Sep 2006 00:41:36 +0000 (00:41 +0000)]
If multiple predicates are listed, they must all pass

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

17 years agoEnable dejagnu tests for predicate simplifier.
Nick Lewycky [Tue, 19 Sep 2006 00:31:54 +0000 (00:31 +0000)]
Enable dejagnu tests for predicate simplifier.

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

17 years agoFix a typo.
Evan Cheng [Mon, 18 Sep 2006 23:28:33 +0000 (23:28 +0000)]
Fix a typo.

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

17 years agoThere!
Chris Lattner [Mon, 18 Sep 2006 22:41:07 +0000 (22:41 +0000)]
There!

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

17 years agoFix Regression/TableGen/2006-09-18-LargeInt.td
Chris Lattner [Mon, 18 Sep 2006 22:28:27 +0000 (22:28 +0000)]
Fix Regression/TableGen/2006-09-18-LargeInt.td

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

17 years agonew testcase
Chris Lattner [Mon, 18 Sep 2006 22:28:07 +0000 (22:28 +0000)]
new testcase

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

17 years agoAllow i32 UDIV, SDIV, UREM, SREM to be expanded into libcalls.
Evan Cheng [Mon, 18 Sep 2006 21:49:04 +0000 (21:49 +0000)]
Allow  i32 UDIV, SDIV, UREM, SREM to be expanded into libcalls.

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

17 years agoWalk down the dominator tree instead of the control flow graph. That means
Nick Lewycky [Mon, 18 Sep 2006 21:09:35 +0000 (21:09 +0000)]
Walk down the dominator tree instead of the control flow graph. That means
that we can't modify the CFG any more, at least not until it's possible
to update the dominator tree (PR217).

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

17 years agoFix findCaseDest to return null when BB is both the default dest and one
Nick Lewycky [Mon, 18 Sep 2006 20:44:37 +0000 (20:44 +0000)]
Fix findCaseDest to return null when BB is both the default dest and one
of the numeric cases.

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

17 years agoA pass to remove the worst of the replay trap offenders, and as a bonus, align basic...
Andrew Lenharth [Mon, 18 Sep 2006 19:44:29 +0000 (19:44 +0000)]
A pass to remove the worst of the replay trap offenders, and as a bonus, align basic blocks when it is free to do so

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

17 years agoAdd a new helper method to SwitchInst. Useful when you've got a BB from
Nick Lewycky [Mon, 18 Sep 2006 19:03:59 +0000 (19:03 +0000)]
Add a new helper method to SwitchInst. Useful when you've got a BB from
somewhere (like the dominator graph) and would like to know which case it
came from.

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

17 years agoFix an infinite loop building the CFE
Chris Lattner [Mon, 18 Sep 2006 18:27:05 +0000 (18:27 +0000)]
Fix an infinite loop building the CFE

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

17 years agonew testcase
Chris Lattner [Mon, 18 Sep 2006 18:07:51 +0000 (18:07 +0000)]
new testcase

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

17 years agoJump tables on Alpha
Andrew Lenharth [Mon, 18 Sep 2006 18:01:03 +0000 (18:01 +0000)]
Jump tables on Alpha

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

17 years agooops
Andrew Lenharth [Mon, 18 Sep 2006 18:00:18 +0000 (18:00 +0000)]
oops

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

17 years agoabsolute addresses must match pointer size
Andrew Lenharth [Mon, 18 Sep 2006 17:59:35 +0000 (17:59 +0000)]
absolute addresses must match pointer size

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

17 years agoSort out mangled names for globals
Jim Laskey [Mon, 18 Sep 2006 14:47:26 +0000 (14:47 +0000)]
Sort out mangled names for globals

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

17 years agoImplement a trivial optzn: of vastart is never called in a function that takes
Chris Lattner [Mon, 18 Sep 2006 07:02:31 +0000 (07:02 +0000)]
Implement a trivial optzn: of vastart is never called in a function that takes
... args, remove the '...'.

This is Transforms/DeadArgElim/dead_vaargs.ll

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

17 years agonew testcase
Chris Lattner [Mon, 18 Sep 2006 07:01:39 +0000 (07:01 +0000)]
new testcase

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

17 years agoadd a note. Our 64-bit shifts are ~30% slower than gcc's
Chris Lattner [Mon, 18 Sep 2006 05:36:54 +0000 (05:36 +0000)]
add a note.  Our 64-bit shifts are ~30% slower than gcc's

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

17 years agoImplement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%.
Chris Lattner [Mon, 18 Sep 2006 05:27:43 +0000 (05:27 +0000)]
Implement InstCombine/cast.ll:test31.  This speeds up 462.libquantum by 26%.

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