Chris Lattner
c85d92e0b7
Add support for the FUCOMIr instruction
...
llvm-svn: 12851
2004-04-12 01:39:15 +00:00
Chris Lattner
cfb7144bf1
Add two new instructions
...
llvm-svn: 12850
2004-04-12 01:38:55 +00:00
Chris Lattner
de47ad3d6f
Fix a bug in my load/cast folding patch.
...
llvm-svn: 12849
2004-04-12 00:23:04 +00:00
Chris Lattner
b3a10e244a
Adjust some comments, fix a bug in my previous patch
...
llvm-svn: 12848
2004-04-12 00:12:04 +00:00
Chris Lattner
903a90b9de
Disambiguate symbols after loop extraction so that we can diagnose a code
...
generator bug if multiple loops are extracted from a function.
llvm-svn: 12847
2004-04-11 23:52:35 +00:00
Chris Lattner
24f8b11206
On X86, casting an integer to floating point requires going through memory.
...
If the source of the cast is a load, we can just use the source memory location,
without having to create a temporary stack slot entry.
Before we code generated this:
double %int(int* %P) {
%V = load int* %P
%V2 = cast int %V to double
ret double %V2
}
into:
int:
sub %ESP, 4
mov %EAX, DWORD PTR [%ESP + 8]
mov %EAX, DWORD PTR [%EAX]
mov DWORD PTR [%ESP], %EAX
fild DWORD PTR [%ESP]
add %ESP, 4
ret
Now we produce this:
int:
mov %EAX, DWORD PTR [%ESP + 4]
fild DWORD PTR [%EAX]
ret
... which is nicer.
llvm-svn: 12846
2004-04-11 23:21:26 +00:00
Chris Lattner
09658d95d2
New testcase
...
llvm-svn: 12845
2004-04-11 23:18:30 +00:00
Chris Lattner
95cf3f8765
Implement folding of loads into floating point operations. This implements:
...
test/Regression/CodeGen/X86/fp_load_fold.llx
llvm-svn: 12844
2004-04-11 22:05:45 +00:00
Chris Lattner
319b7cf974
New testcase
...
llvm-svn: 12843
2004-04-11 22:05:16 +00:00
Chris Lattner
b611f10e74
Unify all of the code for floating point +,-,*,/ into one function
...
llvm-svn: 12842
2004-04-11 21:23:56 +00:00
Chris Lattner
3378d71a55
This implements folding of constant operands into floating point operations
...
for mul and div.
Instead of generating this:
test_divr:
fld QWORD PTR [%ESP + 4]
fld QWORD PTR [.CPItest_divr_0]
fdivrp %ST(1)
ret
We now generate this:
test_divr:
fld QWORD PTR [%ESP + 4]
fdivr QWORD PTR [.CPItest_divr_0]
ret
This code desperately needs refactoring, which will come in the next
patch.
llvm-svn: 12841
2004-04-11 21:09:14 +00:00
Chris Lattner
833d84f48a
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
69304a897c
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
dda382531e
Add some new instructions
...
llvm-svn: 12838
2004-04-11 20:24:15 +00:00
Chris Lattner
05de580cfb
New testcase
...
llvm-svn: 12837
2004-04-11 20:24:01 +00:00
Chris Lattner
a0681183b6
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
d22a1894a0
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
24592e688c
Add another variant of the testcase
...
llvm-svn: 12834
2004-04-11 19:01:35 +00:00
Chris Lattner
02a9e10e74
operator new & operator new[] do not kill any legal memory locations.
...
llvm-svn: 12833
2004-04-11 18:16:34 +00:00
Chris Lattner
015d27c877
new testcase
...
llvm-svn: 12832
2004-04-11 16:47:15 +00:00
Chris Lattner
aa1c0d5e76
Allow clients to be more efficient.
...
llvm-svn: 12831
2004-04-11 16:43:07 +00:00
Chris Lattner
ba50022f83
Make comments above APIs reflect what they should do.
...
llvm-svn: 12830
2004-04-11 16:42:50 +00:00
Chris Lattner
d0345fb4a1
New method to allow more efficient clients
...
llvm-svn: 12829
2004-04-11 16:35:30 +00:00
Chris Lattner
ca1428e01c
Fix a bug in my select transformation
...
llvm-svn: 12826
2004-04-11 01:39:19 +00:00
Chris Lattner
226ea8166e
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
777977bf2e
Update the value numbering interface.
...
llvm-svn: 12824
2004-04-10 22:33:34 +00:00
Chris Lattner
3def8f7eab
Note to self: SAVE FILES!
...
llvm-svn: 12823
2004-04-10 22:32:47 +00:00
Chris Lattner
50afdb258f
Add an interface to update value numbering
...
llvm-svn: 12822
2004-04-10 22:32:09 +00:00
Chris Lattner
96fca8de3d
Implement InstCombine/select.ll:test13*
...
llvm-svn: 12821
2004-04-10 22:21:27 +00:00
Chris Lattner
f5b834fa16
New testcases
...
llvm-svn: 12820
2004-04-10 22:21:14 +00:00
Chris Lattner
618c89d5eb
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
5def4c82ef
New testcase
...
llvm-svn: 12818
2004-04-10 22:01:27 +00:00
Chris Lattner
6d569b52ed
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
22c22de2f0
Fix spurious warning in release mode
...
llvm-svn: 12816
2004-04-10 19:15:56 +00:00
Chris Lattner
8b1122d4dc
Silence a spurious warning
...
llvm-svn: 12815
2004-04-10 18:32:01 +00:00
Chris Lattner
924b6c173c
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
f126f03878
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
d4979e2904
Fix previous patch
...
llvm-svn: 12811
2004-04-10 07:27:48 +00:00
Chris Lattner
3b211f0432
Correctly update counters
...
llvm-svn: 12810
2004-04-10 07:02:02 +00:00
Chris Lattner
6036b762f0
Add note
...
llvm-svn: 12809
2004-04-10 06:56:53 +00:00
Chris Lattner
474637518d
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
1676188024
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
ef93b4f931
New testcases
...
llvm-svn: 12806
2004-04-10 06:52:20 +00:00
Chris Lattner
697d1d7df2
Clarify interface
...
llvm-svn: 12805
2004-04-10 06:11:29 +00:00
Chris Lattner
ed37c7cac6
Create the output directory if it's not already there
...
llvm-svn: 12804
2004-04-10 06:03:22 +00:00
Chris Lattner
394f956177
Simplify cfg now eliminates all of the branches in this testcase
...
llvm-svn: 12803
2004-04-09 23:50:29 +00:00
Chris Lattner
4b9e14ef40
Another testcase
...
llvm-svn: 12802
2004-04-09 23:47:52 +00:00
Chris Lattner
5cbe216acd
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
306540a2f4
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
5b62a97808
Add testcases for harder combining cases.
...
llvm-svn: 12799
2004-04-09 23:43:48 +00:00