oota-llvm.git
20 years agoImplement InstCombine/select.ll:test[7-10]
Chris Lattner [Thu, 8 Apr 2004 04:43:23 +0000 (04:43 +0000)]
Implement InstCombine/select.ll:test[7-10]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12769 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd some more cases we should combine
Chris Lattner [Thu, 8 Apr 2004 04:43:04 +0000 (04:43 +0000)]
Add some more cases we should combine

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12768 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoThis file is no longer used.
Brian Gaeke [Wed, 7 Apr 2004 21:01:22 +0000 (21:01 +0000)]
This file is no longer used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12767 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDon't include InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:55:32 +0000 (20:55 +0000)]
Don't include InstrSelectionSupport.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12766 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMove ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:38:57 +0000 (20:38 +0000)]
Move ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12765 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDon't include InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:38:56 +0000 (20:38 +0000)]
Don't include InstrSelectionSupport.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12764 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImplement test/Regression/Transforms/InstCombine/getelementptr_index.ll
Chris Lattner [Wed, 7 Apr 2004 18:38:20 +0000 (18:38 +0000)]
Implement test/Regression/Transforms/InstCombine/getelementptr_index.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12762 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew testcase
Chris Lattner [Wed, 7 Apr 2004 18:38:01 +0000 (18:38 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12761 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix insertion of SelectInsts.
Brian Gaeke [Wed, 7 Apr 2004 18:31:47 +0000 (18:31 +0000)]
Fix insertion of SelectInsts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12760 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDon't print [%reg + 0], just print [%reg]
Brian Gaeke [Wed, 7 Apr 2004 17:33:56 +0000 (17:33 +0000)]
Don't print [%reg + 0], just print [%reg]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12759 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFirst version of code to handle loads. Stub function for handling stores.
Brian Gaeke [Wed, 7 Apr 2004 17:29:37 +0000 (17:29 +0000)]
First version of code to handle loads. Stub function for handling stores.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12758 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSupport loading arguments from %I0...%I5 into virtual registers in
Brian Gaeke [Wed, 7 Apr 2004 17:04:09 +0000 (17:04 +0000)]
Support loading arguments from %I0...%I5 into virtual registers in
function prologues, and fix an off-by-one in visitCallInst that was
putting call args into the wrong registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12757 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoIt's setting up the call args right now, but on the callee side, it's
Brian Gaeke [Wed, 7 Apr 2004 16:41:22 +0000 (16:41 +0000)]
It's setting up the call args right now, but on the callee side, it's
trying to get incoming args off the stack, instead of the %i0...%i6 regs,
which is wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12756 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew testcase that crashed scalarevolution on sparc
Chris Lattner [Wed, 7 Apr 2004 16:17:45 +0000 (16:17 +0000)]
New testcase that crashed scalarevolution on sparc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12755 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix a bug Brian found.
Chris Lattner [Wed, 7 Apr 2004 16:16:11 +0000 (16:16 +0000)]
Fix a bug Brian found.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12754 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoWe have a global reg. allocator now -- thanks to Alkis.
Brian Gaeke [Wed, 7 Apr 2004 15:31:23 +0000 (15:31 +0000)]
We have a global reg. allocator now -- thanks to Alkis.
Fix a typo.
Add a project I've always thought would be cool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12747 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew file that can be useful for hand inspection of assembly required for certain
Chris Lattner [Wed, 7 Apr 2004 05:06:39 +0000 (05:06 +0000)]
New file that can be useful for hand inspection of assembly required for certain
kinds of instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12746 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoThis is a start on handling setcc instructions. As the comment notes, we
Chris Lattner [Wed, 7 Apr 2004 05:04:51 +0000 (05:04 +0000)]
This is a start on handling setcc instructions.  As the comment notes, we
have no good way of handling this until the code generator is improved.
We should probably just emit V9 instructions in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12745 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoandd subcc instructions which is used to create the 'cmp' pseudo instruction
Chris Lattner [Wed, 7 Apr 2004 05:04:01 +0000 (05:04 +0000)]
andd subcc instructions which is used to create the 'cmp' pseudo instruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12744 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAvoid emitting an extra copy on each 32-bit operation
Chris Lattner [Wed, 7 Apr 2004 04:36:53 +0000 (04:36 +0000)]
Avoid emitting an extra copy on each 32-bit operation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12743 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMake generation of stack-slot loads and copies less ugly.
Brian Gaeke [Wed, 7 Apr 2004 04:29:14 +0000 (04:29 +0000)]
Make generation of stack-slot loads and copies less ugly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12742 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix bug in printing loads.
Brian Gaeke [Wed, 7 Apr 2004 04:29:03 +0000 (04:29 +0000)]
Fix bug in printing loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12741 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd support for shift instructions, wrap some long lines
Chris Lattner [Wed, 7 Apr 2004 04:27:16 +0000 (04:27 +0000)]
Add support for shift instructions, wrap some long lines

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12740 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix encoding of existing shift instructions, add rr shifts
Chris Lattner [Wed, 7 Apr 2004 04:26:57 +0000 (04:26 +0000)]
Fix encoding of existing shift instructions, add rr shifts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12739 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew testcase
Chris Lattner [Wed, 7 Apr 2004 04:08:21 +0000 (04:08 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12738 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd a bunch more instructions
Chris Lattner [Wed, 7 Apr 2004 04:06:46 +0000 (04:06 +0000)]
Add a bunch more instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12737 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMerge my changes with brians
Chris Lattner [Wed, 7 Apr 2004 04:05:49 +0000 (04:05 +0000)]
Merge my changes with brians

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12736 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd in some things I forgot, which Chris helpfully reminded me of...
Brian Gaeke [Wed, 7 Apr 2004 04:05:12 +0000 (04:05 +0000)]
Add in some things I forgot, which Chris helpfully reminded me of...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12735 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd support for the "Y" register, used by MUL & DIV.
Brian Gaeke [Wed, 7 Apr 2004 04:01:11 +0000 (04:01 +0000)]
Add support for the "Y" register, used by MUL & DIV.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12734 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd UDIV, SDIV, and a few variants of WR.
Brian Gaeke [Wed, 7 Apr 2004 04:01:00 +0000 (04:01 +0000)]
Add UDIV, SDIV, and a few variants of WR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12733 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoPreliminary support for getting 64-bit integer constants into registers.
Brian Gaeke [Wed, 7 Apr 2004 04:00:49 +0000 (04:00 +0000)]
Preliminary support for getting 64-bit integer constants into registers.
Preliminary support for division. It's gross because you have to initialize
the "Y" register, which is the top 32 bits of the thing you're dividing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12732 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoPrune unnecessary #includes
Brian Gaeke [Tue, 6 Apr 2004 23:25:07 +0000 (23:25 +0000)]
Prune unnecessary #includes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12731 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSimple delay slot filler pass.
Brian Gaeke [Tue, 6 Apr 2004 23:21:45 +0000 (23:21 +0000)]
Simple delay slot filler pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12730 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd references to delay slot filler pass.
Brian Gaeke [Tue, 6 Apr 2004 23:21:24 +0000 (23:21 +0000)]
Add references to delay slot filler pass.
Fill in addPassesToJITCompile method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12729 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFirst attempt at handling frame index elimination.
Brian Gaeke [Tue, 6 Apr 2004 22:10:22 +0000 (22:10 +0000)]
First attempt at handling frame index elimination.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12728 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFirst attempt at special-casing printing of [%reg + offset] for
Brian Gaeke [Tue, 6 Apr 2004 22:10:11 +0000 (22:10 +0000)]
First attempt at special-casing printing of [%reg + offset] for
ld/st instructions - doesn't seem to work yet, but I think it's
just a typo or something somewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12727 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDelete reference to "the Mach-O Runtime ABI".
Brian Gaeke [Tue, 6 Apr 2004 22:09:59 +0000 (22:09 +0000)]
Delete reference to "the Mach-O Runtime ABI".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12726 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDeal with call return values.
Brian Gaeke [Tue, 6 Apr 2004 22:09:23 +0000 (22:09 +0000)]
Deal with call return values.
Don't put NOPs in delay slots at all. We'll have a fix-up pass later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12725 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdding kimwitu++ license.
John Criswell [Tue, 6 Apr 2004 20:23:45 +0000 (20:23 +0000)]
Adding kimwitu++ license.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12719 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoBugs fixed new features implemented
Chris Lattner [Tue, 6 Apr 2004 19:48:42 +0000 (19:48 +0000)]
Bugs fixed new features implemented

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12716 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agofile based off InstSelectSimple.cpp, slowly being replaced by generated code from...
Jakub Staszak [Tue, 6 Apr 2004 19:35:17 +0000 (19:35 +0000)]
file based off InstSelectSimple.cpp, slowly being replaced by generated code from the really simple X86 instruction selector tablegen backend

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12715 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoTablgen files for really simple instruction selector
Jakub Staszak [Tue, 6 Apr 2004 19:34:00 +0000 (19:34 +0000)]
Tablgen files for really simple instruction selector

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12714 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoTablegen backend for really simple instruction selector
Jakub Staszak [Tue, 6 Apr 2004 19:31:31 +0000 (19:31 +0000)]
Tablegen backend for really simple instruction selector

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12713 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoadd tablgen backend for really simple instruction selector
Jakub Staszak [Tue, 6 Apr 2004 19:30:56 +0000 (19:30 +0000)]
add tablgen backend for really simple instruction selector

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12712 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix PR313: [x86] JIT miscompiles unsigned short to floating point
Chris Lattner [Tue, 6 Apr 2004 19:29:36 +0000 (19:29 +0000)]
Fix PR313: [x86] JIT miscompiles unsigned short to floating point

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12711 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix incorrect encoding of some ADC and SBB instuctions
Chris Lattner [Tue, 6 Apr 2004 19:20:32 +0000 (19:20 +0000)]
Fix incorrect encoding of some ADC and SBB instuctions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12710 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdded licensing information for treecc.
John Criswell [Tue, 6 Apr 2004 17:51:10 +0000 (17:51 +0000)]
Added licensing information for treecc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12703 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix a minor bug in previous checking
Chris Lattner [Tue, 6 Apr 2004 17:34:50 +0000 (17:34 +0000)]
Fix a minor bug in previous checking
Enable folding of long seteq/setne comparisons into branches and select instructions
Implement unfolded long relational comparisons against a constants a bit more efficiently

Folding comparisons changes code that looks like this:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

into code that looks like this:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        jne .LBB2 # PC rel: F

This speeds up 186.crafty by 6% with llc-ls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12702 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoWrap at 80 cols.
Misha Brukman [Tue, 6 Apr 2004 17:04:30 +0000 (17:04 +0000)]
Wrap at 80 cols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12701 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMinor cleanups
Chris Lattner [Tue, 6 Apr 2004 16:54:04 +0000 (16:54 +0000)]
Minor cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12700 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDocument new option
Chris Lattner [Tue, 6 Apr 2004 16:46:12 +0000 (16:46 +0000)]
Document new option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12699 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd a new gccld -native-cbe option which causes gccld to generate native code
Chris Lattner [Tue, 6 Apr 2004 16:43:13 +0000 (16:43 +0000)]
Add a new gccld -native-cbe option which causes gccld to generate native code
for the application with the C backend instead of the native LLVM code generator

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12698 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImprove codegen of long == and != comparisons against constants. Before,
Chris Lattner [Tue, 6 Apr 2004 16:02:27 +0000 (16:02 +0000)]
Improve codegen of long == and != comparisons against constants.  Before,
comparing a long against zero got us this:

        sub %ESP, 8
        mov DWORD PTR [%ESP + 4], %ESI
        mov DWORD PTR [%ESP], %EDI
        mov %EAX, DWORD PTR [%ESP + 12]
        mov %EDX, DWORD PTR [%ESP + 16]
        mov %ECX, 0
        mov %ESI, 0
        mov %EDI, %EAX
        xor %EDI, %ECX
        mov %ECX, %EDX
        xor %ECX, %ESI
        or %EDI, %ECX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

Now it gets us this:

        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12696 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoUpdate docs a bit
Chris Lattner [Tue, 6 Apr 2004 15:22:35 +0000 (15:22 +0000)]
Update docs a bit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12695 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoRemove some options that don't really have anything to do with bugpoint
Chris Lattner [Tue, 6 Apr 2004 15:14:10 +0000 (15:14 +0000)]
Remove some options that don't really have anything to do with bugpoint

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12694 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoHandle various other important cases of multiplying a long constant immediate. For
Chris Lattner [Tue, 6 Apr 2004 04:55:43 +0000 (04:55 +0000)]
Handle various other important cases of multiplying a long constant immediate.  For
example, multiplying X*(1 + (1LL << 32)) now produces:

test:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %EAX, %ECX
        add %EDX, %ECX
        ret

[[[Note to Alkis: why isn't linear scan generating this code??  This might be a
 problem with your intervals being too conservative:

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

end note]]]

Whereas GCC produces this:

T:
        sub     %esp, 12
        mov     %edx, DWORD PTR [%esp+16]
        mov     DWORD PTR [%esp+8], %edi
        mov     %ecx, DWORD PTR [%esp+20]
        xor     %edi, %edi
        mov     DWORD PTR [%esp], %ebx
        mov     %ebx, %edi
        mov     %eax, %edx
        mov     DWORD PTR [%esp+4], %esi
        add     %ebx, %edx
        mov     %edi, DWORD PTR [%esp+8]
        lea     %edx, [%ecx+%ebx]
        mov     %esi, DWORD PTR [%esp+4]
        mov     %ebx, DWORD PTR [%esp]
        add     %esp, 12
        ret

I'm not sure example what GCC is smoking here, but it looks like it has just
confused itself with a bunch of stack slots or something.  The intel compiler
is better, but still not good:

T:
        movl      4(%esp), %edx                                 #2.11
        movl      8(%esp), %eax                                 #2.11
        lea       (%eax,%edx), %ecx                             #3.12
        movl      $1, %eax                                      #3.12
        mull      %edx                                          #3.12
        addl      %ecx, %edx                                    #3.12
        ret                                                     #3.12

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12693 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoEfficiently handle a long multiplication by a constant. For this testcase:
Chris Lattner [Tue, 6 Apr 2004 04:29:36 +0000 (04:29 +0000)]
Efficiently handle a long multiplication by a constant.  For this testcase:

long %test(long %X) {
        %Y = mul long %X, 123
        ret long %Y
}

we used to generate:

test:
        sub %ESP, 12
        mov DWORD PTR [%ESP + 8], %ESI
        mov DWORD PTR [%ESP + 4], %EDI
        mov DWORD PTR [%ESP], %EBX
        mov %ECX, DWORD PTR [%ESP + 16]
        mov %ESI, DWORD PTR [%ESP + 20]
        mov %EDI, 123
        mov %EBX, 0
        mov %EAX, %ECX
        mul %EDI
        imul %ESI, %EDI
        add %ESI, %EDX
        imul %ECX, %EBX
        add %ESI, %ECX
        mov %EDX, %ESI
        mov %EBX, DWORD PTR [%ESP]
        mov %EDI, DWORD PTR [%ESP + 4]
        mov %ESI, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret

Now we emit:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %EDX, 123
        mul %EDX
        imul %ECX, %ECX, 123
        add %ECX, %EDX
        mov %EDX, %ECX
        ret

Which, incidently, is substantially nicer than what GCC manages:
T:
        sub     %esp, 8
        mov     %eax, 123
        mov     DWORD PTR [%esp], %ebx
        mov     %ebx, DWORD PTR [%esp+16]
        mov     DWORD PTR [%esp+4], %esi
        mov     %esi, DWORD PTR [%esp+12]
        imul    %ecx, %ebx, 123
        mov     %ebx, DWORD PTR [%esp]
        mul     %esi
        mov     %esi, DWORD PTR [%esp+4]
        add     %esp, 8
        lea     %edx, [%ecx+%edx]
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12692 91177308-0d34-0410-b5e6-96231b3b80d8

20 years ago* Added link to newly written ExtendingLLVM.html document
Misha Brukman [Tue, 6 Apr 2004 04:22:43 +0000 (04:22 +0000)]
* Added link to newly written ExtendingLLVM.html document
* Eliminated extraneous space in the HTML

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12691 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoIncorporated Chris' comments.
Misha Brukman [Tue, 6 Apr 2004 04:17:51 +0000 (04:17 +0000)]
Incorporated Chris' comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12690 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdded notes on extending LLVM with new instructions, intrinsics, types, etc.
Misha Brukman [Tue, 6 Apr 2004 03:53:49 +0000 (03:53 +0000)]
Added notes on extending LLVM with new instructions, intrinsics, types, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12689 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImprove code generation of long shifts by 32.
Chris Lattner [Tue, 6 Apr 2004 03:42:38 +0000 (03:42 +0000)]
Improve code generation of long shifts by 32.
On this testcase:

long %test(long %X) {
        %Y = shr long %X, ubyte 32
        ret long %Y
}

instead of:
t:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        sar %EAX, 0
        mov %EDX, 0
        ret

we now emit:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        mov %EDX, 0
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12688 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoBugfixes: inc/dec don't set the carry flag!
Chris Lattner [Tue, 6 Apr 2004 03:36:57 +0000 (03:36 +0000)]
Bugfixes: inc/dec don't set the carry flag!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12687 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImprove code for passing constant longs as arguments to function calls.
Chris Lattner [Tue, 6 Apr 2004 03:23:00 +0000 (03:23 +0000)]
Improve code for passing constant longs as arguments to function calls.
For example, on this instruction:

        call void %test(long 1234)

Instead of this:
        mov %EAX, 1234
        mov %ECX, 0
        mov DWORD PTR [%ESP], %EAX
        mov DWORD PTR [%ESP + 4], %ECX
        call test

We now emit this:
        mov DWORD PTR [%ESP], 1234
        mov DWORD PTR [%ESP + 4], 0
        call test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12686 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoEmit more efficient 64-bit operations when the RHS is a constant, and one
Chris Lattner [Tue, 6 Apr 2004 03:15:53 +0000 (03:15 +0000)]
Emit more efficient 64-bit operations when the RHS is a constant, and one
of the words of the constant is zeros.  For example:
  Y = and long X, 1234

now generates:
  Yl = and Xl, 1234
  Yh = 0

instead of:
  Yl = and Xl, 1234
  Yh = and Xh, 0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12685 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix typeo
Chris Lattner [Tue, 6 Apr 2004 02:13:25 +0000 (02:13 +0000)]
Fix typeo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12684 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd support for simple immediate handling to long instruction selection.
Chris Lattner [Tue, 6 Apr 2004 02:11:49 +0000 (02:11 +0000)]
Add support for simple immediate handling to long instruction selection.
This allows us to handle code like 'add long %X, 123456789012' more efficiently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12683 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoThe sbb instructions really ARE sbb's, not adc's
Chris Lattner [Tue, 6 Apr 2004 02:02:11 +0000 (02:02 +0000)]
The sbb instructions really ARE sbb's, not adc's

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12682 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImplement negation of longs efficiently. For this testcase:
Chris Lattner [Tue, 6 Apr 2004 01:48:06 +0000 (01:48 +0000)]
Implement negation of longs efficiently.  For this testcase:

long %test(long %X) {
        %Y = sub long 0, %X
        ret long %Y
}

We used to generate:

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

Now we generate:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        neg %EAX
        adc %EDX, 0
        neg %EDX
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12681 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMinor tweak to avoid an extra reg-reg copy that the register allocator has to eliminate
Chris Lattner [Tue, 6 Apr 2004 01:25:33 +0000 (01:25 +0000)]
Minor tweak to avoid an extra reg-reg copy that the register allocator has to eliminate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12680 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoTwo changes:
Chris Lattner [Tue, 6 Apr 2004 01:21:00 +0000 (01:21 +0000)]
Two changes:
  * In promote32, if we can just promote a constant value, do so instead of
    promoting a constant dynamically.
  * In visitReturn inst, actually USE the promote32 argument that takes a
    Value*

The end result of this is that we now generate this:

test:
        mov %EAX, 0
        ret

instead of...

test:
        mov %AX, 0
        movzx %EAX, %AX
        ret

for:

ushort %test() {
        ret ushort 0
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12679 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMerge the code generator miscompilation code into the optimizer miscompilation
Chris Lattner [Mon, 5 Apr 2004 22:58:16 +0000 (22:58 +0000)]
Merge the code generator miscompilation code into the optimizer miscompilation
code.  This "instantly" gives us loop-extractor power to assist with the
debugment of our nasty codegen issues.  :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12678 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMake a method public
Chris Lattner [Mon, 5 Apr 2004 22:01:48 +0000 (22:01 +0000)]
Make a method public

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12677 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMinor cleanups, remove some old debug code
Chris Lattner [Mon, 5 Apr 2004 21:37:55 +0000 (21:37 +0000)]
Minor cleanups, remove some old debug code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12676 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoRefactor and genericize code
Chris Lattner [Mon, 5 Apr 2004 21:37:38 +0000 (21:37 +0000)]
Refactor and genericize code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12675 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agolli no longer takes the -quiet option!
Chris Lattner [Mon, 5 Apr 2004 20:28:41 +0000 (20:28 +0000)]
lli no longer takes the -quiet option!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12674 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoDo not mangle intrinsics in any way!
Chris Lattner [Mon, 5 Apr 2004 20:17:53 +0000 (20:17 +0000)]
Do not mangle intrinsics in any way!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12673 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMake full use of the Mangler interface to simplify code
Chris Lattner [Mon, 5 Apr 2004 19:31:02 +0000 (19:31 +0000)]
Make full use of the Mangler interface to simplify code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12671 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSparc don't got not "sqrtl", bum bum bum
Chris Lattner [Mon, 5 Apr 2004 19:05:15 +0000 (19:05 +0000)]
Sparc don't got not "sqrtl", bum bum bum

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12670 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoKill warnings during an optimized compile where assert() disappears.
Misha Brukman [Mon, 5 Apr 2004 19:00:46 +0000 (19:00 +0000)]
Kill warnings during an optimized compile where assert() disappears.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12669 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx
Chris Lattner [Mon, 5 Apr 2004 18:46:55 +0000 (18:46 +0000)]
Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12668 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew testcase for PR312
Chris Lattner [Mon, 5 Apr 2004 18:46:33 +0000 (18:46 +0000)]
New testcase for PR312

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12667 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix a bug in yesterdays checkins which broke siod. siod is a great testcase! :)
Chris Lattner [Mon, 5 Apr 2004 16:02:41 +0000 (16:02 +0000)]
Fix a bug in yesterdays checkins which broke siod.  siod is a great testcase!  :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12659 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoFix InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll
Chris Lattner [Mon, 5 Apr 2004 02:10:19 +0000 (02:10 +0000)]
Fix InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12658 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoNew testcase that crashes the instcombine pass. Dominance properties have
Chris Lattner [Mon, 5 Apr 2004 02:01:32 +0000 (02:01 +0000)]
New testcase that crashes the instcombine pass.  Dominance properties have
no meaning if the code is not reachable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12657 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoPR82 is finally fixed!
Chris Lattner [Mon, 5 Apr 2004 01:43:08 +0000 (01:43 +0000)]
PR82 is finally fixed!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12656 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoMinor change
Chris Lattner [Mon, 5 Apr 2004 01:31:50 +0000 (01:31 +0000)]
Minor change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12655 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoUpdate getelementptr instruction description
Chris Lattner [Mon, 5 Apr 2004 01:30:49 +0000 (01:30 +0000)]
Update getelementptr instruction description

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12654 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSupport getelementptr instructions which use uint's to index into structure
Chris Lattner [Mon, 5 Apr 2004 01:30:19 +0000 (01:30 +0000)]
Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12653 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSupport getelementptr instructions which use uint's to index into structure
Chris Lattner [Mon, 5 Apr 2004 01:30:04 +0000 (01:30 +0000)]
Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

Auto-upgrade .ll files that use ubytes to index into structures to use uint's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12652 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImplement support for a new LLVM 1.3 bytecode format, which uses uint's
Chris Lattner [Mon, 5 Apr 2004 01:27:26 +0000 (01:27 +0000)]
Implement support for a new LLVM 1.3 bytecode format, which uses uint's
to index into structure types and allows arbitrary 32- and 64-bit integer
types to index into sequential types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12651 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoBe more restrictive with the index types we allow for sequential types
Chris Lattner [Mon, 5 Apr 2004 01:25:21 +0000 (01:25 +0000)]
Be more restrictive with the index types we allow for sequential types

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12650 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoPR305 is now fixed
Chris Lattner [Mon, 5 Apr 2004 00:40:55 +0000 (00:40 +0000)]
PR305 is now fixed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12649 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdd ConstantExpr::get(Sign|Zero)Extend methods
Chris Lattner [Sun, 4 Apr 2004 23:20:30 +0000 (23:20 +0000)]
Add ConstantExpr::get(Sign|Zero)Extend methods

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12648 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoIn the perhaps not-to-distant future, we might support gep instructions that
Chris Lattner [Sun, 4 Apr 2004 20:44:05 +0000 (20:44 +0000)]
In the perhaps not-to-distant future, we might support gep instructions that
have non-long indices for sequential types.  In order to avoid trying to figure
out how the v9 backend works, we'll just hack it in the preselection pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12647 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdjust to new interface
Chris Lattner [Sun, 4 Apr 2004 19:47:06 +0000 (19:47 +0000)]
Adjust to new interface

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12646 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoSupport iteration over constant instructions
Chris Lattner [Sun, 4 Apr 2004 19:46:54 +0000 (19:46 +0000)]
Support iteration over constant instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12645 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAdjust to new gep_type_iterator prototypes.
Chris Lattner [Sun, 4 Apr 2004 17:30:06 +0000 (17:30 +0000)]
Adjust to new gep_type_iterator prototypes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12644 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoRemove a bunch of cruft that was used to be backwards compatible with the last
Chris Lattner [Sat, 3 Apr 2004 23:43:42 +0000 (23:43 +0000)]
Remove a bunch of cruft that was used to be backwards compatible with the last
prerelease format for LLVM bytecode files.  Now we only are compatible with
LLVM 1.0+.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12643 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoAllow for use of arbitrary iterator types...
Chris Lattner [Sat, 3 Apr 2004 23:29:11 +0000 (23:29 +0000)]
Allow for use of arbitrary iterator types...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12642 91177308-0d34-0410-b5e6-96231b3b80d8

20 years agoImplement test/Regression/Transforms/GCSE/undefined_load.ll
Chris Lattner [Sat, 3 Apr 2004 00:45:16 +0000 (00:45 +0000)]
Implement test/Regression/Transforms/GCSE/undefined_load.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12641 91177308-0d34-0410-b5e6-96231b3b80d8