Commit Graph

3950 Commits

Author SHA1 Message Date
Chris Lattner
a28381cac2 Remove all knowledge of UINT_TO_FP from the X86 backend, relying on the
legalizer to eliminate them.  With this comes the expected code quality
improvements, such as, for this:

double foo(unsigned short X) { return X; }

we now generate this:

_foo:
        subl $4, %esp
        movzwl 8(%esp), %eax
        movl %eax, (%esp)
        fildl (%esp)
        addl $4, %esp
        ret

instead of this:

_foo:
        subl $4, %esp
        movw 8(%esp), %ax
        movzwl %ax, %eax   ;; Load not folded into this.
        movl %eax, (%esp)
        fildl (%esp)
        addl $4, %esp
        ret

-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22449 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-16 00:28:20 +00:00
Nate Begeman
16b04f3d5e Get closer to fully working scalar FP in SSE regs. This gets singlesource
working, and Olden/power.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22441 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-15 00:38:55 +00:00
Nate Begeman
6c7cb29038 Add support for printing the sse scalar comparison instruction mnemonics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22440 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 22:52:25 +00:00
John Criswell
ce4e1e419e Fixed PR#596:
Add parenthesis around the value being negated; that way, if the value
begins with a minus sign (e.g. negative integer), we won't generate a
C predecrement operator by mistake.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22437 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-14 19:41:16 +00:00
Nate Begeman
d3a490a08e Check in the last of the darwin-specific code necessary to get shootout
working before modifying the asm printer to use the subtarget info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:58 +00:00
Nate Begeman
63b3f9acae Remove some code that moved to the generic asm printer a long time ago.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:15 +00:00
Andrew Lenharth
fec0e4024f Fix povray and minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 04:20:52 +00:00
Jeff Cohen
74fa8d67e1 I don't know how this ever compiled with gcc, but VC++ correctly rejects it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22394 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:59:38 +00:00
Nate Begeman
0e219eb9b8 Clean up the TargetSubtarget class a bit, removing an unnecessary argument
to the constructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22392 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:41:19 +00:00
Chris Lattner
b151acadc8 Minor changes to improve comments and fix the build on _WIN32 systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:36:10 +00:00
Chris Lattner
3249bfc828 Add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22390 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:35:36 +00:00
Nate Begeman
fb5792f416 Implement Subtarget support
Implement the X86 Subtarget.

This consolidates the checks for target triple, and setting options based
on target triple into one place.  This allows us to convert the asm printer
and isel over from being littered with "forDarwin", "forCygwin", etc. into
just having the appropriate flags for each subtarget feature controlling
the code for that feature.

This patch also implements indirect external and weak references in the
X86 pattern isel, for darwin.  Next up is to convert over the asm printers
to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:41:54 +00:00
Nate Begeman
73213f6c07 Commit some pending darwin changes before subtarget support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:37:28 +00:00
Chris Lattner
df3623e962 fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 22:46:18 +00:00
Chris Lattner
c569d79a2a Output .size directives to tell the assembler the size of each function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22381 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:29:14 +00:00
Chris Lattner
b12c9fa565 Fix crazy indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22380 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:25:47 +00:00
Chris Lattner
81b6ed7ed1 Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
after itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22376 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:17:48 +00:00
Chris Lattner
efb4bf0de6 Remove prototype for non-existant function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22372 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 04:20:55 +00:00
Chris Lattner
bce81ae51e Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.

Also, remove some uses of dyn_cast that should really be cast (which is
cheaper in a release build).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:56:13 +00:00
Chris Lattner
9fadb4c1c0 Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22366 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:29:18 +00:00
Nate Begeman
72b286b0a0 Add support for assembling .s files on mac os x for intel
Add support for running bugpoint on mac os x for intel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22351 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 00:23:26 +00:00
Andrew Lenharth
a48f3ce18a clean up prolouge and epilouge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22346 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 19:52:58 +00:00
Chris Lattner
8d4b9eddc0 Restore some code that was accidentally removed by Nate's patch yesterday.
This fixes the regressions from last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22344 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 17:12:53 +00:00
Nate Begeman
b8aa3ac678 Fix a typo in my checkin today that caused regressions. Oops!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22341 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 06:32:01 +00:00
Nate Begeman
f63be7d395 First round of support for doing scalar FP using the SSE2 ISA extension and
XMM registers.  There are many known deficiencies and fixmes, which will be
addressed ASAP.  The major benefit of this work is that it will allow the
LLVM register allocator to allocate FP registers across basic blocks.

The x86 backend will still default to x87 style FP.  To enable this work,
you must pass -enable-sse-scalar-fp and either -sse2 or -sse3 to llc.

An example before and after would be for:
double foo(double *P) { double Sum = 0; int i; for (i = 0; i < 1000; ++i)
                        Sum += P[i]; return Sum; }

The inner loop looks like the following:
x87:
.LBB_foo_1:     # no_exit
        fldl (%esp)
        faddl (%eax,%ecx,8)
        fstpl (%esp)
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit

SSE2:
        addsd (%eax,%ecx,8), %xmm0
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22340 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-06 18:59:04 +00:00
Chris Lattner
e0fe225e89 Make several cleanups to Andrews varargs change:
1. Pass Value*'s into lowering methods so that the proper pointers can be
   added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
   chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.
4. Now that we have Value*'s available in the lowering methods, pass them
   into any load/stores from the valist that are emitted


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22339 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:58:54 +00:00
Chris Lattner
08568cfe25 Fit to 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22336 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 17:50:16 +00:00
Chris Lattner
f84a2ace5e Fix PowerPC varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22335 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 17:48:31 +00:00
Andrew Lenharth
619fb52764 check the correct VT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22332 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-04 20:07:21 +00:00
Andrew Lenharth
2f5bca5c15 fix loading address of fp symbols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-03 20:06:13 +00:00
Chris Lattner
6a709a418b Percolate the call up to the right superclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22330 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-03 17:34:39 +00:00
Nate Begeman
4eb74ba602 The statistic needs to be in the correct namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22327 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 23:56:38 +00:00
Chris Lattner
c1671e2d7d Varargs is apparently currently broken on PPC. This hacks it so that it
is at least overloading the right virtual methods.  The implementations
are currently wrong though.  This fixes Ptrdist/bc, but not other programs
(e.g. siod).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22326 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 23:11:56 +00:00
Chris Lattner
b36cbd0286 Refactor X86AsmPrinter.cpp into multiple files. Patch contributed
by Aaron Gray, cleaned up by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22324 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 22:44:09 +00:00
Andrew Lenharth
5d5b17bf91 simplify call code, remove pseudo ops for div and rem, track more loads and stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22323 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 19:14:02 +00:00
Andrew Lenharth
cf8bf388ea simplify call code, remove pseudo ops for div and rem, track more loads and stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22322 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 19:12:13 +00:00
Chris Lattner
5de8b9d796 remove some debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22321 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-01 06:40:58 +00:00
Nate Begeman
9d19eb459c Make the x86 asm printer darwin-aware. This mostly entails doing the same
thing as cygwin most of the time, and printing our alignments in log2
rather than number of bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22316 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-30 00:53:20 +00:00
Andrew Lenharth
06ef88472f restore old srcValueNode behavior and try to to work around it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 18:54:02 +00:00
Andrew Lenharth
782ad62f33 tracking the instructions causing loads and stores provides more information than just the pointer being loaded or stored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22311 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 15:57:19 +00:00
Andrew Lenharth
0cab375231 thinko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22309 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 13:35:05 +00:00
Andrew Lenharth
f4da945302 unify SelectExpr and SelectFP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22308 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 12:49:51 +00:00
Andrew Lenharth
ba5dc44b00 fix most regressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22307 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 12:23:34 +00:00
Andrew Lenharth
fce587e58b support more relocations for stores also
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 00:39:17 +00:00
Andrew Lenharth
c7989cef9d Get rid of all symbolic loads. I now do gernate all relocations sequences
rather than relying on the assembler.  Only a few more pseudo instructions
left.  Also merge load code paths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22305 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 00:31:08 +00:00
Andrew Lenharth
e014f89f3d some call work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22303 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 23:59:51 +00:00
Andrew Lenharth
6968bff783 So, it turns out I forgot that one valid way of restoring GP after a call
is to use RA, which assumes the called function uses RA for the register
holding the return address when it issues a ret.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22301 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 23:24:11 +00:00
Nate Begeman
f1702ac589 Initial set of .td file changes necessary to get scalar fp in xmm registers
working.  The instruction selector changes will hopefully be coming later
this week once they are debugged.  This is necessary to support the darwin
x86 FP model, and is recommended by intel as the replacement for x87.  As
a bonus, the register allocator knows how to deal with these registers
across basic blocks, unliky the FP stackifier.  This leads to significantly
better codegen in several cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:20:31 +00:00
Andrew Lenharth
c95d984f7c get rid of another pseudo op
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22299 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:11:40 +00:00
Andrew Lenharth
02c318e1d2 generate address of constant pool entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22298 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-27 21:02:56 +00:00