Commit Graph

26538 Commits

Author SHA1 Message Date
Chris Lattner ab33d350a7 Add a note that we should match rlwnm better
llvm-svn: 30508
2006-09-20 03:59:25 +00:00
Chris Lattner 601b86513d 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 875ea0cdbd 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 cd3f6ff0e5 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 453280b94d 80 col.
llvm-svn: 30504
2006-09-20 01:10:02 +00:00
Evan Cheng 9de003670f Allow PatFrag to be a leaf node.
llvm-svn: 30498
2006-09-19 19:08:04 +00:00
Evan Cheng 00b2848adb Add result of a Xform to isel queue.
llvm-svn: 30497
2006-09-19 18:40:15 +00:00
Andrew Lenharth 4f339bebb0 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
llvm-svn: 30496
2006-09-19 18:24:51 +00:00
Andrew Lenharth 731f2d52a3 Inspired by the linux kernel, the more we keep adds in the pointer realm, the better pointer analysis works.
llvm-svn: 30495
2006-09-19 18:23:39 +00:00
Chris Lattner 698000b0da 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!

llvm-svn: 30494
2006-09-19 18:02:01 +00:00
Rafael Espindola fa7217f970 fix header
add comments
untabify

llvm-svn: 30486
2006-09-19 16:41:40 +00:00
Rafael Espindola f7d4a9900c Implement a MachineFunctionPass to fix the mul instruction
llvm-svn: 30485
2006-09-19 15:49:25 +00:00
Chris Lattner dc892c6221 number test right
llvm-svn: 30484
2006-09-19 06:19:19 +00:00
Chris Lattner b94df039c0 item done
llvm-svn: 30483
2006-09-19 06:19:03 +00:00
Chris Lattner 12f52faf93 implement select.ll:test19-22
llvm-svn: 30482
2006-09-19 06:18:21 +00:00
Chris Lattner aa0ad47e97 make this harder
llvm-svn: 30481
2006-09-19 06:17:55 +00:00
Chris Lattner db4fbdd1a6 new testcases
llvm-svn: 30480
2006-09-19 06:16:46 +00:00
Chris Lattner 3c48ea54ee 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

llvm-svn: 30479
2006-09-19 05:22:59 +00:00
Chris Lattner 5a42ebcff3 Fold extract_element(cst) to cst
llvm-svn: 30478
2006-09-19 05:02:39 +00:00
Chris Lattner 4c059f4962 Minor speedup for legalize by avoiding some malloc traffic
llvm-svn: 30477
2006-09-19 04:51:23 +00:00
Chris Lattner bea5f91946 If multiple predicates are listed, they must all pass
llvm-svn: 30476
2006-09-19 00:41:36 +00:00
Nick Lewycky 5cc1e9b51d Enable dejagnu tests for predicate simplifier.
llvm-svn: 30475
2006-09-19 00:31:54 +00:00
Evan Cheng 1fc7c363e6 Fix a typo.
llvm-svn: 30474
2006-09-18 23:28:33 +00:00
Chris Lattner bba17b9913 There!
llvm-svn: 30473
2006-09-18 22:41:07 +00:00
Chris Lattner 82a73a1989 Fix Regression/TableGen/2006-09-18-LargeInt.td
llvm-svn: 30472
2006-09-18 22:28:27 +00:00
Chris Lattner 165f344721 new testcase
llvm-svn: 30471
2006-09-18 22:28:07 +00:00
Evan Cheng 4bfaf0bd2c Allow i32 UDIV, SDIV, UREM, SREM to be expanded into libcalls.
llvm-svn: 30470
2006-09-18 21:49:04 +00:00
Nick Lewycky b9c5483a93 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).

llvm-svn: 30469
2006-09-18 21:09:35 +00:00
Nick Lewycky 86bda361b0 Fix findCaseDest to return null when BB is both the default dest and one
of the numeric cases.

llvm-svn: 30468
2006-09-18 20:44:37 +00:00
Andrew Lenharth f23e3bfcb2 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
llvm-svn: 30467
2006-09-18 19:44:29 +00:00
Nick Lewycky 51cb632a1b 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.

llvm-svn: 30466
2006-09-18 19:03:59 +00:00
Chris Lattner de07792595 Fix an infinite loop building the CFE
llvm-svn: 30465
2006-09-18 18:27:05 +00:00
Chris Lattner 3425123ced new testcase
llvm-svn: 30464
2006-09-18 18:07:51 +00:00
Andrew Lenharth 3aa3ad780e Jump tables on Alpha
llvm-svn: 30463
2006-09-18 18:01:03 +00:00
Andrew Lenharth 51ad73c98c oops
llvm-svn: 30462
2006-09-18 18:00:18 +00:00
Andrew Lenharth c50458fb90 absolute addresses must match pointer size
llvm-svn: 30461
2006-09-18 17:59:35 +00:00
Jim Laskey d30bba331f Sort out mangled names for globals
llvm-svn: 30460
2006-09-18 14:47:26 +00:00
Chris Lattner 67a35bbce7 Implement a trivial optzn: of vastart is never called in a function that takes
... args, remove the '...'.

This is Transforms/DeadArgElim/dead_vaargs.ll

llvm-svn: 30459
2006-09-18 07:02:31 +00:00
Chris Lattner 5c1bfd0311 new testcase
llvm-svn: 30458
2006-09-18 07:01:39 +00:00
Chris Lattner 523dbc5c19 add a note. Our 64-bit shifts are ~30% slower than gcc's
llvm-svn: 30457
2006-09-18 05:36:54 +00:00
Chris Lattner 4922a0e53f Implement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%.
llvm-svn: 30456
2006-09-18 05:27:43 +00:00
Chris Lattner 52d170fc94 new testcase
llvm-svn: 30455
2006-09-18 05:25:10 +00:00
Chris Lattner 04fb628ea6 Add support for pattern matching cast operations
llvm-svn: 30454
2006-09-18 05:17:11 +00:00
Chris Lattner 8f499f1772 fix typo
llvm-svn: 30453
2006-09-18 04:58:06 +00:00
Chris Lattner b0b8ddd175 add a helper method
llvm-svn: 30452
2006-09-18 04:54:57 +00:00
Chris Lattner 4a13d3b391 This is closer to what we really want.
llvm-svn: 30451
2006-09-18 04:54:35 +00:00
Chris Lattner 420c4bcc8d Implement Transforms/InstCombine/shift-sra.ll:test0
llvm-svn: 30450
2006-09-18 04:31:40 +00:00
Chris Lattner 00a07af638 New testcase, can be an srl instead of sra
llvm-svn: 30449
2006-09-18 04:31:18 +00:00
Chris Lattner b3f24c91b0 Rewrite shift/and/compare sequences to promote better licm of the RHS.
Use isLogicalShift/isArithmeticShift to simplify code.

llvm-svn: 30448
2006-09-18 04:22:48 +00:00
Reid Spencer 99dedf4a44 Make the LLVM Publications link point to /pubs/ since this has moved to
its own page on the LLVM web site.

llvm-svn: 30447
2006-09-17 23:05:15 +00:00