1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
Commit Graph

26992 Commits

Author SHA1 Message Date
Nate Begeman
29f99e606d Testcase for better rotate left and mask support
llvm-svn: 30579
2006-09-22 05:49:57 +00:00
Bill Wendling
e1c45087bd Regression testcase for PR855.
llvm-svn: 30578
2006-09-22 05:34:25 +00:00
Nate Begeman
7bcce1a7f6 Fold AND and ROTL more often
llvm-svn: 30577
2006-09-22 05:01:56 +00:00
Devang Patel
b34118f8bd remove extra white spaces.
llvm-svn: 30576
2006-09-22 01:07:57 +00:00
Devang Patel
8248ba3afc Use iterative algorith to assign DFS number. This reduces
call stack depth.

llvm-svn: 30575
2006-09-22 01:05:33 +00:00
Chris Lattner
86f1992481 don't allow 'imm' or specific imms, like '1' on the LHS of a binop.
This shrinks X86GenDAGISel by ~330 lines.

llvm-svn: 30574
2006-09-21 20:46:13 +00:00
Evan Cheng
ce6a660148 Make it work for DAG combine of multi-value nodes.
llvm-svn: 30573
2006-09-21 19:04:05 +00:00
Chris Lattner
28d7124afb Fit to 80 columns.
llvm-svn: 30572
2006-09-21 18:28:27 +00:00
Jim Laskey
231343018b core corrections
llvm-svn: 30570
2006-09-21 17:35:47 +00:00
Devang Patel
5bc8dcf913 Use abstract class to facilitate dlopen() interface.
llvm-svn: 30569
2006-09-21 17:22:55 +00:00
Jim Laskey
50750cf500 Basic "in frame" alias analysis.
llvm-svn: 30568
2006-09-21 16:28:59 +00:00
Rafael Espindola
a51ec7153c more condition codes
llvm-svn: 30567
2006-09-21 13:06:26 +00:00
Rafael Espindola
4de4f87be5 if a constant can't be an immediate, add it to the constant pool
llvm-svn: 30566
2006-09-21 11:29:52 +00:00
Chris Lattner
c17b86ef22 fold (aext (and (trunc x), cst)) -> (and x, cst).
llvm-svn: 30561
2006-09-21 06:40:43 +00:00
Chris Lattner
d9fca453f1 Check the right value type. This fixes 186.crafty on x86
llvm-svn: 30560
2006-09-21 06:17:39 +00:00
Chris Lattner
ba7013ca78 implemented
llvm-svn: 30559
2006-09-21 06:14:54 +00:00
Chris Lattner
34768d5361 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

llvm-svn: 30558
2006-09-21 06:14:31 +00:00
Chris Lattner
eb12877970 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.

llvm-svn: 30557
2006-09-21 06:00:20 +00:00
Chris Lattner
437703d4c9 Fit in 80-cols
llvm-svn: 30556
2006-09-21 05:46:00 +00:00
Chris Lattner
e87cf1c708 Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll
llvm-svn: 30555
2006-09-21 05:12:20 +00:00
Chris Lattner
0ba3a4b93c new testcase
llvm-svn: 30554
2006-09-21 05:11:01 +00:00
Nick Lewycky
401794f2a7 Fix compile error.
llvm-svn: 30553
2006-09-21 02:08:31 +00:00
Nick Lewycky
2aff202559 Don't rewrite ConstantExpr::get.
llvm-svn: 30552
2006-09-21 01:05:35 +00:00
Nick Lewycky
eb301d20a6 Once we're down to "setcc type constant1, constant2", at least come up
with the right answer.

llvm-svn: 30550
2006-09-20 23:02:24 +00:00
Anton Korobeynikov
59ef7e94eb Adding codegeneration for StdCall & FastCall calling conventions
llvm-svn: 30549
2006-09-20 22:03:51 +00:00
Andrew Lenharth
ce3954cac0 Account for pseudo-ops correctly
llvm-svn: 30548
2006-09-20 20:08:52 +00:00
Chris Lattner
663748827c The DarwinAsmPrinter need not check for isDarwin. createPPCAsmPrinterPass
should create the right asmprinter subclass.

llvm-svn: 30542
2006-09-20 17:12:19 +00:00
Chris Lattner
6d66264a5f Wrap some darwin'isms with isDarwin checks.
llvm-svn: 30541
2006-09-20 17:07:15 +00:00
Nick Lewycky
99b3c50130 Use a total ordering to compare instructions.
Fixes infinite loop in resolve().

llvm-svn: 30540
2006-09-20 17:04:01 +00:00
Andrew Lenharth
cf0746ba2a simplify
llvm-svn: 30535
2006-09-20 15:37:57 +00:00
Andrew Lenharth
d12f2d614a catch constants more often
llvm-svn: 30534
2006-09-20 15:05:49 +00:00
Andrew Lenharth
054efcd85d catch another constant
llvm-svn: 30533
2006-09-20 15:04:55 +00:00
Andrew Lenharth
3be0c58274 clarify with test case
llvm-svn: 30531
2006-09-20 14:48:00 +00:00
Andrew Lenharth
2ccefe5b91 Add Note
llvm-svn: 30530
2006-09-20 14:40:01 +00:00
Jim Laskey
a46690e7de Trim the home directory from the dejagnu test
llvm-svn: 30519
2006-09-20 09:20:22 +00:00
Chris Lattner
6b434ee662 item done
llvm-svn: 30518
2006-09-20 06:41:56 +00:00
Chris Lattner
a0243b3ad3 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

llvm-svn: 30517
2006-09-20 06:41:35 +00:00
Chris Lattner
2d711ecbc2 new testcase
llvm-svn: 30516
2006-09-20 06:40:37 +00:00
Chris Lattner
f9c4e07bf7 add a note
llvm-svn: 30515
2006-09-20 06:32:10 +00:00
Chris Lattner
e78d019082 Fold the full generality of (any_extend (truncate x))
llvm-svn: 30514
2006-09-20 06:29:17 +00:00
Chris Lattner
6440707b6f 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.

llvm-svn: 30513
2006-09-20 06:19:26 +00:00
Chris Lattner
102718b1b2 This is already done
llvm-svn: 30512
2006-09-20 04:59:33 +00:00
Chris Lattner
6ddcf6bba8 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!

llvm-svn: 30511
2006-09-20 04:44:59 +00:00
Chris Lattner
4d97247875 Improve PPC64 equality comparisons like PPC32 comparisons.
llvm-svn: 30510
2006-09-20 04:33:27 +00:00
Chris Lattner
69390a3f80 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

llvm-svn: 30509
2006-09-20 04:25:47 +00:00
Chris Lattner
ee42b9ae24 Add a note that we should match rlwnm better
llvm-svn: 30508
2006-09-20 03:59:25 +00:00
Chris Lattner
3057944738 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

llvm-svn: 30507
2006-09-20 03:47:40 +00:00
Chris Lattner
644c6814ae 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

llvm-svn: 30506
2006-09-20 03:38:48 +00:00
Evan Cheng
a7347758f5 Back out Chris' last set of changes. This breaks 177.mesa and povray somehow.
llvm-svn: 30505
2006-09-20 01:39:40 +00:00
Evan Cheng
8652c13f13 80 col.
llvm-svn: 30504
2006-09-20 01:10:02 +00:00