Commit Graph

23177 Commits

Author SHA1 Message Date
Chris Lattner 82f2ef20b6 Teach instcombine to increase the alignment of memset/memcpy/memmove when
the pointer is known to come from either a global variable, alloca or
malloc.  This allows us to compile this:

  P = malloc(28);
  memset(P, 0, 28);

into explicit stores on PPC instead of a memset call.

llvm-svn: 26577
2006-03-06 20:18:44 +00:00
Chris Lattner 01aa752a36 update file comment
llvm-svn: 26573
2006-03-06 17:58:04 +00:00
Evan Cheng a00c61932d Remove some code that doesn't make sense
llvm-svn: 26572
2006-03-06 07:31:44 +00:00
Reid Spencer 8e5da55b6d Make sure command line options are parsed before we try to add the LibPath
(-L options) to TheLinker. Problem noticed by Wink Saville.

llvm-svn: 26571
2006-03-06 06:38:19 +00:00
Evan Cheng c5c0658aa6 Remove SUnit::Priority1: it is re-calculated on demand as number of live
range to be generated.

llvm-svn: 26570
2006-03-06 06:08:54 +00:00
Chris Lattner 47639dbb93 Hoist the HazardRecognizer out of the ScheduleDAGList.cpp file to where
targets can implement them.  Make the top-down scheduler non-g5-specific.

Remove the old testing hazard recognizer.

llvm-svn: 26569
2006-03-06 00:22:00 +00:00
Chris Lattner 5733f37f17 Hoist the HazardRecognizer out of the ScheduleDAGList.cpp file to where
targets can implement them.  Make the top-down scheduler non-g5-specific.

llvm-svn: 26568
2006-03-06 00:20:29 +00:00
Chris Lattner 00b52ea8f9 Comment fixes
llvm-svn: 26567
2006-03-05 23:59:20 +00:00
Chris Lattner 80268aaeed Don't depend on the C99 copysign function, implement it ourselves.
llvm-svn: 26566
2006-03-05 23:57:58 +00:00
Chris Lattner cbde100850 new testcase I forgot to check in earlier
llvm-svn: 26565
2006-03-05 23:53:04 +00:00
Chris Lattner 2d945ba4c7 When a hazard recognizer needs noops to be inserted, do so. This represents
noops as null pointers in the instruction sequence.

llvm-svn: 26564
2006-03-05 23:51:47 +00:00
Chris Lattner b641a7cca6 add an emitnoop method
llvm-svn: 26563
2006-03-05 23:50:42 +00:00
Chris Lattner ea79d9fd73 implement TII::insertNoop
llvm-svn: 26562
2006-03-05 23:49:55 +00:00
Chris Lattner 4d9c174f3b custom lowered nodes are legal too
llvm-svn: 26561
2006-03-05 23:49:19 +00:00
Chris Lattner fbfdfd5d1c add a hook to insert a noop
llvm-svn: 26560
2006-03-05 23:48:51 +00:00
Chris Lattner fa5e1c9c26 Implement G5HazardRecognizer as a trivial thing that wants 5 cycles between
copyfromreg nodes.  Clearly useful!

llvm-svn: 26559
2006-03-05 23:13:56 +00:00
Chris Lattner e50c092b7c Add basic hazard recognizer support. noop insertion isn't complete yet though.
llvm-svn: 26558
2006-03-05 22:45:01 +00:00
Andrew Lenharth ef9aa1294a For transforms the behave differently if main goes away, add an option to prevent bugpoint from removing main
llvm-svn: 26557
2006-03-05 22:21:36 +00:00
Jeff Cohen 55e2aac24b Fix VC++ compilation error.
llvm-svn: 26554
2006-03-05 21:43:37 +00:00
Jim Laskey af25c7e4f3 Breathe some life into a comment.
llvm-svn: 26553
2006-03-05 21:20:20 +00:00
Chris Lattner 98ecb8ec61 Split the list scheduler into top-down and bottom-up pieces. The priority
function of the top-down scheduler are completely bogus currently, and
having (future) PPC specific in this file is also wrong, but this is a
small incremental step.

llvm-svn: 26552
2006-03-05 21:10:33 +00:00
Chris Lattner 1b59b09b6b Add a new scheduling type. This is, of course, a hack. Proper factoring
will come later.

llvm-svn: 26551
2006-03-05 21:08:06 +00:00
Chris Lattner 7a36d97518 Move the available queue to being inside the ListSchedule method, since it
bounds its lifetime.

llvm-svn: 26550
2006-03-05 20:21:55 +00:00
Chris Lattner 5032c32d30 add a note
llvm-svn: 26549
2006-03-05 20:00:08 +00:00
Chris Lattner bdaf4f38b5 Reinstate this now that the offending opposite xform has been removed.
llvm-svn: 26548
2006-03-05 19:53:55 +00:00
Chris Lattner c726a5c31f Do not fold (add (shl x, c1), (shl c2, c1)) -> (shl (add x, c2), c1),
we want to canonicalize the other way.

llvm-svn: 26547
2006-03-05 19:52:57 +00:00
Chris Lattner c610e62e46 print arbitrary constant pool entries
llvm-svn: 26545
2006-03-05 09:38:03 +00:00
Evan Cheng d428e22c07 Back out fold (shl (add x, c1), c2) -> (add (shl x, c2), c1<<c2) for now.
It's causing an infinite loop compiling ldecod on x86 / Darwin.

llvm-svn: 26544
2006-03-05 07:30:16 +00:00
Chris Lattner 3bc4050217 Add some simple copysign folds
llvm-svn: 26543
2006-03-05 05:30:57 +00:00
Chris Lattner 5c1ba2ac08 Codegen copysign[f] into a FCOPYSIGN node
llvm-svn: 26542
2006-03-05 05:09:38 +00:00
Chris Lattner 9c7f50376a Copysign needs to be expanded everywhere. Note that Alpha and IA64 should
implement copysign as a native op if they have it.

llvm-svn: 26541
2006-03-05 05:08:37 +00:00
Chris Lattner 7373ddbe77 Add a copysign node
llvm-svn: 26540
2006-03-05 05:06:40 +00:00
Chris Lattner c2dd7aae71 add a note for something evan noticed
llvm-svn: 26539
2006-03-05 01:15:18 +00:00
Chris Lattner 6bc98653c2 Make vector narrowing more effective, implementing
Transforms/InstCombine/vec_narrow.ll.  This add support for narrowing
extract_element(insertelement) also.

llvm-svn: 26538
2006-03-05 00:22:33 +00:00
Chris Lattner 818c54925e new testcase for vector narrowing.
llvm-svn: 26537
2006-03-05 00:21:28 +00:00
Chris Lattner 8d8b4cf63d Implemented.
llvm-svn: 26536
2006-03-04 23:33:44 +00:00
Chris Lattner f29f5204cc fold (mul (add x, c1), c2) -> (add (mul x, c2), c1*c2)
fold (shl (add x, c1), c2) -> (add (shl x, c2), c1<<c2)

This allows us to compile CodeGen/PowerPC/addi-reassoc.ll into:

_test1:
        slwi r2, r4, 4
        add r2, r2, r3
        lwz r3, 36(r2)
        blr
_test2:
        mulli r2, r4, 5
        add r2, r2, r3
        lbz r2, 11(r2)
        extsb r3, r2
        blr

instead of:

_test1:
        addi r2, r4, 2
        slwi r2, r2, 4
        add r2, r3, r2
        lwz r3, 4(r2)
        blr
_test2:
        addi r2, r4, 2
        mulli r2, r2, 5
        add r2, r3, r2
        lbz r2, 1(r2)
        extsb r3, r2
        blr

llvm-svn: 26535
2006-03-04 23:33:26 +00:00
Chris Lattner ca7e9664a7 new testcase
llvm-svn: 26534
2006-03-04 23:31:49 +00:00
Chris Lattner 3e19c23765 Fix a crash compiling Obsequi
llvm-svn: 26529
2006-03-04 21:48:01 +00:00
Chris Lattner f97c7f5dbb new testcase
llvm-svn: 26525
2006-03-04 09:35:02 +00:00
Chris Lattner 4c065091d8 Add factoring of multiplications, e.g. turning A*A+A*B into A*(A+B).
Testcase here: Transforms/Reassociate/mulfactor.ll

llvm-svn: 26524
2006-03-04 09:31:13 +00:00
Chris Lattner c9a318d8fa Add a note
llvm-svn: 26523
2006-03-04 08:44:51 +00:00
Chris Lattner adf5ec6f96 Regenerate
llvm-svn: 26522
2006-03-04 07:53:41 +00:00
Chris Lattner a33bcff313 Don't use invalidated iterators!
llvm-svn: 26521
2006-03-04 07:53:16 +00:00
Evan Cheng c66fd44541 Add an entry
llvm-svn: 26520
2006-03-04 07:49:50 +00:00
Chris Lattner 32c01df299 Canonicalize (X+C1)*C2 -> X*C2+C1*C2
This implements Transforms/InstCombine/add.ll:test31

llvm-svn: 26519
2006-03-04 06:04:02 +00:00
Chris Lattner ba66f8e1ad new testcase
llvm-svn: 26518
2006-03-04 06:02:36 +00:00
Evan Cheng 6dc73297c3 MEMSET / MEMCPY lowering bugs: we can't issue a single WORD / DWORD version of
rep/stos and rep/mov if the count is not a constant. We could do
  rep/stosl; and $count, 3; rep/stosb
For now, I will lower them to memset / memcpy calls. We will revisit this after
a little bit experiment.

Also need to take care of the trailing bytes even if the count is a constant.
Since the max. number of trailing bytes are 3, we will simply issue loads /
stores.

llvm-svn: 26517
2006-03-04 02:48:56 +00:00
Jeff Cohen 56b4b49c69 Keep Visual Studio happy.
llvm-svn: 26516
2006-03-04 02:19:46 +00:00
Chris Lattner 071faf25e0 Be more conservative with our symbolic alias analysis. In particular,
don't assume that A[1][0] and A[0][i] can't alias.  "i" might be out of
range, or even negative.  This fixes a miscompilation of 188.ammp (which
does bad pointer tricks) with the new CFE.

Testcase here: Analysis/BasicAA/2006-03-03-BadArraySubscript.ll

llvm-svn: 26515
2006-03-04 02:06:34 +00:00
Chris Lattner 05285fbf5b new testcase
llvm-svn: 26514
2006-03-04 02:05:07 +00:00
Chris Lattner e43e5c0697 add a note
llvm-svn: 26513
2006-03-04 01:19:34 +00:00
Evan Cheng 084a102b17 Typo
llvm-svn: 26512
2006-03-04 01:12:00 +00:00
Chris Lattner efef036443 New testcase, make sure nate doesn't vanish
llvm-svn: 26511
2006-03-04 00:47:12 +00:00
Chris Lattner 5316e5d6ff Spec change: the size of a memset/memcpy/memmove is not required to be aligned
to the alignment argument.

llvm-svn: 26510
2006-03-04 00:02:10 +00:00
Jim Laskey c44f05d624 Added support for dwarf block data entries.
llvm-svn: 26509
2006-03-03 21:00:14 +00:00
Chris Lattner ae0f1512c9 Silence a warning.
llvm-svn: 26508
2006-03-03 19:34:28 +00:00
Evan Cheng 9929793411 Add another test case for instruction scheduling.
llvm-svn: 26507
2006-03-03 18:58:09 +00:00
Chris Lattner c2de4f3dc1 Unbreak autouprade of llvm.sqrt, simplify some code.
llvm-svn: 26506
2006-03-03 16:31:22 +00:00
Jim Laskey 88f0fe15a2 Adding basic structure support.
llvm-svn: 26505
2006-03-03 15:06:57 +00:00
Evan Cheng 3bf916ddd9 Add more vector NodeTypes: VSDIV, VUDIV, VAND, VOR, and VXOR.
llvm-svn: 26504
2006-03-03 07:01:07 +00:00
Evan Cheng a7fb285c60 Number of NodeTypes now exceeds 128.
llvm-svn: 26503
2006-03-03 06:58:59 +00:00
Evan Cheng 23e75f5b49 SDOperand::isOperand should not be a forwarding. It must check *this against N's operands.
llvm-svn: 26502
2006-03-03 06:42:32 +00:00
Evan Cheng 6b08ae8497 Added isOperand(N): true if this is an operand of N
llvm-svn: 26501
2006-03-03 06:24:54 +00:00
Evan Cheng 5e9a695026 A bit more tweaking
llvm-svn: 26500
2006-03-03 06:23:43 +00:00
Chris Lattner f6e846eee8 Fix pasteo
llvm-svn: 26499
2006-03-03 06:13:41 +00:00
Jeff Cohen 55c1173a6c Fix VC++ compilation errors.
llvm-svn: 26498
2006-03-03 03:25:07 +00:00
Chris Lattner 94f300d15c remove a bunch of long-dead testing code
llvm-svn: 26497
2006-03-03 02:34:28 +00:00
Chris Lattner 93e71f0b72 initial checkin of the intrinsic description file
llvm-svn: 26496
2006-03-03 02:33:15 +00:00
Chris Lattner c313d0b712 initial implementation of intrinsic parsing
llvm-svn: 26495
2006-03-03 02:32:46 +00:00
Robert Bocchino 101a959531 Implemented -quiet feature for analyze
llvm-svn: 26494
2006-03-03 02:12:04 +00:00
Evan Cheng 993e9cf26e Move #include "llvm/CodeGen/AsmPrinter.h" to top since it's the interface.
llvm-svn: 26493
2006-03-03 02:04:29 +00:00
Chris Lattner 73fbe145fd remove out of date comment
llvm-svn: 26492
2006-03-03 02:04:07 +00:00
Chris Lattner 76bc04ba5f update comment
llvm-svn: 26491
2006-03-03 01:55:49 +00:00
Chris Lattner b203355298 Split the valuetypes out of Target.td into ValueTypes.td
llvm-svn: 26490
2006-03-03 01:55:26 +00:00
Chris Lattner 8a87f5fb18 pass -Illvm/include to tblgen
llvm-svn: 26489
2006-03-03 01:54:54 +00:00
Chris Lattner 842ac68f20 Split this out of Target.td
llvm-svn: 26488
2006-03-03 01:54:11 +00:00
Chris Lattner 1edf15e48e Add support for "-Ifoo" in addition to "-I foo"
llvm-svn: 26487
2006-03-03 01:53:40 +00:00
Chris Lattner d7f6b55afa Regenerate
llvm-svn: 26486
2006-03-03 01:47:37 +00:00
Chris Lattner e7b74c5da1 add support for multiple include directories
llvm-svn: 26485
2006-03-03 01:47:14 +00:00
Chris Lattner 681ef2f083 Change this to work with renamed intrinsics.
llvm-svn: 26484
2006-03-03 01:34:17 +00:00
Chris Lattner 7f731c5db9 Upgrade this to use the new intrinsic names
llvm-svn: 26483
2006-03-03 01:31:12 +00:00
Chris Lattner ea7986aeca Make this work with renamed intrinsics.
llvm-svn: 26482
2006-03-03 01:30:23 +00:00
Chris Lattner bce2626d8a updates for recent changes
llvm-svn: 26481
2006-03-03 01:21:36 +00:00
Chris Lattner 72a269f5de mention some major changes
llvm-svn: 26480
2006-03-03 00:34:26 +00:00
Chris Lattner ad3c974a77 remove the read/write port/io intrinsics.
llvm-svn: 26479
2006-03-03 00:19:58 +00:00
Chris Lattner f7d616278e Remove these testcases. These intrinsics are going away
llvm-svn: 26478
2006-03-03 00:16:23 +00:00
Chris Lattner 0c8b259e5a Update the llvm.memset/memcpy/memmove intrinsics to reflect the recent split
into types.

llvm-svn: 26477
2006-03-03 00:07:20 +00:00
Chris Lattner 093c159efb Split memcpy/memset/memmove intrinsics into i32/i64 versions, resolving
PR709, and paving the way for future progress.

llvm-svn: 26476
2006-03-03 00:00:25 +00:00
Chris Lattner 259d680c15 Simplify the autoupgrade interface
llvm-svn: 26475
2006-03-02 23:59:12 +00:00
Chris Lattner d124535de1 Split memcpy/memset/memmove intrinsics into i32/i64 versions, resolving
PR709, and paving the way for future progress.

Significantly refactor autoupgrading code, to handle the more complex case
(where we upgrade one argument in a function), and fix some bugs in it.

Testcase here: llvm/test/Regression/Bytecode/memcpy.ll

llvm-svn: 26474
2006-03-02 23:58:40 +00:00
Chris Lattner 3c2733b090 new testcases
llvm-svn: 26473
2006-03-02 23:56:23 +00:00
Chris Lattner 9067500e2e add a note
llvm-svn: 26472
2006-03-02 22:34:38 +00:00
Evan Cheng dc41f80f70 Add a regression test for bug 478.
llvm-svn: 26471
2006-03-02 21:48:34 +00:00
Evan Cheng 4e3904f637 - Fixed some priority calculation bugs that were causing bug 478. Among them:
a predecessor appearing more than once in the operand list was counted as
  multiple predecessor; priority1 should be updated during scheduling;
  CycleBound was updated after the node is inserted into priority queue; one
  of the tie breaking condition was flipped.
- Take into consideration of two address opcodes. If a predecessor is a def&use
  operand, it should have a higher priority.
- Scheduler should also favor floaters, i.e. nodes that do not have real
  predecessors such as MOV32ri.
- The scheduling fixes / tweaks fixed bug 478:
        .text
        .align  4
        .globl  _f
_f:
        movl 4(%esp), %eax
        movl 8(%esp), %ecx
        movl %eax, %edx
        imull %ecx, %edx
        imull %eax, %eax
        imull %ecx, %ecx
        addl %eax, %ecx
        leal (%ecx,%edx,2), %eax
        ret

  It is also a slight performance win (1% - 3%) for most tests.

llvm-svn: 26470
2006-03-02 21:38:29 +00:00
Chris Lattner 85dda9a2bd Generalize the REM folding code to handle another case Nick Lewycky
pointed out: realize the AND can provide factors and look through Casts.

llvm-svn: 26469
2006-03-02 06:50:58 +00:00
Chris Lattner dad25c7f22 add a couple more cases
llvm-svn: 26468
2006-03-02 06:50:04 +00:00
Chris Lattner 3080950acb Fix a compilation error with GCC 4.1. Thanks to Vladimir Merzliakov for
pointing this out.

llvm-svn: 26467
2006-03-02 00:21:41 +00:00
Jim Laskey 862001ad75 Support for enumerations.
llvm-svn: 26466
2006-03-01 23:52:37 +00:00
Chris Lattner c652c30772 testcase that crashed the new CFE
llvm-svn: 26465
2006-03-01 22:45:12 +00:00
Evan Cheng 38d5e768b2 Don't print llvm constant in assmebly file. Assembler won't like comments that
span multiple lines.

llvm-svn: 26463
2006-03-01 22:18:09 +00:00
Evan Cheng 5b19a80321 Back out my last check-in. Wrong place to fix it.
llvm-svn: 26462
2006-03-01 22:17:00 +00:00
Evan Cheng 302bdb586f AsmWriter should not print LLVM constant in comment. Assembler won't like
multi-line comments.

llvm-svn: 26461
2006-03-01 22:00:59 +00:00
Chris Lattner 0db2f2c689 Fix CodeGen/Generic/2006-03-01-dagcombineinfloop.ll, an infinite loop
in the dag combiner on 176.gcc on x86.

llvm-svn: 26459
2006-03-01 21:47:21 +00:00
Chris Lattner 4a6d29d008 new testcase
llvm-svn: 26458
2006-03-01 21:46:53 +00:00
Jim Laskey a63009c745 Remove extra comma from enum list.
llvm-svn: 26457
2006-03-01 20:49:44 +00:00
Jim Laskey 088ab4bab6 Remove comma from enum list.
llvm-svn: 26456
2006-03-01 20:48:20 +00:00
Jim Laskey 4e71db13d6 Switch back to using actual dwarf tags. Simplifies code without loss to other
debug forms.

llvm-svn: 26455
2006-03-01 20:39:36 +00:00
Chris Lattner 232024edb8 Fix a typo evan noticed
llvm-svn: 26454
2006-03-01 19:55:35 +00:00
Jim Laskey f770cf5b90 Use context and not compile unit.
llvm-svn: 26453
2006-03-01 18:20:30 +00:00
Jim Laskey 1246d5c054 I guess I can handle large type sizes.
llvm-svn: 26452
2006-03-01 18:13:05 +00:00
Jim Laskey b9ac4cba66 Basic array support.
llvm-svn: 26451
2006-03-01 17:53:02 +00:00
Chris Lattner 60a60f4b1e Implement CodeGen/PowerPC/or-addressing-mode.ll, which is also PR668.
llvm-svn: 26450
2006-03-01 07:14:48 +00:00
Chris Lattner 0454b2d080 load (x|y) -> load (x+y) iff x and y have no common bits.
llvm-svn: 26449
2006-03-01 07:13:56 +00:00
Chris Lattner 3cb349a068 add a note
llvm-svn: 26448
2006-03-01 06:36:20 +00:00
Chris Lattner 27f5345b1f Compile this:
void foo(float a, int *b) { *b = a; }

to this:

_foo:
        fctiwz f0, f1
        stfiwx f0, 0, r4
        blr

instead of this:

_foo:
        fctiwz f0, f1
        stfd f0, -8(r1)
        lwz r2, -4(r1)
        stw r2, 0(r4)
        blr

This implements CodeGen/PowerPC/stfiwx.ll, and also incidentally does the
right thing for GCC bugzilla 26505.

llvm-svn: 26447
2006-03-01 05:50:56 +00:00
Chris Lattner 160cc92461 new testcase. These functions shouldn't touch the stack if stfiwx use
is enabled.

llvm-svn: 26446
2006-03-01 05:49:05 +00:00
Chris Lattner f418435819 Use a target-specific dag-combine to implement CodeGen/PowerPC/fp-int-fp.ll.
llvm-svn: 26445
2006-03-01 04:57:39 +00:00
Chris Lattner 21d44e6dfe new testcase. There should be no accesses to the stack for these functions.
llvm-svn: 26444
2006-03-01 04:56:33 +00:00
Chris Lattner bc1c85beea Add support for target-specific dag combines
llvm-svn: 26443
2006-03-01 04:53:38 +00:00
Chris Lattner 4a2eeea671 Add interfaces for targets to provide target-specific dag combiner optimizations.
llvm-svn: 26442
2006-03-01 04:52:55 +00:00
Chris Lattner fbcd62d3bb Add a new AddToWorkList method, start using it
llvm-svn: 26441
2006-03-01 04:03:14 +00:00
Chris Lattner 324871ef1a Pull shifts by a constant through multiplies (a form of reassociation),
implementing Regression/CodeGen/X86/mul-shift-reassoc.ll

llvm-svn: 26440
2006-03-01 03:44:24 +00:00
Chris Lattner e8ddd8a72f new testcase
llvm-svn: 26439
2006-03-01 03:43:38 +00:00
Evan Cheng 1926427351 Vector op lowering.
llvm-svn: 26438
2006-03-01 01:11:20 +00:00
Evan Cheng 53a2d60bca New vector type v2f32.
llvm-svn: 26437
2006-03-01 01:10:52 +00:00
Evan Cheng b97aab4371 Vector ops lowering.
llvm-svn: 26436
2006-03-01 01:09:54 +00:00
Evan Cheng 91c574b642 New type v2f32.
llvm-svn: 26435
2006-03-01 01:06:22 +00:00
Evan Cheng 5dc7772620 Missing a cast previously.
llvm-svn: 26434
2006-03-01 00:58:54 +00:00
Evan Cheng 5d5f6f3e32 - Added v2f32, not used by any target currently. Only for testing purpose.
- Minor bug fix.

llvm-svn: 26433
2006-03-01 00:55:26 +00:00
Evan Cheng be85e89ec4 - Added VConstant as an abstract version of ConstantVec.
- All abstrct vector nodes must have # of elements and element type as their
first two operands.

llvm-svn: 26432
2006-03-01 00:51:13 +00:00
Evan Cheng 2a78abd411 Add a test case for left shift by 1. We should not be using lea for this.
llvm-svn: 26431
2006-02-28 23:57:45 +00:00
Evan Cheng 0e69f45b07 Another entry.
llvm-svn: 26430
2006-02-28 23:38:49 +00:00
Evan Cheng 990c3602bd Don't match x << 1 to LEAL. It's better to emit x + x.
llvm-svn: 26429
2006-02-28 21:13:57 +00:00
Jim Laskey 716edb9754 Add const, volatile, restrict support.
Add array of debug descriptor support.

llvm-svn: 26428
2006-02-28 20:15:07 +00:00
Chris Lattner c5b6c9a12a Fix a regression in a patch from a couple of days ago. This fixes
Transforms/InstCombine/2006-02-28-Crash.ll

llvm-svn: 26427
2006-02-28 19:47:20 +00:00
Chris Lattner 8c5f04d212 new testcase
llvm-svn: 26426
2006-02-28 19:46:56 +00:00
Chris Lattner c1fa889cde 8 spaces -> tab. Reported by Wink Saville
llvm-svn: 26425
2006-02-28 19:12:58 +00:00
Chris Lattner 408fee7ad4 evan's recent x86 isel improvements have fixed this, though not in the way
originally envisioned :)

llvm-svn: 26422
2006-02-28 16:39:56 +00:00
Chris Lattner b9f35f06bc Add a subtarget feature for the stfiwx instruction. I know the G5 has it,
but I don't know what other PPC impls do.  If someone could update the proc
table, I would appreciate it :)

llvm-svn: 26421
2006-02-28 07:08:22 +00:00
Chris Lattner d786b0e033 new testcases
llvm-svn: 26420
2006-02-28 06:54:19 +00:00
Chris Lattner f0032b350c Compile:
unsigned foo4(unsigned short *P) { return *P & 255; }
unsigned foo5(short *P) { return *P & 255; }

to:

_foo4:
        lbz r3,1(r3)
        blr
_foo5:
        lbz r3,1(r3)
        blr

not:

_foo4:
        lhz r2, 0(r3)
        rlwinm r3, r2, 0, 24, 31
        blr
_foo5:
        lhz r2, 0(r3)
        rlwinm r3, r2, 0, 24, 31
        blr

llvm-svn: 26419
2006-02-28 06:49:37 +00:00
Chris Lattner 872810da6c remove implemented item
llvm-svn: 26418
2006-02-28 06:36:04 +00:00
Chris Lattner bdbc4476d9 Fold "and (LOAD P), 255" -> zextload. This allows us to compile:
unsigned foo3(unsigned *P) { return *P & 255; }
as:
_foo3:
        lbz r3, 3(r3)
        blr

instead of:

_foo3:
        lwz r2, 0(r3)
        rlwinm r3, r2, 0, 24, 31
        blr

and:

unsigned short foo2(float a) { return a; }

as:
_foo2:
        fctiwz f0, f1
        stfd f0, -8(r1)
        lhz r3, -2(r1)
        blr

instead of:

_foo2:
        fctiwz f0, f1
        stfd f0, -8(r1)
        lwz r2, -4(r1)
        rlwinm r3, r2, 0, 16, 31
        blr

llvm-svn: 26417
2006-02-28 06:35:35 +00:00
Chris Lattner 0f8a727c49 fold (sra (sra x, c1), c2) -> (sra x, c1+c2)
llvm-svn: 26416
2006-02-28 06:23:04 +00:00
Chris Lattner b70f141893 Implement rem.ll:test[7-9] and PR712
llvm-svn: 26415
2006-02-28 05:49:21 +00:00
Chris Lattner 3059128d02 new testcases for PR712
llvm-svn: 26414
2006-02-28 05:48:56 +00:00
Chris Lattner 2a7c7b8bab Simplify some code now that the RHS of a rem can't be 0
llvm-svn: 26413
2006-02-28 05:40:55 +00:00
Chris Lattner 626f96431b new testcase
llvm-svn: 26412
2006-02-28 05:30:48 +00:00
Chris Lattner 0de4a8d7b7 Rearrange some code, fold "rem X, 0", implementing rem.ll:test6
llvm-svn: 26411
2006-02-28 05:30:45 +00:00
Chris Lattner 9fed5b6122 Add support for output memory constraints.
llvm-svn: 26410
2006-02-27 23:45:39 +00:00
Jim Laskey 6d5c2a0156 Qualify dwarf namespace inside llvm namespace.
llvm-svn: 26409
2006-02-27 22:37:23 +00:00
Nate Begeman f918ed2e33 readme updates
llvm-svn: 26405
2006-02-27 22:08:36 +00:00
Jim Laskey bc7a3832e8 Partial enabling of functions.
llvm-svn: 26404
2006-02-27 20:37:42 +00:00
Chris Lattner ec185f7843 Don't print constant initializers, they may span lines now.
llvm-svn: 26403
2006-02-27 20:09:23 +00:00
Jim Laskey 72b66d6d8a Supporting multiple compile units.
llvm-svn: 26402
2006-02-27 17:27:12 +00:00
Jim Laskey 22e47b9f4e Re-orging file.
llvm-svn: 26401
2006-02-27 12:43:29 +00:00
Jim Laskey 6be3d8e0df Pretty print large struct constants.
llvm-svn: 26400
2006-02-27 10:33:53 +00:00
Jim Laskey 8f2c1021b4 Removed dependency on how operands are printed (want multi-line.)
llvm-svn: 26399
2006-02-27 10:29:04 +00:00
Chris Lattner d87ea46887 Use -emit-llvm -S to get .ll file output from llvm-gcc
llvm-svn: 26397
2006-02-27 05:39:00 +00:00
Chris Lattner c7bfed0f7b 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
llvm-svn: 26396
2006-02-27 02:38:23 +00:00
Chris Lattner a8bd74d5d0 new testcases
llvm-svn: 26395
2006-02-27 02:36:19 +00:00
Chris Lattner f5c8a0b83f Fold (A^B) == A -> B == 0
and  (A-B) == A  ->  B == 0

llvm-svn: 26394
2006-02-27 01:44:11 +00:00
Chris Lattner 7422e470f3 New testcases
llvm-svn: 26393
2006-02-27 01:43:02 +00:00
Chris Lattner ab8164042a Implement bit propagation through sub nodes, this (re)implements
PowerPC/div-2.ll

llvm-svn: 26392
2006-02-27 01:00:42 +00:00
Chris Lattner 3af2da1f3d Reenable this
llvm-svn: 26391
2006-02-27 01:00:12 +00:00
Chris Lattner 47ee42829d remove some completed notes
llvm-svn: 26390
2006-02-27 00:39:31 +00:00
Chris Lattner a60751dd43 Check RHS simplification before LHS simplification to avoid infinitely looping
on PowerPC/small-arguments.ll

llvm-svn: 26389
2006-02-27 00:36:27 +00:00
Chris Lattner 27220f8958 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

llvm-svn: 26388
2006-02-27 00:22:28 +00:00
Chris Lattner 255ab33177 new testcase
llvm-svn: 26387
2006-02-27 00:20:23 +00:00
Chris Lattner 118ddba929 Add a bunch of missed cases. Perhaps the most significant of which is that
assertzext produces zero bits.

llvm-svn: 26386
2006-02-26 23:36:02 +00:00
Chris Lattner f78df7c14d Fold (X|C1)^C2 -> X^(C1|C2) when possible. This implements
InstCombine/or.ll:test23.

llvm-svn: 26385
2006-02-26 19:57:54 +00:00
Chris Lattner 69c68c3c3e new testcase
llvm-svn: 26384
2006-02-26 19:55:30 +00:00
Jim Laskey 702c1d11b5 Reverting. Didn't realize some developers were embedding constants in their
target assembler code gen.

llvm-svn: 26383
2006-02-26 10:16:05 +00:00
Evan Cheng 877ab55e06 ConstantPoolIndex is now the displacement portion of the address (rather
than base).

llvm-svn: 26382
2006-02-26 09:12:34 +00:00
Evan Cheng 9f9662b86e Print ConstantPoolSDNode offset field.
llvm-svn: 26381
2006-02-26 08:36:57 +00:00
Evan Cheng 75b8783aaf Fixed ConstantPoolIndex operand asm print bug. This fixed 2005-07-17-INT-To-FP
and 2005-05-12-Int64ToFP.

llvm-svn: 26380
2006-02-26 08:28:12 +00:00
Jim Laskey 3bb7874dd3 Format large struct constants for readability.
llvm-svn: 26379
2006-02-25 12:27:03 +00:00
Evan Cheng 74de65aacd New test case: use lea for imul by some constants.
llvm-svn: 26378
2006-02-25 10:16:10 +00:00
Evan Cheng 5c1e1ca29f lea.ll is XFAIL until we implement convertToThreeAddress.
llvm-svn: 26377
2006-02-25 10:15:22 +00:00
Evan Cheng 77d86ff8fc * 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.

llvm-svn: 26376
2006-02-25 10:09:08 +00:00
Evan Cheng 1c557bfeb5 Updates.
llvm-svn: 26375
2006-02-25 10:04:07 +00:00
Evan Cheng 1fac3b3360 * 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.

llvm-svn: 26374
2006-02-25 10:02:21 +00:00
Evan Cheng e4a8b74e4f ConstantPoolIndex is now the displacement field of addressing mode.
llvm-svn: 26373
2006-02-25 09:56:50 +00:00
Evan Cheng 994700101e Added a common about the need for X86ISD::Wrapper.
llvm-svn: 26372
2006-02-25 09:55:19 +00:00
Evan Cheng ed169db8a5 Added an offset field to ConstantPoolSDNode.
llvm-svn: 26371
2006-02-25 09:54:52 +00:00
Chris Lattner b8d9667087 this fails, mark it as such
llvm-svn: 26370
2006-02-25 08:18:43 +00:00
Chris Lattner 7d01f95a57 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.

llvm-svn: 26369
2006-02-25 02:17:31 +00:00
Chris Lattner 28a0b8bec7 Remove debugging printout :)
Add a minor compile time win, no codegen change.

llvm-svn: 26368
2006-02-25 02:03:40 +00:00
Chris Lattner 525522e429 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.

llvm-svn: 26367
2006-02-25 01:51:33 +00:00
Evan Cheng 42d5ac557c Fix an obvious bug exposed when we are doing
ADD X, 4
==>
MOV32ri $X+4, ...

llvm-svn: 26366
2006-02-25 01:37:02 +00:00
Chris Lattner 7674d90fa1 Add memory printing support for PPC. Input memory operands now work with
inline asms! :)

llvm-svn: 26365
2006-02-24 20:27:40 +00:00
Chris Lattner 1d08c6534c Use the PrintAsmMemoryOperand to print addressing modes.
llvm-svn: 26364
2006-02-24 20:21:58 +00:00
Chris Lattner d0dadd73a4 Add a PrintAsmMemoryOperand method for printing addresses
llvm-svn: 26363
2006-02-24 20:21:12 +00:00
Chris Lattner 5af3fdec12 Pass all the flags to the asm printer, not just the # operands.
llvm-svn: 26362
2006-02-24 19:50:58 +00:00
Chris Lattner 2f8a794b13 rename NumOps -> NumVals to avoid shadowing a NumOps var in an outer scope.
Add support for addressing modes.

llvm-svn: 26361
2006-02-24 19:18:20 +00:00
Chris Lattner 86c51000db Refactor operand adding out to a new AddOperand method
llvm-svn: 26358
2006-02-24 18:54:03 +00:00
Chris Lattner bbc861543f add a method
llvm-svn: 26357
2006-02-24 18:53:51 +00:00
Chris Lattner b580d26e7d 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

llvm-svn: 26356
2006-02-24 18:05:58 +00:00
Jim Laskey 723d3e0746 Add pointer and reference types. Added short-term code to ignore NULL types
(to allow llvm-gcc4 to build.)

llvm-svn: 26355
2006-02-24 16:46:40 +00:00