Commit Graph

1422 Commits

Author SHA1 Message Date
Chris Lattner
84734ce8ef Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code.
Changing 'op' here caused us to not enter the store into a map, causing
reemission of the code!!  In practice, a simple loop like this:

no_exit:                ; preds = %no_exit, %entry
        %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=3]
        %tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0          ; <double*> [#uses=1]
        store double 0.000000e+00, double* %tmp.4
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=2]
        %exitcond = seteq uint %indvar.next, %N         ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit

was being code gen'd to:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        shll $4, %esi
        movl $0, 4(%eax,%esi)
        movl $0, (%eax,%esi)
        incl %edx
        movl $0, (%eax,%esi)
        movl $0, 4(%eax,%esi)
        cmpl %ecx, %edx
        jne .LBBtest_1  # no_exit

Note that we are doing 4 32-bit stores instead of 2.  Now we generate:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        incl %esi
        shll $4, %edx
        movl $0, (%eax,%edx)
        movl $0, 4(%eax,%edx)
        cmpl %ecx, %esi
        movl %esi, %edx
        jne .LBBtest_1  # no_exit

This is much happier, though it would be even better if the increment of ESI
was scheduled after the compare :-/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20265 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-22 07:23:39 +00:00
Misha Brukman
d3f03e4b50 Fix compilation errors with VS 2005, patch by Aaron Gray.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20231 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 21:39:27 +00:00
Chris Lattner
d8658616cf Don't rely on doubles comparing identical to each other, which doesn't work
for 0.0 and -0.0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20230 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 20:17:32 +00:00
Chris Lattner
aa781b3404 Don't sink argument loads into loops or other bad places. This disables folding of argument loads with instructions that are not in the entry block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20228 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 19:40:32 +00:00
Chris Lattner
27e192196f Print GEP offsets as signed values instead of unsigned values. On X86, this
prints:

getelementptr (int* %A, int -1)

as: "(A) - 4" instead of "(A) + 18446744073709551612", which makes the
assembler much happier.

This fixes test/Regression/CodeGen/X86/2005-02-14-IllegalAssembler.ll,
and Benchmarks/Prolangs-C/cdecl with LLC on X86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20183 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-14 21:40:26 +00:00
Chris Lattner
595dc5408a Fix a case where were incorrectly compiled cast from short to int on 64-bit
targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20030 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-04 18:39:19 +00:00
Andrew Lenharth
571c9c314f fix constant pointer outputing on 64 bit machines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20026 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-04 13:47:16 +00:00
Chris Lattner
272455b404 Fix yet another memset issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19986 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-02 03:44:41 +00:00
Chris Lattner
deb692e756 Fix some bugs andrew noticed legalizing memset for alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19969 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01 18:38:28 +00:00
Chris Lattner
bca81448ac Improve conformance with the Misha spelling benchmark suite
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19930 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-30 00:09:23 +00:00
Chris Lattner
9d5d7598db adjust to ilist changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19924 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-29 18:41:25 +00:00
Chris Lattner
99939d39c9 Alpha doesn't have a native f32 extload instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19880 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:58:25 +00:00
Chris Lattner
e76ad6de40 implement legalization of truncates whose results and sources need to be
truncated, e.g. (truncate:i8 something:i16) on a 32 or 64-bit RISC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19879 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:52:50 +00:00
Chris Lattner
e560521f1a Get alpha working with memset/memcpy/memmove
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19878 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:29:18 +00:00
Chris Lattner
13c184de29 CopyFromReg produces two values. Make sure that we remember that both are
legalized, and actually return the correct result when we legalize the chain first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19866 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 06:27:38 +00:00
Chris Lattner
fed5577066 Silence optimized warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19797 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 23:19:44 +00:00
Chris Lattner
3563015b0d Simplify/speedup the PEI by not having to scan for uses of the callee saved
registers.  This information is computed directly by the register allocator
now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19795 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 23:13:12 +00:00
Chris Lattner
786116337e Update physregsused info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19793 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 22:55:45 +00:00
Chris Lattner
0648b16c48 Update this pass to set PhysRegsUsed info in MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19792 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 22:51:56 +00:00
Chris Lattner
b0f31bf19b Update these register allocators to set the PhysRegUsed info in MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19791 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 22:45:13 +00:00
Chris Lattner
ce9c41e77a Add support for the PhysRegsUsed array.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19789 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 22:13:58 +00:00
Chris Lattner
92b9fcea7b Speed this up a bit by making ModifiedRegs a vector<char> not vector<bool>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19787 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 21:45:01 +00:00
Chris Lattner
9c32d3b798 Adjust to changes in SelectionDAG interfaces
The first half of correct chain insertion for libcalls. This is not enough
to fix Fhourstones yet though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19781 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:42:50 +00:00
Chris Lattner
b48da39536 Remove the 3 HACK HACK HACKs I put in before, fixing them properly with
the new TLI that is available.

Implement support for handling out of range shifts.  This allows us to
compile this code (a 64-bit rotate):

unsigned long long f3(unsigned long long x) {
  return (x << 32) | (x >> (64-32));
}

into this:

f3:
        mov %EDX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        ret

GCC produces this:

$ gcc t.c -masm=intel -O3 -S -o - -fomit-frame-pointer
..
f3:
        push    %ebx
        mov     %ebx, DWORD PTR [%esp+12]
        mov     %ecx, DWORD PTR [%esp+8]
        mov     %eax, %ebx
        mov     %edx, %ecx
        pop     %ebx
        ret

The Simple ISEL produces (eww gross):

f3:
        sub %ESP, 4
        mov DWORD PTR [%ESP], %ESI
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, DWORD PTR [%ESP + 12]
        mov %EAX, 0
        mov %ESI, 0
        or %EAX, %ECX
        or %EDX, %ESI
        mov %ESI, DWORD PTR [%ESP]
        add %ESP, 4
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19780 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:39:44 +00:00
Chris Lattner
ac9dc08c7f Adjust to changes in SelectionDAG interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19779 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:36:26 +00:00
Chris Lattner
68cd65ea68 Get this to work for 64-bit systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19763 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 23:04:37 +00:00
Chris Lattner
5037a15910 Implicitly defined registers can clobber callee saved registers too!
This fixes the return-address-not-being-saved problem in the Alpha backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19741 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:49:16 +00:00
Chris Lattner
7cd50cf286 More bugfixes for IA64 shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19739 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:33:03 +00:00
Chris Lattner
27ff112948 Fix problems with non-x86 targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19738 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:31:52 +00:00
Chris Lattner
a7306db5f7 Add a nasty hack to fix Alpha/IA64 multiplies by a power of two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19737 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:20:42 +00:00
Chris Lattner
9bb86f46e1 Remove unneeded line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19736 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 23:43:12 +00:00
Chris Lattner
1e7ceaf0a0 test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19735 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 23:38:56 +00:00
Chris Lattner
a93ec3ebfb Unary token factor nodes are unneeded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19727 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 18:01:22 +00:00
Chris Lattner
77e77a6aa0 Refactor libcall code a bit. Initial implementation of expanding int -> FP
operations for 64-bit integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19724 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 06:05:23 +00:00
Chris Lattner
e5544f851a Simplify the shift-expansion code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19721 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-20 20:29:23 +00:00
Chris Lattner
84f6788044 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
2005-01-20 18:52:28 +00:00
Chris Lattner
17eee18f40 implement add_parts/sub_parts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-20 18:50:55 +00:00
Chris Lattner
2c49f27955 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
2005-01-19 22:31:21 +00:00
Chris Lattner
3ca6a2c72c 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
2005-01-19 21:32:07 +00:00
Chris Lattner
3d9dffc586 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
2005-01-19 20:24:35 +00:00
Chris Lattner
1e81b9e511 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
2005-01-19 19:10:54 +00:00
Chris Lattner
ec39a45bdb 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
2005-01-19 18:02:17 +00:00
Chris Lattner
39908e0ce0 Know some identities about tokenfactor nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19699 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 18:01:40 +00:00
Chris Lattner
88218ef706 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
2005-01-19 17:29:49 +00:00
Chris Lattner
2a6e163edc 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
2005-01-19 17:11:51 +00:00
Chris Lattner
d45be36965 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
2005-01-19 17:09:15 +00:00
Chris Lattner
c71d6949b9 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
2005-01-19 07:08:42 +00:00
Chris Lattner
e34b396ab7 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
2005-01-19 04:19:40 +00:00
Chris Lattner
d6e496732b 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
2005-01-19 03:36:14 +00:00
Chris Lattner
d5d5682512 Zero is cheaper than sign extend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19675 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 21:57:59 +00:00