Chris Lattner [Thu, 20 Jan 2005 20:29:23 +0000 (20:29 +0000)]
Simplify the shift-expansion code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19721
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 18:53:00 +0000 (18:53 +0000)]
Implement ADD_PARTS/SUB_PARTS so that 64-bit integer add/sub work. This
fixes most of the remaining llc-beta failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19716
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 18:52:28 +0000 (18:52 +0000)]
Expand add/sub into ADD_PARTS/SUB_PARTS instead of a non-existant libcall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19715
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 18:50:55 +0000 (18:50 +0000)]
implement add_parts/sub_parts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19714
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 18:50:39 +0000 (18:50 +0000)]
Eliminate the unimplemented ADDC/SUBB operations, add ADD_PARTS/SUB_PARTS instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19713
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 17:32:28 +0000 (17:32 +0000)]
Add missing entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19712
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 20 Jan 2005 16:50:16 +0000 (16:50 +0000)]
Fix a crash compiling 134.perl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19711
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Thu, 20 Jan 2005 05:19:40 +0000 (05:19 +0000)]
Get analyze to show all analysis options when compiled with VC++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19710
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Thu, 20 Jan 2005 04:52:59 +0000 (04:52 +0000)]
Add analyze project to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19709
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Thu, 20 Jan 2005 04:41:49 +0000 (04:41 +0000)]
Add project llvm-proj to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19708
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 22:31:21 +0000 (22:31 +0000)]
Support targets that do not use i8 shift amounts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19707
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 21:50:18 +0000 (21:50 +0000)]
Add two optimizations. The first folds (X+Y)-X -> Y
The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z))
-> (Y+(select C, X, Z)
This occurs a few times across spec, e.g.
select add/sub
mesa: 83 0
povray: 5 2
gcc 4 2
parser 0 22
perlbmk 13 30
twolf 0 3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19706
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 21:48:31 +0000 (21:48 +0000)]
Add some new tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19705
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 21:32:07 +0000 (21:32 +0000)]
Add an assertion that would have made more sense to duraid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19704
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 20:24:35 +0000 (20:24 +0000)]
Add support for targets that pass args in registers to calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19703
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 20:19:58 +0000 (20:19 +0000)]
Add an accessor for targets that pass args in regs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19702
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 19:10:54 +0000 (19:10 +0000)]
Fold single use token factor nodes into other token factor nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19701
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 18:02:17 +0000 (18:02 +0000)]
Realize the individual pieces of an expanded copytoreg/store/load are
independent of each other.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19700
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 18:01:40 +0000 (18:01 +0000)]
Know some identities about tokenfactor nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19699
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 17:29:49 +0000 (17:29 +0000)]
Know some simple identities. This improves codegen for (1LL << N).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19698
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 17:24:34 +0000 (17:24 +0000)]
Fix a problem where were were literally selecting for INCREASED register
pressure, not decreases register pressure. Fix problem where we accidentally
swapped the operands of SHLD, which caused fourinarow to fail. This fixes
fourinarow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19697
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 17:11:51 +0000 (17:11 +0000)]
Just in case, handle something that is both a use and a def.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19696
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 17:09:15 +0000 (17:09 +0000)]
When an instruction moves, make sure to update the VarInfo::Kills list as
well as all of teh other stuff in livevar. This fixes the compiler crash
on fourinarow last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19695
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 16:55:52 +0000 (16:55 +0000)]
When commuting these instructions, make sure to actually swap the operands too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19694
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 16:16:35 +0000 (16:16 +0000)]
Fix 'raise' to work with packed types. Patch by Morten Ofstad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19693
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 08:07:05 +0000 (08:07 +0000)]
Implement Regression/CodeGen/X86/rotate.ll: emit rotate instructions (which
typically cost 1 cycle) instead of shld/shrd instruction (which are typically
6 or more cycles). This also saves code space.
For example, instead of emitting:
rotr:
mov %EAX, DWORD PTR [%ESP + 4]
mov %CL, BYTE PTR [%ESP + 8]
shrd %EAX, %EAX, %CL
ret
rotli:
mov %EAX, DWORD PTR [%ESP + 4]
shrd %EAX, %EAX, 27
ret
Emit:
rotr32:
mov %CL, BYTE PTR [%ESP + 8]
mov %EAX, DWORD PTR [%ESP + 4]
ror %EAX, %CL
ret
rotli32:
mov %EAX, DWORD PTR [%ESP + 4]
ror %EAX, 27
ret
We also emit byte rotate instructions which do not have a sh[lr]d counterpart
at all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19692
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 08:04:08 +0000 (08:04 +0000)]
New testcase for rotate instructions. Each function should codegen to a
rotate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19691
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:50:03 +0000 (07:50 +0000)]
Add rotate instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19690
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:37:26 +0000 (07:37 +0000)]
Match 16-bit shld/shrd instructions as well, implementing shift-double.llx:test5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19689
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:37:01 +0000 (07:37 +0000)]
Add a test for 16-bit sh*d.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19688
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:31:24 +0000 (07:31 +0000)]
Improve coverage of the X86 instruction set by adding 16-bit shift doubles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19687
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:11:01 +0000 (07:11 +0000)]
Teach the code generator that shrd/shld is commutable if it has an immediate.
This allows us to generate this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
shld %EDX, %EDX, 2
shl %EAX, 2
ret
instead of this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
mov %EDX, %EAX
shrd %EDX, %ECX, 30
shl %EAX, 2
ret
Note the magically transmogrifying immediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19686
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 07:08:42 +0000 (07:08 +0000)]
Use the TargetInstrInfo::commuteInstruction method to commute instructions
instead of doing it manually.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19685
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 06:53:34 +0000 (06:53 +0000)]
Finegrainify namespacification
Add default impl of commuteInstruction
Add notes about ugly V9 code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19684
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 06:53:02 +0000 (06:53 +0000)]
Add a new method, described in the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19683
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 06:30:36 +0000 (06:30 +0000)]
Ensure that each these functions generates a sh[rl]d instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19682
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 06:18:43 +0000 (06:18 +0000)]
Codegen long >> 2 to this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
shrd %EAX, %EDX, 2
sar %EDX, 2
ret
instead of this:
test1:
mov %ECX, DWORD PTR [%ESP + 4]
shr %ECX, 2
mov %EDX, DWORD PTR [%ESP + 8]
mov %EAX, %EDX
shl %EAX, 30
or %EAX, %ECX
sar %EDX, 2
ret
and long << 2 to this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
*** mov %EDX, %EAX
shrd %EDX, %ECX, 30
shl %EAX, 2
ret
instead of this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, %EAX
shr %ECX, 30
mov %EDX, DWORD PTR [%ESP + 8]
shl %EDX, 2
or %EDX, %ECX
shl %EAX, 2
ret
The extra copy (marked ***) can be eliminated when I teach the code generator
that shrd32rri8 is really commutative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19681
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Wed, 19 Jan 2005 05:08:31 +0000 (05:08 +0000)]
Add missing data types for VC++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19680
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 04:19:40 +0000 (04:19 +0000)]
Implement a way of expanding shifts. This applies to targets that offer
select operations or to shifts that are by a constant. This automatically
implements (with no special code) all of the special cases for shift by 32,
shift by < 32 and shift by > 32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19679
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 03:36:30 +0000 (03:36 +0000)]
X86 shifts mask the amount.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19678
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 03:36:14 +0000 (03:36 +0000)]
Add a hook to find out how the target handles shift amounts that are out of
range. Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).
This defaults to undefined, which is conservatively correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19677
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 19 Jan 2005 03:36:03 +0000 (03:36 +0000)]
Move all data members to the end of the class.
Add a hook to find out how the target handles shift amounts that are out of
range. Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).
This defaults to undefined, which is conservatively correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19676
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 21:57:59 +0000 (21:57 +0000)]
Zero is cheaper than sign extend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19675
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 20:05:56 +0000 (20:05 +0000)]
Code to handle FP_EXTEND is dead now. X86 doesn't support any data types to
FP_EXTEND from!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19674
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 19:50:08 +0000 (19:50 +0000)]
Remove more dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19673
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 19:46:54 +0000 (19:46 +0000)]
The selection dag code handles the promotions from F32 to F64 for us, so we
don't need to even think about F32 in the X86 code anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19672
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 19:27:06 +0000 (19:27 +0000)]
Fix some fixmes (promoting bools for select and brcond), fix promotion
of zero and sign extends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19671
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 19:26:36 +0000 (19:26 +0000)]
Keep track of the retval type as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19670
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 19:26:18 +0000 (19:26 +0000)]
Keep track of the returned value type as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19669
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 17:54:55 +0000 (17:54 +0000)]
Teach legalize to promote copy(from|to)reg, instead of making the isel pass
do it. This results in better code on X86 for floats (because if strict
precision is not required, we can elide some more expensive double -> float
conversions like the old isel did), and allows other targets to emit
CopyFromRegs that are not legal for arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19668
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 17:35:28 +0000 (17:35 +0000)]
Fix 124.m88ksim.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19667
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Tue, 18 Jan 2005 05:44:50 +0000 (05:44 +0000)]
Add project llvm-ld to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19665
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Tue, 18 Jan 2005 05:44:25 +0000 (05:44 +0000)]
Add project llvm-nm to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19664
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Tue, 18 Jan 2005 05:39:37 +0000 (05:39 +0000)]
Add project llvm-ld to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19663
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Tue, 18 Jan 2005 05:31:34 +0000 (05:31 +0000)]
Add llvm-bcanalyzer project to Visual Studio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19662
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 04:18:32 +0000 (04:18 +0000)]
Do not emit loads multiple times, potentially in the wrong places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19661
91177308-0d34-0410-b5e6-
96231b3b80d8
Tanya Lattner [Tue, 18 Jan 2005 04:15:41 +0000 (04:15 +0000)]
Minor changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19660
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 04:00:54 +0000 (04:00 +0000)]
Eliminate bad assertions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19659
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 03:51:59 +0000 (03:51 +0000)]
* Eliminate the TokenSet and just use the ExprMap for both tokens and values.
* Insert some really pedantic assertions that will notice when we emit the
same loads more than one time, exposing bugs. This turns a miscompilation in
bzip2 into a compile-fail. yaay.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19658
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 02:59:52 +0000 (02:59 +0000)]
Teach legalize to promote SetCC results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19657
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 02:52:03 +0000 (02:52 +0000)]
Allow setcc operations to have nonbool types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19656
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 02:51:41 +0000 (02:51 +0000)]
Allow setcc operations to have non-bool types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19655
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 02:25:52 +0000 (02:25 +0000)]
Rely on the code in MatchAddress to do this work. Otherwise we fail to
match (X+Y)+(Z << 1), because we match the X+Y first, consuming the index
register, then there is no place to put the Z.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19652
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 02:11:55 +0000 (02:11 +0000)]
Fix the completely broken FP constant folds for setcc's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19651
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 18 Jan 2005 01:06:26 +0000 (01:06 +0000)]
Fix a problem where probing for addressing modes caused expressions to be
emitted too early. In particular, this fixes
Regression/CodeGen/X86/regpressure.ll:regpressure3.
This also improves the 2nd basic block in 164.gzip:flush_block, which went from
.LBBflush_block_1: # loopentry.1.i
movzx %EAX, WORD PTR [dyn_ltree + 20]
movzx %ECX, WORD PTR [dyn_ltree + 16]
mov DWORD PTR [%ESP + 32], %ECX
movzx %ECX, WORD PTR [dyn_ltree + 12]
movzx %EDX, WORD PTR [dyn_ltree + 8]
movzx %EBX, WORD PTR [dyn_ltree + 4]
mov DWORD PTR [%ESP + 36], %EBX
movzx %EBX, WORD PTR [dyn_ltree]
add DWORD PTR [%ESP + 36], %EBX
add %EDX, DWORD PTR [%ESP + 36]
add %ECX, %EDX
add DWORD PTR [%ESP + 32], %ECX
add %EAX, DWORD PTR [%ESP + 32]
movzx %ECX, WORD PTR [dyn_ltree + 24]
add %EAX, %ECX
mov %ECX, 0
mov %EDX, %ECX
to
.LBBflush_block_1: # loopentry.1.i
movzx %EAX, WORD PTR [dyn_ltree]
movzx %ECX, WORD PTR [dyn_ltree + 4]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 8]
add %EAX, %ECX
movzx %ECX, WORD PTR [dyn_ltree + 12]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 16]
add %EAX, %ECX
movzx %ECX, WORD PTR [dyn_ltree + 20]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 24]
add %ECX, %EAX
mov %EAX, 0
mov %EDX, %EAX
... which results in less spilling in the function.
This change alone speeds up 164.gzip from 37.23s to 36.24s on apoc. The
default isel takes 37.31s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19650
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 23:25:45 +0000 (23:25 +0000)]
Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19649
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 23:16:01 +0000 (23:16 +0000)]
This is a carefully contrived testcase where the X86 ISel is emitting all loads
before other ops, causing it to spill like mad. This occurs in
164.gzip:flush_block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19648
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 23:02:13 +0000 (23:02 +0000)]
Don't bother using max here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19647
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 22:56:09 +0000 (22:56 +0000)]
Do not give token factor nodes outrageous weights
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19645
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 22:19:26 +0000 (22:19 +0000)]
Non-volatile loads can be freely reordered against each other. This fixes
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:
int %loadload(int *%X, int* %Y) {
%Z = load int* %Y
%Y = load int* %X ;; load between %Z and store
%Q = add int %Z, 1
store int %Q, int* %Y
ret int %Y
}
Into this:
loadload:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%EAX]
mov %ECX, DWORD PTR [%ESP + 8]
inc DWORD PTR [%ECX]
ret
where we weren't able to form the 'inc [mem]' before. This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19644
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 22:10:42 +0000 (22:10 +0000)]
Two changes:
1. Fold [mem] += (1|-1) into inc [mem]/dec [mem] to save some icache space.
2. Do not let token factor nodes prevent forming '[mem] op= val' folds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19643
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 19:43:36 +0000 (19:43 +0000)]
Don't call SelectionDAG.getRoot() directly, go through a forwarding method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19642
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 19:25:26 +0000 (19:25 +0000)]
Refactor load/op/store folding into it's own method, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19641
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 17:55:19 +0000 (17:55 +0000)]
Implement a target independent optimization to codegen arguments only into
the basic block that uses them if possible. This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).
For this (contrived to show the optimization) testcase:
int %argtest(int %A, int %B) {
%X = sub int 12345, %A
br label %L
L:
%Y = add int %X, %B
ret int %Y
}
we used to produce:
argtest:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, 12345
sub %EAX, %ECX
mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1: # L
add %EAX, %EDX
ret
now we produce:
argtest:
mov %EAX, 12345
sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1: # L
add %EAX, DWORD PTR [%ESP + 8]
ret
This also fixes the FIXME in the code.
BTW, this occurs in real code. 164.gzip shrinks from 8623 to 8608 lines of
.s file. The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.
Take that alkis. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19639
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 17:49:14 +0000 (17:49 +0000)]
Fix a major regression last night that prevented us from producing [mem] op= reg
operations.
The body of the if is less indented but unmodified in this patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19638
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 17:15:02 +0000 (17:15 +0000)]
Refactor code into a new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19635
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 17:14:43 +0000 (17:14 +0000)]
Make methods private, add a method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19634
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 06:48:02 +0000 (06:48 +0000)]
Codegen this:
int %foo(int %X) {
%T = add int %X, 13
%S = mul int %T, 3
ret int %S
}
as this:
mov %ECX, DWORD PTR [%ESP + 4]
lea %EAX, DWORD PTR [%ECX + 2*%ECX + 39]
ret
instead of this:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, %ECX
add %EAX, 13
imul %EAX, %EAX, 3
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19633
91177308-0d34-0410-b5e6-
96231b3b80d8
Tanya Lattner [Mon, 17 Jan 2005 06:47:26 +0000 (06:47 +0000)]
Added tmp instructions to preserve ssa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19632
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 06:26:58 +0000 (06:26 +0000)]
Fix test/Regression/CodeGen/X86/2005-01-17-CycleInDAG.ll and 132.ijpeg.
Do not fold a load into an operation if it will induce a cycle in the DAG.
Repeat after me: dAg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19631
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 06:25:59 +0000 (06:25 +0000)]
New testcase for a problem that occurred in 132.ijpeg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19630
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 05:10:15 +0000 (05:10 +0000)]
Delete PHI nodes that are not dead but are locked in a cycle of single
useness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19629
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 03:20:02 +0000 (03:20 +0000)]
Move code out of indentation one level to make it easier to read.
Disable the xform for < > cases. It turns out that the following is being
miscompiled:
bool %test(sbyte %S) {
%T = cast sbyte %S to uint
%V = setgt uint %T, 255
ret bool %V
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19628
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 02:24:59 +0000 (02:24 +0000)]
Add methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19627
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 01:34:14 +0000 (01:34 +0000)]
Do not fold a load into a comparison that is used by more than one place.
The comparison will probably be folded, so this is not ok to do.
This fixed 197.parser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19624
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Mon, 17 Jan 2005 00:42:31 +0000 (00:42 +0000)]
sysconfdir -> PROJ_etcdir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19623
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 00:23:16 +0000 (00:23 +0000)]
Do not codegen 'xor bool, true' as 'not reg'. not reg inverts the upper bits
of the bytereg. This fixes yacr2, 300.twolf and probably others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19622
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 00:12:04 +0000 (00:12 +0000)]
Fix typos noticed by Gabor Greif, thanks Gabor!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19621
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 17 Jan 2005 00:00:33 +0000 (00:00 +0000)]
Set up the shift and setcc types.
If we emit a load because we followed a token chain to get to it, try to
fold it into its single user if possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19620
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 23:59:48 +0000 (23:59 +0000)]
Shift and setcc types default to the pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19619
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 23:59:30 +0000 (23:59 +0000)]
Add comments
Add fields to hold the result type of setcc operations and shift amounts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19618
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 19:46:48 +0000 (19:46 +0000)]
Implement legalize of call nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19617
91177308-0d34-0410-b5e6-
96231b3b80d8
Alkis Evlogimenos [Sun, 16 Jan 2005 09:44:58 +0000 (09:44 +0000)]
Fix llvm-java project autconfiguration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19616
91177308-0d34-0410-b5e6-
96231b3b80d8
Tanya Lattner [Sun, 16 Jan 2005 08:51:10 +0000 (08:51 +0000)]
Added paramters to a few functions in order to allow me to change the functions to preserve SSA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19615
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:34:08 +0000 (07:34 +0000)]
* Adjust to changes in TargetLowering interfaces.
* Remove custom promotion for bool and byte select ops. Legalize now
promotes them for us.
* Allow folding ConstantPoolIndexes into EXTLOAD's, useful for float immediates.
* Declare which operations are not supported better.
* Add some hacky code for TRUNCSTORE to pretend that we have truncstore
for i16 types. This is useful for testing promotion code because I can
just remove 16-bit registers all together and verify that programs work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19614
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:29:19 +0000 (07:29 +0000)]
Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.
Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19613
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:28:41 +0000 (07:28 +0000)]
add method stub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19612
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:28:31 +0000 (07:28 +0000)]
Don't mash stuff together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19611
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:28:11 +0000 (07:28 +0000)]
Use enums, move virtual dtor out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19610
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2005 07:27:49 +0000 (07:27 +0000)]
Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19609
91177308-0d34-0410-b5e6-
96231b3b80d8