Dan Gohman
c3e24d559b
Add initial support for back-scheduling address computations,
...
especially in the case of addresses computed from loop induction
variables.
llvm-svn: 61075
2008-12-16 03:35:01 +00:00
Bill Wendling
13e4a3d0b0
- Use patterns instead of creating completely new instruction matching patterns,
...
which are identical to the original patterns.
- Change the multiply with overflow so that we distinguish between signed and
unsigned multiplication. Currently, unsigned multiplication with overflow
isn't working!
llvm-svn: 60963
2008-12-12 21:15:41 +00:00
Mon P Wang
53d0c96c6f
Added support for SELECT v8i8 v4i16 for X86 (MMX)
...
Added support for TRUNC v8i16 to v8i8 for X86 (MMX)
llvm-svn: 60916
2008-12-12 01:25:51 +00:00
Bill Wendling
5d026e47c1
Redo the arithmetic with overflow architecture. I was changing the semantics of
...
ISD::ADD to emit an implicit EFLAGS. This was horribly broken. Instead, replace
the intrinsic with an ISD::SADDO node. Then custom lower that into an
X86ISD::ADD node with a associated SETCC that checks the correct condition code
(overflow or carry). Then that gets lowered into the correct X86::ADDOvf
instruction.
Similar for SUB and MUL instructions.
llvm-svn: 60915
2008-12-12 00:56:36 +00:00
Evan Cheng
487c9ff802
Some code clean up.
...
llvm-svn: 60850
2008-12-10 21:49:05 +00:00
Bill Wendling
417d88be16
Only perform SETO/SETC to JO/JC conversion if extractvalue is coming from an arithmetic with overflow instruction.
...
llvm-svn: 60844
2008-12-10 19:44:24 +00:00
Evan Cheng
caa31a82fc
Fix MachineCodeEmitter to use uintptr_t instead of intptr_t. This avoids some overflow issues. Patch by Thomas Jablin.
...
llvm-svn: 60828
2008-12-10 02:32:19 +00:00
Bill Wendling
d33b6dfd4f
Whitespace changes.
...
llvm-svn: 60826
2008-12-10 02:01:32 +00:00
Bill Wendling
1c1dacdd42
Implement fast-isel conversion of a branch instruction that's branching on an
...
overflow/carry from the "arithmetic with overflow" intrinsics. It searches the
machine basic block from bottom to top to find the SETO/SETC instruction that is
its conditional. If an instruction modifies EFLAGS before it reaches the
SETO/SETC instruction, then it defaults to the normal instruction emission.
llvm-svn: 60807
2008-12-09 23:19:12 +00:00
Bill Wendling
4c8fb3a0cc
Add sub/mul overflow intrinsics. This currently doesn't have a
...
target-independent way of determining overflow on multiplication. It's very
tricky. Patch by Zoltan Varga!
llvm-svn: 60800
2008-12-09 22:08:41 +00:00
Bill Wendling
d034543c7e
Correct my English.
...
llvm-svn: 60753
2008-12-09 07:55:31 +00:00
Bill Wendling
7250a29def
Add initial support for fast-isel of the [SU]ADDO intrinsics. It isn't
...
complete. For instance, it lowers the common case into this less-than-optimal
code:
addl %ecx, %eax
seto %cl
testb %cl, %cl
jne LBB1_2 ## overflow
instead of:
addl %ecx, %eax
jo LBB1_2 ## overflow
That will come in a future commit.
llvm-svn: 60737
2008-12-09 02:42:50 +00:00
Dan Gohman
9e5cc22129
Fix a couple of mistaken switch case fall-throughs. Thanks to Bill
...
for spotting these!
llvm-svn: 60728
2008-12-08 23:50:06 +00:00
Evan Cheng
3bb2ad8a0a
Re-apply 60689 now my head is screwed on right.
...
llvm-svn: 60711
2008-12-08 19:29:03 +00:00
Dan Gohman
5bca97fc4f
Revert 60689. It caused many regressions on Darwin targets.
...
llvm-svn: 60705
2008-12-08 17:38:02 +00:00
Dan Gohman
14d4094968
Factor out the code for sign-extending/truncating gep indices
...
and use it in x86 address mode folding. Also, make
getRegForValue return 0 for illegal types even if it has a
ValueMap for them, because Argument values are put in the
ValueMap. This fixes PR3181.
llvm-svn: 60696
2008-12-08 07:57:47 +00:00
Evan Cheng
d668dd83c0
Perform cheap checks first.
...
llvm-svn: 60689
2008-12-08 06:52:43 +00:00
Nick Lewycky
e277f75880
Fix typo, psuedo -> pseudo.
...
llvm-svn: 60651
2008-12-07 03:49:52 +00:00
Chris Lattner
00104cf8f8
add a note
...
llvm-svn: 60632
2008-12-06 22:49:05 +00:00
Dale Johannesen
c6404f98b2
Forgot a file.
...
llvm-svn: 60609
2008-12-05 21:55:35 +00:00
Dale Johannesen
f5a072c388
Make LoopStrengthReduce smarter about hoisting things out of
...
loops when they can be subsumed into addressing modes.
Change X86 addressing mode check to realize that
some PIC references need an extra register.
(I believe this is correct for Linux, if not, I'm sure
someone will tell me.)
llvm-svn: 60608
2008-12-05 21:47:27 +00:00
Evan Cheng
03ef7cf749
Reason #3 from 60595 doesn't hold true. If we can fold a PIC load from constpool into a use, the rewrite happens at time of spill (not in VirtRegMap). Later on, if the GlobalBaseReg is spilled, the spiller can see the use uses GlobalBaseReg and do the right thing.
...
llvm-svn: 60596
2008-12-05 17:41:31 +00:00
Evan Cheng
144447bfa0
Effectively undo 60461 in PIC mode which simply transform V_SET0 / V_SETALLONES into a load from constpool in order to fold into restores. This is not safe to do when PIC base is being used for a number of reasons:
...
1. GlobalBaseReg may have been spilled.
2. It may not be live at the use.
3. Spiller doesn't know this is happening so it won't prevent GlobalBaseReg from being spilled later (That by itself is a nasty hack. It's needed because we don't insert the reload until later).
llvm-svn: 60595
2008-12-05 17:23:48 +00:00
Evan Cheng
1b795803dd
Re-did 60519. It turns out Darwin's handling of hidden visibility symbols are a bit more complicate than I expected. Both declarations and weak definitions still need a stub indirection. However, the stubs are in data section and they contain the addresses of the actual symbols.
...
llvm-svn: 60571
2008-12-05 01:06:39 +00:00
Bill Wendling
a0466523bd
Temporarily revert r60519. It was causing a bootstrap failure:
...
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT barrier.lo -MD -MP -MF .deps/barrier.Tpo -c ../../../llvm-gcc.src/libgomp/barrier.c -fno-common -DPIC -o .libs/barrier.o
checking for sys/file.h... /var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:non-relocatable subtraction expression, "_gomp_tls_key" minus "L1$pb"
/var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:symbol: "_gomp_tls_key" can't be undefined in a subtraction expression
make[4]: *** [barrier.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c ../../../llvm-gcc.src/libgomp/alloc.c -o alloc.o >/dev/null 2>&1
yes
checking for sys/param.h... make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libgomp] Error 2
make[1]: *** Waiting for unfinished jobs....
llvm-svn: 60527
2008-12-04 04:07:00 +00:00
Evan Cheng
d4b7459179
Visibility hidden GVs do not require extra load of symbol address from the GOT or non-lazy-ptr.
...
llvm-svn: 60519
2008-12-04 01:56:50 +00:00
Evan Cheng
05ded29738
Use mmx (punpckldq VR64, (mmx_v_set0)) to clear high 32-bits of a VR64 register.
...
llvm-svn: 60499
2008-12-03 19:38:05 +00:00
Dan Gohman
74529a2226
Split foldMemoryOperand into public non-virtual and protected virtual
...
parts, and add target-independent code to add/preserve
MachineMemOperands.
llvm-svn: 60488
2008-12-03 18:43:12 +00:00
Dan Gohman
5dad0993a9
Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
...
llvm-svn: 60487
2008-12-03 18:15:48 +00:00
Dan Gohman
fc05cdda64
Extend X86's addFrameReference to add a MachineMemOperand for
...
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.
llvm-svn: 60486
2008-12-03 18:11:40 +00:00
Rafael Espindola
0c800cf35e
Fix bug 3140.
...
Print a single parameter .file directive if we have an ELF target.
llvm-svn: 60480
2008-12-03 11:01:37 +00:00
Evan Cheng
440e75e1d5
Refactor code. No functionality change.
...
llvm-svn: 60478
2008-12-03 08:38:43 +00:00
Bill Wendling
d2208d570b
CC should only be a ConstantSDNode at this point. Just use 'cast' instead of 'dyn_cast'.
...
llvm-svn: 60477
2008-12-03 08:32:02 +00:00
Dan Gohman
ac6561793c
Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
...
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.
Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).
llvm-svn: 60461
2008-12-03 05:21:24 +00:00
Dan Gohman
86b0a220af
Fix this comment to reflect that it applies to types other
...
than just i32.
llvm-svn: 60455
2008-12-03 01:39:44 +00:00
Dan Gohman
dcd4896f12
Fix byval arguments in the fastcc calling convention. The fastcc convention
...
delegates to the regular x86-32 convention which handles byval, but only
after it handles a few cases, and it's necessary to handle byval before
handling those cases. This fixes PR3122 (and rdar://6400815), llvm-gcc
miscompiling LLVM.
llvm-svn: 60453
2008-12-03 01:28:04 +00:00
Bill Wendling
580f12ae30
Second stab at target-dependent lowering of everyone's favorite nodes: [SU]ADDO
...
- LowerXADDO lowers [SU]ADDO into an ADD with an implicit EFLAGS define. The
EFLAGS are fed into a SETCC node which has the conditional COND_O or COND_C,
depending on the type of ADDO requested.
- LowerBRCOND now recognizes if it's coming from a SETCC node with COND_O or
COND_C set.
llvm-svn: 60388
2008-12-02 01:06:39 +00:00
Bill Wendling
039240b301
Reapply r60382. This time, don't mark "ADC" nodes with "implicit EFLAGS".
...
llvm-svn: 60385
2008-12-02 00:07:05 +00:00
Bill Wendling
16840cba04
Temporarily revert r60382. It caused CodeGen/X86/i2k.ll and others to fail.
...
llvm-svn: 60383
2008-12-01 23:44:08 +00:00
Bill Wendling
628848b540
- Have "ADD" instructions return an implicit EFLAGS.
...
- Add support for seto, setno, setc, and setnc instructions.
llvm-svn: 60382
2008-12-01 23:30:42 +00:00
Duncan Sands
5de8739964
There are no longer any places that require a
...
MERGE_VALUES node with only one operand, so get
rid of special code that only existed to handle
that possibility.
llvm-svn: 60349
2008-12-01 11:41:29 +00:00
Duncan Sands
1fae2ea219
Change the interface to the type legalization method
...
ReplaceNodeResults: rather than returning a node which
must have the same number of results as the original
node (which means mucking around with MERGE_VALUES,
and which is also easy to get wrong since SelectionDAG
folding may mean you don't get the node you expect),
return the results in a vector.
llvm-svn: 60348
2008-12-01 11:39:25 +00:00
Eli Friedman
3b8efd50d7
A couple small cleanups, plus a new potential optimization.
...
llvm-svn: 60286
2008-11-30 07:52:27 +00:00
Duncan Sands
7fd4ea5847
Fix build with gcc-4.4: it doesn't like PICStyle
...
being both a namespace and a variable name.
llvm-svn: 60208
2008-11-28 09:29:37 +00:00
Bill Wendling
4a6eedb51d
Comment out code that isn't entirely correct.
...
llvm-svn: 60156
2008-11-27 07:18:35 +00:00
Evan Cheng
f18016728c
On x86 favors folding short immediate into some arithmetic operations (e.g. add, and, xor, etc.) because materializing an immediate in a register is expensive in turns of code size.
...
e.g.
movl 4(%esp), %eax
addl $4, %eax
is 2 bytes shorter than
movl $4, %eax
addl 4(%esp), %eax
llvm-svn: 60139
2008-11-27 00:49:46 +00:00
Bill Wendling
c60a07dbf2
Generate something sensible for an [SU]ADDO op when the overflow/carry flag is
...
the conditional for the BRCOND statement. For instance, it will generate:
addl %eax, %ecx
jo LOF
instead of
addl %eax, %ecx
; About 10 instructions to compare the signs of LHS, RHS, and sum.
jl LOF
llvm-svn: 60123
2008-11-26 22:37:40 +00:00
Dan Gohman
6a589b31f7
Fish kill flag annotations in PUSH instructions.
...
llvm-svn: 60095
2008-11-26 06:39:12 +00:00
Bill Wendling
0560ba7668
- Make lowering of "add with overflow" customizable by back-ends.
...
- Mark "add with overflow" as having a custom lowering for X86. Give it a null
lowering representation for now.
llvm-svn: 59971
2008-11-24 19:21:46 +00:00
Evan Cheng
a19ef59d6c
Move target independent td files from lib/Target/ to include/llvm/Target so they can be distributed along with the header files.
...
llvm-svn: 59953
2008-11-24 07:34:46 +00:00