Commit Graph

23059 Commits

Author SHA1 Message Date
Chris Lattner
74878f4f3a Use -emit-llvm -S to get .ll file output from llvm-gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26397 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 05:39:00 +00:00
Chris Lattner
3e88a4d700 Merge two almost-identical pieces of code.
Make this code more powerful by using ComputeMaskedBits instead of looking
for an AND operand.  This lets us fold this:

int %test23(int %a) {
        %tmp.1 = and int %a, 1
        %tmp.2 = seteq int %tmp.1, 0
        %tmp.3 = cast bool %tmp.2 to int  ;; xor tmp1, 1
        ret int %tmp.3
}

into: xor (and a, 1), 1


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26396 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 02:38:23 +00:00
Chris Lattner
f76f5da19b new testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26395 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 02:36:19 +00:00
Chris Lattner
26ab9a9218 Fold (A^B) == A -> B == 0
and  (A-B) == A  ->  B == 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26394 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 01:44:11 +00:00
Chris Lattner
e047eedc04 New testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26393 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 01:43:02 +00:00
Chris Lattner
a6bc5a4d21 Implement bit propagation through sub nodes, this (re)implements
PowerPC/div-2.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26392 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 01:00:42 +00:00
Chris Lattner
71f5dfa8e9 Reenable this
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26391 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 01:00:12 +00:00
Chris Lattner
2d2536c9d7 remove some completed notes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26390 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 00:39:31 +00:00
Chris Lattner
81cd35586f Check RHS simplification before LHS simplification to avoid infinitely looping
on PowerPC/small-arguments.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26389 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 00:36:27 +00:00
Chris Lattner
5f0c658aa4 Just like we use the RHS of an AND to simplify the LHS, use the LHS to
simplify the RHS.  This allows for the elimination of many thousands of
ands from multisource, and compiles CodeGen/PowerPC/and-elim.ll:test2
into this:

_test2:
        srwi r2, r3, 1
        xori r3, r2, 40961
        blr

instead of this:

_test2:
        rlwinm r2, r3, 31, 17, 31
        xori r2, r2, 40961
        rlwinm r3, r2, 0, 16, 31
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26388 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 00:22:28 +00:00
Chris Lattner
cfdbb7caa8 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26387 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-27 00:20:23 +00:00
Chris Lattner
ec665151b8 Add a bunch of missed cases. Perhaps the most significant of which is that
assertzext produces zero bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26386 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 23:36:02 +00:00
Chris Lattner
02bd1b3e94 Fold (X|C1)^C2 -> X^(C1|C2) when possible. This implements
InstCombine/or.ll:test23.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26385 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 19:57:54 +00:00
Chris Lattner
80e2065565 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26384 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 19:55:30 +00:00
Jim Laskey
c13a72c329 Reverting. Didn't realize some developers were embedding constants in their
target assembler code gen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26383 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 10:16:05 +00:00
Evan Cheng
140a4c4868 ConstantPoolIndex is now the displacement portion of the address (rather
than base).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26382 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 09:12:34 +00:00
Evan Cheng
38b7327ec0 Print ConstantPoolSDNode offset field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26381 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 08:36:57 +00:00
Evan Cheng
a09bd8190c Fixed ConstantPoolIndex operand asm print bug. This fixed 2005-07-17-INT-To-FP
and 2005-05-12-Int64ToFP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26380 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-26 08:28:12 +00:00
Jim Laskey
a3f332bdc3 Format large struct constants for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26379 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 12:27:03 +00:00
Evan Cheng
9394514ede New test case: use lea for imul by some constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26378 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 10:16:10 +00:00
Evan Cheng
c6d80a4ecf lea.ll is XFAIL until we implement convertToThreeAddress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26377 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 10:15:22 +00:00
Evan Cheng
51a9ed9b41 * Cleaned up addressing mode matching code.
* Cleaned up and tweaked LEA cost analysis code. Removed some hacks.
* Handle ADD $X, c to MOV32ri $X+c. These patterns cannot be autogen'd and
  they need to be matched before LEA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26376 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 10:09:08 +00:00
Evan Cheng
53f280a30e Updates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26375 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 10:04:07 +00:00
Evan Cheng
71fb834b50 * Allow mul, shl nodes to be codegen'd as LEA (if appropriate).
* Add patterns to handle GlobalAddress, ConstantPool, etc.
  MOV32ri to materialize these nodes in registers.
  ADD32ri to handle %reg + GA, etc.
  MOV32mi to handle store GA, etc. to memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26374 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 10:02:21 +00:00
Evan Cheng
c4ee50c6b9 ConstantPoolIndex is now the displacement field of addressing mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26373 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 09:56:50 +00:00
Evan Cheng
bbbb2fbbde Added a common about the need for X86ISD::Wrapper.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26372 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 09:55:19 +00:00
Evan Cheng
404cb4f9fa Added an offset field to ConstantPoolSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26371 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 09:54:52 +00:00
Chris Lattner
05b53740e2 this fails, mark it as such
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26370 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 08:18:43 +00:00
Chris Lattner
28bad08411 Fix a bug that Evan exposed with some changes he's making, and that was
exposed with a fastcc problem (breaking pcompress2 on x86 with -enable-x86-fastcc).

When reloading a reused reg, make sure to invalidate the reloaded reg, and
check to see if there are any other pending uses of the same register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26369 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 02:17:31 +00:00
Chris Lattner
47cb7173ea Remove debugging printout :)
Add a minor compile time win, no codegen change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26368 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 02:03:40 +00:00
Chris Lattner
540fec6b38 Refactor some code from being inline to being out in a new class with methods.
This gets rid of two gotos, which is always nice, and also adds some comments.

No functionality change, this is just a refactor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26367 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 01:51:33 +00:00
Evan Cheng
cb4a38e75d Fix an obvious bug exposed when we are doing
ADD X, 4
==>
MOV32ri $X+4, ...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26366 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-25 01:37:02 +00:00
Chris Lattner
2c003e26e5 Add memory printing support for PPC. Input memory operands now work with
inline asms! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26365 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 20:27:40 +00:00
Chris Lattner
dd26033002 Use the PrintAsmMemoryOperand to print addressing modes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26364 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 20:21:58 +00:00
Chris Lattner
b44b509411 Add a PrintAsmMemoryOperand method for printing addresses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26363 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 20:21:12 +00:00
Chris Lattner
daf6bc6347 Pass all the flags to the asm printer, not just the # operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26362 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 19:50:58 +00:00
Chris Lattner
fd6d282a71 rename NumOps -> NumVals to avoid shadowing a NumOps var in an outer scope.
Add support for addressing modes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26361 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 19:18:20 +00:00
Chris Lattner
ed18b6896e Refactor operand adding out to a new AddOperand method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26358 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 18:54:03 +00:00
Chris Lattner
3c2da661b6 add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26357 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 18:53:51 +00:00
Chris Lattner
97f37a439c Fix a problem that Nate noticed that boils down to an over conservative check
in the code that does "select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y)))".
We now compile this loop:

LBB1_1: ; no_exit
        add r6, r2, r3
        subf r3, r2, r3
        cmpwi cr0, r2, 0
        addi r7, r5, 4
        lwz r2, 0(r5)
        addi r4, r4, 1
        blt cr0, LBB1_4 ; no_exit
LBB1_3: ; no_exit
        mr r3, r6
LBB1_4: ; no_exit
        cmpwi cr0, r4, 16
        mr r5, r7
        bne cr0, LBB1_1 ; no_exit

into this instead:

LBB1_1: ; no_exit
        srawi r6, r2, 31
        add r2, r2, r6
        xor r6, r2, r6
        addi r7, r5, 4
        lwz r2, 0(r5)
        addi r4, r4, 1
        add r3, r3, r6
        cmpwi cr0, r4, 16
        mr r5, r7
        bne cr0, LBB1_1 ; no_exit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26356 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 18:05:58 +00:00
Jim Laskey
6990600f93 Add pointer and reference types. Added short-term code to ignore NULL types
(to allow llvm-gcc4 to build.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26355 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 16:46:40 +00:00
Jeff Cohen
7e88103cde Get VC++ building again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26351 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:52:40 +00:00
Chris Lattner
0e43f2ba11 Implement (most of) selection of inline asm memory operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26350 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:13:54 +00:00
Chris Lattner
fd105d464a Select inline asm memory operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26349 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:13:31 +00:00
Chris Lattner
e5d8861126 Implement selection of inline asm memory operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26348 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:13:12 +00:00
Chris Lattner
4c12e719c9 Add some hooks for selecting memory addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26347 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 02:12:52 +00:00
Chris Lattner
87bc3bd121 Lower C_Memory operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26346 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 01:11:24 +00:00
Chris Lattner
2b7401e28e Recognize memory operand codes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26345 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 01:10:46 +00:00
Chris Lattner
5ee3e14127 Add C_Memory operand type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26344 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-24 01:10:14 +00:00
Chris Lattner
fe3db46fe0 Parse the %*# constraint modifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26341 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-23 23:36:53 +00:00