Commit Graph

11468 Commits

Author SHA1 Message Date
Chris Lattner e1efbc7c6c Restructure the mul/div/rem handling code to follow the pattern the other
instructions use.  This doesn't change any functionality except that long
constant expressions of these operations will now magically start working.

llvm-svn: 12840
2004-04-11 20:56:28 +00:00
Chris Lattner f7ed7df539 Codegen FP adds and subtracts with a constant more efficiently, generating:
fld QWORD PTR [%ESP + 4]
        fadd QWORD PTR [.CPItest_add_0]

instead of:

        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [.CPItest_add_0]
        faddp %ST(1)

I also intend to do this for mul & div, but it appears that I have to
refactor a bit of code before I can do so.

This is tested by: test/Regression/CodeGen/X86/fp_constant_op.llx

llvm-svn: 12839
2004-04-11 20:26:20 +00:00
Chris Lattner b6e0b58fbc Add some new instructions
llvm-svn: 12838
2004-04-11 20:24:15 +00:00
Chris Lattner 9affe3e7df New testcase
llvm-svn: 12837
2004-04-11 20:24:01 +00:00
Chris Lattner 5b44472200 Relax assertion to make this function work with a broader class of instructions
llvm-svn: 12836
2004-04-11 20:21:06 +00:00
Chris Lattner 3f912a6f43 Two changes:
1. If an incoming argument is dead, don't load it from the stack
  2. Do not code gen noop copies at all (ie, cast int -> uint), not even to
     a move.  This should reduce register pressure for allocators that are
     unable to coallesce away these copies in some cases.

llvm-svn: 12835
2004-04-11 19:21:59 +00:00
Chris Lattner 5ec93a8678 Add another variant of the testcase
llvm-svn: 12834
2004-04-11 19:01:35 +00:00
Chris Lattner 403abb824f operator new & operator new[] do not kill any legal memory locations.
llvm-svn: 12833
2004-04-11 18:16:34 +00:00
Chris Lattner 74e5c31746 new testcase
llvm-svn: 12832
2004-04-11 16:47:15 +00:00
Chris Lattner c5fad355f8 Allow clients to be more efficient.
llvm-svn: 12831
2004-04-11 16:43:07 +00:00
Chris Lattner 9120ff3488 Make comments above APIs reflect what they should do.
llvm-svn: 12830
2004-04-11 16:42:50 +00:00
Chris Lattner a55bf865ea New method to allow more efficient clients
llvm-svn: 12829
2004-04-11 16:35:30 +00:00
Chris Lattner 24cf0200c7 Fix a bug in my select transformation
llvm-svn: 12826
2004-04-11 01:39:19 +00:00
Chris Lattner 192e326cd3 Add a missing break, which caused a crash in an obscure situation
llvm-svn: 12825
2004-04-11 01:29:30 +00:00
Chris Lattner f16fe7206c Update the value numbering interface.
llvm-svn: 12824
2004-04-10 22:33:34 +00:00
Chris Lattner ffdfe64ced Note to self: SAVE FILES!
llvm-svn: 12823
2004-04-10 22:32:47 +00:00
Chris Lattner 8e096ddeaf Add an interface to update value numbering
llvm-svn: 12822
2004-04-10 22:32:09 +00:00
Chris Lattner 623fba1107 Implement InstCombine/select.ll:test13*
llvm-svn: 12821
2004-04-10 22:21:27 +00:00
Chris Lattner 1f99df6d27 New testcases
llvm-svn: 12820
2004-04-10 22:21:14 +00:00
Chris Lattner cf4a996cba Implement InstCombine/add.ll:test20
Canonicalize add of sign bit constant into a xor

llvm-svn: 12819
2004-04-10 22:01:55 +00:00
Chris Lattner 825a00195d New testcase
llvm-svn: 12818
2004-04-10 22:01:27 +00:00
Chris Lattner 69c4900512 Rewrite the GCSE pass to be *substantially* simpler, a bit more efficient,
and a bit more powerful

llvm-svn: 12817
2004-04-10 21:11:11 +00:00
Chris Lattner f9d9665138 Fix spurious warning in release mode
llvm-svn: 12816
2004-04-10 19:15:56 +00:00
Chris Lattner d450df05ba Silence a spurious warning
llvm-svn: 12815
2004-04-10 18:32:01 +00:00
Chris Lattner d95ef7eff0 Simplify code a bit, and fix a bug that was breaking perlbmk
llvm-svn: 12814
2004-04-10 18:06:21 +00:00
Chris Lattner 7ebfe61dc1 Fix a bug in my checkin last night that was breaking programs using invoke.
llvm-svn: 12813
2004-04-10 16:53:29 +00:00
Chris Lattner 5093213c40 Fix previous patch
llvm-svn: 12811
2004-04-10 07:27:48 +00:00
Chris Lattner 6149ac8991 Correctly update counters
llvm-svn: 12810
2004-04-10 07:02:02 +00:00
Chris Lattner 027ccc1200 Add note
llvm-svn: 12809
2004-04-10 06:56:53 +00:00
Chris Lattner 4a1b03c773 Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory

llvm-svn: 12808
2004-04-10 06:55:27 +00:00
Chris Lattner cfa1adcdb8 Simplify code a bit, and use alias analysis to allow us to delete unused
call and invoke instructions that are known to not write to memory.

llvm-svn: 12807
2004-04-10 06:53:09 +00:00
Chris Lattner 56471868e2 New testcases
llvm-svn: 12806
2004-04-10 06:52:20 +00:00
Chris Lattner f72a30b31c Clarify interface
llvm-svn: 12805
2004-04-10 06:11:29 +00:00
Chris Lattner 5393e11318 Create the output directory if it's not already there
llvm-svn: 12804
2004-04-10 06:03:22 +00:00
Chris Lattner d777677665 Simplify cfg now eliminates all of the branches in this testcase
llvm-svn: 12803
2004-04-09 23:50:29 +00:00
Chris Lattner e4ad3e599b Another testcase
llvm-svn: 12802
2004-04-09 23:47:52 +00:00
Chris Lattner 24cd6b9371 Testcase to make sure we can apply the shift to the operands of the select,
eliminating the shifts

llvm-svn: 12801
2004-04-09 23:47:24 +00:00
Chris Lattner 56e4d3d8ad Implement select.ll:test12*
This transforms code like this:

   %C = or %A, %B
   %D = select %cond, %C, %A
into:
   %C = select %cond, %B, 0
   %D = or %A, %C

Since B is often a constant, the select can often be eliminated.  In any case,
this reduces the usage count of A, allowing subsequent optimizations to happen.

This xform applies when the operator is any of:
  add, sub, mul, or, xor, and, shl, shr

llvm-svn: 12800
2004-04-09 23:46:01 +00:00
Chris Lattner be68fd036b Add testcases for harder combining cases.
llvm-svn: 12799
2004-04-09 23:43:48 +00:00
Chris Lattner 0aa565647c Fold code like:
if (C)
    V1 |= V2;

into:
  Vx = V1 | V2;
  V1 = select C, V1, Vx

when the expression can be evaluated unconditionally and is *cheap* to
execute.  This limited form of if conversion is quite handy in lots of cases.
For example, it turns this testcase into straight-line code:

int in0 ; int in1 ; int in2 ; int in3 ;
int in4 ; int in5 ; int in6 ; int in7 ;
int in8 ; int in9 ; int in10; int in11;
int in12; int in13; int in14; int in15;
long output;

void mux(void) {
  output =
      (in0   ?  0x00000001 : 0) | (in1   ?  0x00000002 : 0) |
      (in2   ?  0x00000004 : 0) | (in3   ?  0x00000008 : 0) |
      (in4   ?  0x00000010 : 0) | (in5   ?  0x00000020 : 0) |
      (in6   ?  0x00000040 : 0) | (in7   ?  0x00000080 : 0) |
      (in8   ?  0x00000100 : 0) | (in9   ?  0x00000200 : 0) |
      (in10  ?  0x00000400 : 0) | (in11  ?  0x00000800 : 0) |
      (in12  ?  0x00001000 : 0) | (in13  ?  0x00002000 : 0) |
      (in14  ?  0x00004000 : 0) | (in15  ?  0x00008000 : 0) ;
}

llvm-svn: 12798
2004-04-09 22:50:22 +00:00
Chris Lattner 5bcb4eb13c Fix an obvious bug in the refactoring I did a few days ago
llvm-svn: 12797
2004-04-09 22:28:33 +00:00
Chris Lattner 8ffe3e0b72 Expand on adding an intrinsic. Move section to before adding an instruction
llvm-svn: 12796
2004-04-09 19:24:20 +00:00
John Criswell 2b4c96e758 Reversed the order of the llvm.writeport() operands so that the value
is listed first and the address is listed second.

llvm-svn: 12795
2004-04-09 19:09:14 +00:00
Chris Lattner 183b336a54 Fold binary operators with a constant operand into select instructions
that have a constant operand.  This implements
add.ll:test19, shift.ll:test15*, and others that are not tested

llvm-svn: 12794
2004-04-09 19:05:30 +00:00
Chris Lattner cf7baf3519 Implement select.ll:test11
llvm-svn: 12793
2004-04-09 18:19:44 +00:00
Chris Lattner 755cab25ae new testcase
llvm-svn: 12792
2004-04-09 18:19:29 +00:00
Alkis Evlogimenos 237f203ca9 Add definition list to each live interval.
llvm-svn: 12791
2004-04-09 18:07:57 +00:00
John Criswell 417228d00a Fixed some spelling.
llvm-svn: 12790
2004-04-09 16:48:45 +00:00
John Criswell aa1c3c1f23 Modified the prototypes of the llvm.readport and llvm.writeport intrinsics
so that they do not specify specific integer sizes (as those are
constrained by the code generator, not the intrinsic itself).

Also put these intrinsics into their own "Operating System" section.

llvm-svn: 12789
2004-04-09 16:43:20 +00:00
John Criswell 508b93c569 Added the llvm.readport and llvm.writeport intrinsics.
llvm-svn: 12788
2004-04-09 15:23:37 +00:00