Commit Graph

3446 Commits

Author SHA1 Message Date
Evan Cheng
2749c72f30 Fix bug in x86 memcpy / memset lowering. If there are trailing bytes not handled by rep instructions, a new memcpy / memset is introduced for them. However, since source / destination addresses are already adjusted, their offsets should be zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 00:26:43 +00:00
Anton Korobeynikov
941ff5818b Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:24:25 +00:00
Anton Korobeynikov
dc28bd43d3 Only allow increase of max alignment value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:23:50 +00:00
Anton Korobeynikov
d52bdaff0c Be over-conservative: scan for all used virtual registers and calculate maximal stack alignment in assumption, that there will be spill of vector register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50167 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:23:30 +00:00
Anton Korobeynikov
856914fe00 Add X86 Maximal Stack Alignment Calculator Pass before RA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:23:05 +00:00
Anton Korobeynikov
2c430cbf03 Do proper book-keeping of offsets and prologue/epilogue code for stack realignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:21:27 +00:00
Anton Korobeynikov
8e91ec5e29 If stack realignment is used - incoming args will use EBP as base register and locals - ESP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:21:02 +00:00
Anton Korobeynikov
b51dce3013 Eastimate required stack alignment early, so we can decide, whether we will need frame pointer or not
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:20:17 +00:00
Anton Korobeynikov
d1c133a051 Cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:19:23 +00:00
Anton Korobeynikov
82751e3eda Simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:18:36 +00:00
Anton Korobeynikov
45709ae09b Make stack alignment options global for all targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:18:10 +00:00
Anton Korobeynikov
cfcd20e7be Provide option for enabling-disabling stack realignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:17:11 +00:00
Anton Korobeynikov
35410a493b Disable stack realignment for functions with dynamic-sized alloca's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50155 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:16:43 +00:00
Anton Korobeynikov
890fe888be Provide ABI-correct stack alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50154 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:16:16 +00:00
Anton Korobeynikov
9bbbea568c Provide convenient helpers for some operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:15:48 +00:00
Anton Korobeynikov
e201190eb7 Whitespace cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:15:11 +00:00
Dan Gohman
61a9213440 Implement an x86-64 ABI detail of passing structs by hidden first
argument. The x86-64 ABI requires the incoming value of %rdi to
be copied to %rax on exit from a function that is returning a
large C struct.

Also, add a README-X86-64 entry detailing the missed optimization
opportunity and proposing an alternative approach.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 23:59:07 +00:00
Dan Gohman
0416b0a26d Fix the encoding of the MMX movd that moves from MMX to 64-bit GPR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 19:52:29 +00:00
Chris Lattner
7d717a0b70 Add an ugly note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50029 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 04:46:30 +00:00
Nicolas Geoffray
546e36a2c1 Don't forget to update the current operand when getting the size of an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 23:36:47 +00:00
Chris Lattner
bd381a777b A better fix for my previous patch, MOVZQI2PQIrr just requires SSE2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 05:52:46 +00:00
Chris Lattner
02a260aa11 Switch to using Simplified ConstantFP::get API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 00:41:09 +00:00
Evan Cheng
94d7b02c5a Also LXCHG64 -> XCHG64rm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 02:05:42 +00:00
Evan Cheng
bb6939dcff xchg which references a memory operand does not need to lock prefix. Atomicity is guaranteed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 01:20:30 +00:00
Dan Gohman
28269139ee Fix the handling of va_copy on x86-64. As of llvm-gcc r49920
llvm-gcc is now lowering va_copy on x86-64, so this completes
the fix for PR2230.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 20:55:41 +00:00
Evan Cheng
7e03280b53 - Fix atomic operation JIT encoding.
- Remove unused instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 20:55:36 +00:00
Evan Cheng
3f73beaeb2 Also support Intel asm syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 23:35:10 +00:00
Evan Cheng
9d1a81a23c Fix assembly code for atomic operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 21:26:35 +00:00
Evan Cheng
03eb38848c Don't forget about sub-register indices when rematting instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:44:44 +00:00
Dale Johannesen
5e8fb81353 Unbreak build on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:24:33 +00:00
Nicolas Geoffray
51cc3c13ea Correlate stubs with functions in JIT: when emitting a stub, the JIT tells the memory manager which function
the stub will resolve.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49814 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:46:05 +00:00
Nicolas Geoffray
52e724ad7e Infrastructure for getting the machine code size of a function and an instruction. X86, PowerPC and ARM are implemented
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:10:13 +00:00
Evan Cheng
dc00858e11 Initialize X863DNowLevel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 19:03:02 +00:00
Roman Levenstein
9cac5259fe Ongoing work on improving the instruction selection infrastructure:
Rename SDOperandImpl back to SDOperand.
Introduce the SDUse class that represents a use of the SDNode referred by
an SDOperand. Now it is more similar to Use/Value classes.

Patch is approved by Dan Gohman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 16:15:27 +00:00
Dan Gohman
171c11ec93 Add support for the form of the SSE41 extractps instruction that
puts its result in a 32-bit GPR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 02:32:24 +00:00
Dan Gohman
bcda285fcc Recreate the size SDNode instead of reusing the old one in the x86
memcpy lowering code; this ensures that the size node has the desired
result type. This fixes a regression from r49572 with @llvm.memcpy.i64
on x86-32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 01:32:32 +00:00
Dan Gohman
302cd54299 Remove X86_64SRet; it isn't used anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 00:24:30 +00:00
Dan Gohman
a630f4ed91 Add movd instructions to move from MMX registers
to 64-bit GPR registers on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49757 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 23:55:07 +00:00
Dan Gohman
29e4bdbf27 Fix const-correctness issues with the SrcValue handling in the
memory intrinsic expansion code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:55:48 +00:00
Dale Johannesen
3541af73b6 Reverse sense of unwind-tables option. This means
stack tracebacks on Darwin x86-64 won't work by default;
nevertheless, everybody but me thinks this is a good idea.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:54:17 +00:00
Anton Korobeynikov
78c80fdbdd Provide option for stack alignment override
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49593 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 22:12:22 +00:00
Arnold Schwaighofer
4b5324ad2c This patch corrects the handling of byval arguments for tailcall
optimized x86-64 (and x86) calls so that they work (... at least for
my test cases).

Should fix the following problems:

Problem 1: When i introduced the optimized handling of arguments for
tail called functions (using a sequence of copyto/copyfrom virtual
registers instead of always lowering to top of the stack) i did not
handle byval arguments correctly e.g they did not work at all :).

Problem 2: On x86-64 after the arguments of the tail called function
are moved to their registers (which include ESI/RSI etc), tail call
optimization performs byval lowering which causes xSI,xDI, xCX
registers to be overwritten. This is handled in this patch by moving
the arguments to virtual registers first and after the byval lowering
the arguments are moved from those virtual registers back to
RSI/RDI/RCX.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 18:11:06 +00:00
Dan Gohman
707e018423 Drop ISD::MEMSET, ISD::MEMMOVE, and ISD::MEMCPY, which are not Legal
on any current target and aren't optimized in DAGCombiner. Instead
of using intermediate nodes, expand the operations, choosing between
simple loads/stores, target-specific code, and library calls,
immediately.

Previously, the code to emit optimized code for these operations
was only used at initial SelectionDAG construction time; now it is
used at all times. This fixes some cases where rep;movs was being
used for small copies where simple loads/stores would be better.

This also cleans up code that checks for alignments less than 4;
let the targets make that decision instead of doing it in
target-independent code. This allows x86 to use rep;movs in
low-alignment cases.

Also, this fixes a bug that resulted in the use of rep;stos for
memsets of 0 with non-constant memory size when the alignment was
at least 4. It's better to use the library in this case, which
can be significantly faster when the size is large.

This also preserves more SourceValue information when memory
intrinsics are lowered into simple loads/stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 04:36:06 +00:00
Dan Gohman
6f836adafe Fix a bug that prevented x86-64 from using rep.movsq for
8-byte-aligned data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 02:35:39 +00:00
Nate Begeman
6795ebb663 80 col fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 00:47:57 +00:00
Chris Lattner
2189c17443 add a note, this is actually not too bad to implement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 05:54:50 +00:00
Chris Lattner
a825d75f1d move the x86-32 part of PR2108 here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 05:37:47 +00:00
Chris Lattner
db66750753 Fix the x86-64 side of PR2108 by adding a v2f64 version of
MOVZQI2PQIrr.  This would be better handled as a dag combine 
(with the goal of eliminating the bitconvert) but I don't know
how to do that safely.  Thoughts welcome.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 05:13:43 +00:00
Dan Gohman
7d8143f0ef Make isVectorClearMaskLegal's operand list const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 20:09:42 +00:00
Dan Gohman
c2ffd4b1cb Add XMM1 as a second return value register for f32 and f64 on x86-64. This
is needed for the x86-64-ABI handling of structs that contain floating-point
members that are returned by value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 17:54:37 +00:00
Dan Gohman
719e64e8c1 Add DX as a second return value register for i16 on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 17:53:38 +00:00
Dale Johannesen
f2247cfb38 Handle the situation in 2008-01-25-EmptyFunction.ll
correctly when unwind info is being generated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 00:37:56 +00:00
Dale Johannesen
4e1b79459f Implement new llc flag -disable-required-unwind-tables.
Corresponds to -fno-unwind-tables (usually default in gcc).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 00:10:24 +00:00
Dan Gohman
36b5c1338a Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 19:35:22 +00:00
Roman Levenstein
dc1adac582 Re-commit of the r48822, where the infinite looping problem discovered
by Dan Gohman is fixed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 10:06:32 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
Evan Cheng
0c0f83ff5d Favors pshufd over shufps when shuffling elements from one vector. pshufd is faster than shufps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-05 00:30:36 +00:00
Evan Cheng
43b7ca15a3 Re-enable SSE4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 08:53:29 +00:00
Evan Cheng
ab394bdcc0 Fix x86-64 encoding bug. REX prefix must always follow 0x0F prefix. For example, extractps in 64bit mode: 66 REX 0F 3A 17, not 66 0F 3A REX 17.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 08:53:17 +00:00
Evan Cheng
90ce87b5bd Cosmetic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 07:45:18 +00:00
Evan Cheng
b4e56d4a2b Temporarily disabling SSE4 until we fix the encoding issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 04:49:54 +00:00
Evan Cheng
6397c64441 Backing out 48222 temporarily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 03:13:16 +00:00
Dale Johannesen
e00406281d Cosmetic changes per EH patch review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 17:04:45 +00:00
Anton Korobeynikov
67073f1cbd Add new CC lowering rule: provide a list of registers, which can be 'shadowed',
when some another register is used for argument passing.
Currently is used on Win64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 05:23:57 +00:00
Dale Johannesen
1532f3ddd7 Recommitting EH patch; this should answer most of the
review feedback.
-enable-eh is still accepted but doesn't do anything.
EH intrinsics use Dwarf EH if the target supports that,
and are handled by LowerInvoke otherwise.
The separation of the EH table and frame move data is,
I think, logically figured out, but either one still
causes full EH info to be generated (not sure how to
split the metadata correctly).
MachineModuleInfo::needsFrameInfo is no longer used and
is removed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 00:25:04 +00:00
Evan Cheng
ffe2eb0120 ReMat of load from stub in pic mode extends the life of pic base. Currently spiller doesn't do a good job of estimating the impact. Disable for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49059 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 23:26:12 +00:00
Evan Cheng
247faffb32 Remove unnecessary and non-deterministic checking code. Re-enable remat of load from gv stub.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 21:38:20 +00:00
Dan Gohman
38c92263eb Don't use __bzero for memset if the second argument isn't zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 20:56:18 +00:00
Dan Gohman
68d599df37 Speculatively micro-optimize memory-zeroing calls on Darwin 10.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 20:38:36 +00:00
Dale Johannesen
b6d5b14390 Revert 49006 for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 20:00:57 +00:00
Evan Cheng
78b6ce3981 Disabling remat of load from gv stub (temporarily) again to fix llvmgcc bootstrap miscompare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 07:33:13 +00:00
Dale Johannesen
2ffbcaccd1 Accept 'y' constraint (MMX) in inline asm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 00:57:48 +00:00
Dale Johannesen
1544e4713b Emit exception handling info for functions which are
not marked nounwind, or for all functions when -enable-eh
is set, provided the target supports Dwarf EH.

llvm-gcc generates nounwind in the right places; other FEs
will need to do so also.  Given such a FE, -enable-eh should
no longer be needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 23:40:23 +00:00
Evan Cheng
427f4c106a It's not safe to fold a load from GV stub or constantpool into a two-address use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 23:19:51 +00:00
Evan Cheng
ca1267c02b Move reMaterialize() from TargetRegisterInfo to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 20:40:39 +00:00
Evan Cheng
9d15abe838 Re-apply 48911.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 07:54:19 +00:00
Dan Gohman
d4a2ad35e3 Fix a tokenfactor node to use the load chain rather than the
load value. This fixes PR2177.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 23:45:16 +00:00
Evan Cheng
4db4f1ce7e Backing out 48911 for now. It's breaking stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 17:49:06 +00:00
Evan Cheng
ddf0a06580 New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48912 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 07:07:06 +00:00
Evan Cheng
86f57b0983 Load from stub is already re-materializable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 06:49:25 +00:00
Evan Cheng
e3d8dbf479 Code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 01:45:11 +00:00
Evan Cheng
e771ebd7a3 Allow certain lea instructions to be rematerialized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 01:41:09 +00:00
Evan Cheng
d1e4b3515c Remove an unused command line option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48854 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 01:30:24 +00:00
Roman Levenstein
e326332acd Use a linked data structure for the uses lists of an SDNode, just like
LLVM Value/Use does and MachineRegisterInfo/MachineOperand does.
This allows constant time for all uses list maintenance operations.

The idea was suggested by Chris. Reviewed by Evan and Dan.
Patch is tested and approved by Dan.

On normal use-cases compilation speed is not affected. On very big basic
blocks there are compilation speedups in the range of 15-20% or even better. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 12:39:26 +00:00
Evan Cheng
7aae876db1 Fix some SSE4.1 instruction encoding bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 08:11:49 +00:00
Dale Johannesen
27c31054ec Use ## for comment delimiter on darwin x86-32, so
llvm's output .s files will go through gcc -std=c99
without triggering preprocesser errors.  Approach
suggested by Daveed Vandevoorde.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 23:29:30 +00:00
Evan Cheng
e22e62b5c0 Smaller function alignment when optimizing for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:29:46 +00:00
Dan Gohman
950a4c40b8 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:06:05 +00:00
Dan Gohman
cfbb2f074d A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 21:45:14 +00:00
Dan Gohman
27845362d9 Add CMP32mr and friends to the load-unfolding table. Among
other things, this allows the scheduler to unfold a load operand
in the 2008-01-08-SchedulerCrash.ll testcase, so it now successfully
clones the comparison to avoid a pushf+popf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 16:53:19 +00:00
Evan Cheng
62a3f1538c - SSE4.1 extractfps extracts a f32 into a gr32 register. Very useful! Not. Fix the instruction specification and teaches lowering code to use it only when the only use is a store instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 21:52:23 +00:00
Evan Cheng
3d5cd6118d Remove duplicated entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 22:56:07 +00:00
Anton Korobeynikov
82818eb223 Minor typo fixes. Also add another FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 20:32:06 +00:00
Anton Korobeynikov
f8e7416632 Add license header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48707 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 14:53:18 +00:00
Anton Korobeynikov
231e964ad2 Add Win64 compilation callback. This allows easy examples to be JITed on Win64!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 14:44:32 +00:00
Anton Korobeynikov
8c27829514 Provide a JIT selector on win64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:43:47 +00:00
Anton Korobeynikov
c15b81ba17 Hack out the PIC mode on Win64 targets. This needs to be investigated later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:41:18 +00:00
Anton Korobeynikov
fd9d976d74 Code cleanup. Provide generic way of selecting JIT pointer bitwidth regardless
of compiler used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:40:45 +00:00
Anton Korobeynikov
6aeedfd0f5 Remove old-standing obsolete code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 12:32:54 +00:00
Anton Korobeynikov
2b4f780585 Honour built-in defines on win64 targets for automatically subtarget recognize.
Force stack alignment to 16 bytes on win targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:18:22 +00:00
Anton Korobeynikov
508f0fdb53 Recognize "windows" in target triple, not only "win32"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:12:53 +00:00
Anton Korobeynikov
1dcce2148d Add information about callee-saved registers on Win64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:04:01 +00:00
Anton Korobeynikov
1a979d9eab Add convenient helper for win64 check. Simplify things slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 20:57:27 +00:00
Anton Korobeynikov
8f88cb0899 Initial support for Win64 calling conventions. Still in early state.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 20:37:30 +00:00
Anton Korobeynikov
c73ede0a9b Another comments fixing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 07:53:40 +00:00
Chris Lattner
35831d06fd Restore this assert now that the livevar bug is fixed.
This verifies kill info for "ret" fp operands is right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 20:41:27 +00:00
Duncan Sands
276dcbdc8d Introduce a new node for holding call argument
flags.  This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines.  There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness.  As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 09:14:45 +00:00
Chris Lattner
920c37afc5 remove Evan's "ugly hack" that sorta attempted to get
x86-64 return conventions correct, but was never enabled.
We can now do the "right thing" with multiple return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 06:50:21 +00:00
Chris Lattner
24e0a546b4 Add support for calls that return two FP values in
ST(0)/ST(1).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48634 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 06:38:26 +00:00
Chris Lattner
ae60ddc22a disable a bogus assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48633 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 06:01:05 +00:00
Chris Lattner
0353526ed1 Enable support for returning two long-double values in ST(0)/ST(1).
This allows us to compile fp-stack-2results.ll into:

_test:
	fldz
	fld1
	ret

which returns 1 in ST(0) and 0 in ST(1).  This is needed for x86-64
_Complex long double.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 05:57:20 +00:00
Evan Cheng
fa5a91a71e Undo 48570. Correctly match mmx shift instructions with an immediate operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 00:40:09 +00:00
Evan Cheng
260e07ec8c Fix this xform: (sra (shl X, m), result_size) -> (sign_extend (trunc (shl X, result_size - n - m)))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48578 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 02:18:41 +00:00
Evan Cheng
dff1dcac6c Add intrinsics to match mmx shift builtin's with immediate operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 23:38:52 +00:00
Arnold Schwaighofer
4fe3073cfb Don't loose incoming argument registers. Fix documentation style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 16:39:45 +00:00
Christopher Lamb
15cbde3cf6 Fix X86's isTruncateFree to not claim that truncate to i1 is free. This fixes Bill's testcase that failed for r48491.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 08:30:06 +00:00
Bill Wendling
bebc3642d3 On Darwin, GCC issues a ".globl" for something that has a "visibility protected"
attribute instead of ".protected".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48516 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:38:12 +00:00
Evan Cheng
586ccac4ec Fix a x86-64 isel lowering bug that's been around forever. A x86-64 varargs function implicitly reads X86::AL, don't clobber it!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:36:35 +00:00
Evan Cheng
d183307639 Unbreak JIT. Ignore TargetInstrInfo::IMPLICIT_DEF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48447 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 06:56:52 +00:00
Nate Begeman
bc4efb8ac7 Add a couple missing SSE4 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 21:14:46 +00:00
Christopher Lamb
c929823525 Make insert_subreg a two-address instruction, vastly simplifying LowerSubregs pass. Add a new TII, subreg_to_reg, which is like insert_subreg except that it takes an immediate implicit value to insert into rather than a register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 03:12:01 +00:00
Evan Cheng
da47e6e0d0 Replace all target specific implicit def instructions with a target independent one: TargetInstrInfo::IMPLICIT_DEF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15 00:03:38 +00:00
Evan Cheng
029d9dafa0 Fix some 80 col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 07:46:48 +00:00
Evan Cheng
172b794cd5 Fix a number of encoding bugs. SSE 4.1 instructions MPSADBWrri, PINSRDrr, etc. have 8-bits immediate field (ImmT == Imm8).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48360 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 07:39:27 +00:00
Evan Cheng
17ed8fa63d Add debugging stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 07:13:42 +00:00
Chris Lattner
69a74ab421 Add an issue that is preventing instcombine from doing a simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 06:00:19 +00:00
Christopher Lamb
6634e26aa1 Get rid of a pseudo instruction and replace it with subreg based operation on real instructions, ridding the asm printers of the hack used to do this previously. In the process, update LowerSubregs to be careful about eliminating copies that have side affects.
Note: the coalescer will have to be careful about this too, when it starts coalescing insert_subreg nodes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 05:47:01 +00:00
Chris Lattner
58d74910c6 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Evan Cheng
c8e3b147ee Clean up my own mess.
X86 lowering normalize vector 0 to v4i32. However DAGCombine can fold (sub x, x) -> 0 after legalization. It can create a zero vector of a type that's not expected (e.g. v8i16). We don't want to disable the optimization since leaving a (sub x, x) is really bad. Add isel patterns for other types of vector 0 to ensure correctness. It's highly unlikely to happen other than in bugpoint reduced test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:02:50 +00:00
Anton Korobeynikov
4d86e2a6b8 Correctly propagate thread-local flag from aliasee to alias. This fixes PR2137
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 22:38:53 +00:00
Dan Gohman
bfae83139d Use PassManagerBase instead of FunctionPassManager for functions
that merely add passes. This allows them to be used with either
FunctionPassManager or PassManager, or even with a custom new
kind of pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 22:29:46 +00:00
Chris Lattner
e12ecf272d Implement basic support for the 'f' register class constraint. This basically
works, but probably won't if you mix it with 't' or 'u' yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48243 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 19:50:13 +00:00
Chris Lattner
1d38677e34 coalesce away 80-bit floating point copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 19:30:09 +00:00
Chris Lattner
07f7cc3ddb convert a massive if statement to a switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48240 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 19:28:17 +00:00
Chris Lattner
fce84acbbc start handling the 'f' x87 constraint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 19:06:29 +00:00
Christopher Lamb
1bc1008b38 Missed part of recommit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 10:27:36 +00:00
Christopher Lamb
1fab4a6bbb Recommitting parts of r48130. These do not appear to cause the observed failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 10:09:17 +00:00
Evan Cheng
204496d58e In 32-bit mode, mark 64-bit GPR's as unallocatable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 07:16:00 +00:00
Nick Lewycky
3c78697a3c Fix the build on gcc 4.2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 05:56:09 +00:00
Chris Lattner
447ff68c08 Change the model for FP Stack return to use fp operands on the
RET instruction instead of using FpSET_ST0_32.  This also generalizes
the code to handling returning of multiple FP results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 03:23:40 +00:00
Chris Lattner
183275a627 abort with an assert instead of a cerr to get line#
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48199 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 23:56:08 +00:00
Chris Lattner
03fdec04d1 Don't emit FP_REG_KILL into a block that just returns. Nothing
can be live out of the block anyway, so it isn't needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48192 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 23:34:12 +00:00
Chris Lattner
8e6da15e54 Eliminate the FP_GET_ST0/FP_SET_ST0 target-specific dag nodes, just lower to
copyfromreg/copytoreg instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 21:08:41 +00:00
Evan Cheng
d2cde68855 Default ISD::PREFETCH to expand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 19:38:10 +00:00
Evan Cheng
4499e495ea Revert 48125, 48126, and 48130 for now to unbreak some x86-64 tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48167 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 19:31:26 +00:00
Scott Michel
5b8f82e35b Give TargetLowering::getSetCCResultType() a parameter so that ISD::SETCC's
return ValueType can depend its operands' ValueType.

This is a cosmetic change, no functionality impacted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48145 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 15:42:14 +00:00
Christopher Lamb
3feb0170a8 Allow insert_subreg into implicit, target-specific values.
Change insert/extract subreg instructions to be able to be used in TableGen patterns.
Use the above features to reimplement an x86-64 pseudo instruction as a pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 06:12:08 +00:00
Dale Johannesen
b8cafe3427 Increase ISD::ParamFlags to 64 bits. Increase the ByValSize
field to 32 bits, thus enabling correct handling of ByVal
structs bigger than 0x1ffff.  Abstract interface a bit.
Fixes gcc.c-torture/execute/pr23135.c and 
gcc.c-torture/execute/pr28982b.c in gcc testsuite (were ICE'ing
on ppc32, quietly producing wrong code on x86-32.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 02:17:22 +00:00
Chris Lattner
f30e1cf9b7 teach X86InstrInfo::copyRegToReg how to copy into ST(0) from
an RFP register class.

Teach ScheduleDAG how to handle CopyToReg with different src/dst 
reg classes.

This allows us to compile trivial inline asms that expect stuff
on the top of x87-fp stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48107 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 09:15:31 +00:00
Chris Lattner
5c927500c8 add some code to support cross-register class copying from
RST -> RFP{32/64/80}.  We only handle ST(0) for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 08:46:19 +00:00
Chris Lattner
90b347dc90 rearrange some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 07:58:04 +00:00
Chris Lattner
8dc023f684 claim ST(x) registers are 80 bits, which is true. This doesn't affect
codegen yet because these can't be spilled (they don't exist until after RA).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 07:49:01 +00:00
Chris Lattner
afb23f48a4 rename FP_SETRESULT -> FP_SET_ST0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 07:08:44 +00:00
Chris Lattner
6fa2f9c636 rename FpGETRESULT32 -> FpGET_ST0_32 etc. Add support for
isel'ing value preserving FP roundings from one fp stack reg to another
into a noop, instead of stack traffic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 07:05:32 +00:00
Chris Lattner
67f453aae7 Finish implementing a readme entry: when inserting an i64 variable
into a vector of zeros or undef, and when the top part is obviously
zero, we can just use movd + shuffle.  This allows us to compile
vec_set-B.ll into:

_test3:
	movl	$1234567, %eax
	andl	4(%esp), %eax
	movd	%eax, %xmm0
	ret

instead of:

_test3:
	subl	$28, %esp
	movl	$1234567, %eax
	andl	32(%esp), %eax
	movl	%eax, (%esp)
	movl	$0, 4(%esp)
	movq	(%esp), %xmm0
	addl	$28, %esp
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 05:42:06 +00:00
Chris Lattner
f68cbceb17 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 01:08:22 +00:00
Chris Lattner
62098040a1 Implement a readme entry, compiling
#include <xmmintrin.h>
__m128i doload64(short x) {return _mm_set_epi16(0,0,0,0,0,0,0,1);}

into:
	movl	$1, %eax
	movd	%eax, %xmm0
	ret

instead of a constant pool load.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 01:05:04 +00:00
Chris Lattner
19f7969f81 1) Improve comments.
2) Don't try to insert an i64 value into the low part of a 
   vector with movq on an x86-32 target.  This allows us to 
   compile:

__m128i doload64(short x) {return _mm_set_epi16(0,0,0,0,0,0,0,1);}

into:

_doload64:
	movaps	LCPI1_0, %xmm0
	ret

instead of:

_doload64:
	subl	$28, %esp
	movl	$0, 4(%esp)
	movl	$1, (%esp)
	movq	(%esp), %xmm0
	addl	$28, %esp
	ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 22:59:52 +00:00
Chris Lattner
c9517fb6eb minor simplifications to this code, don't create a dead
SCALAR_TO_VECTOR on paths that end up not using it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 22:48:29 +00:00
Chris Lattner
b607f9c822 This one looks easy, add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 22:32:39 +00:00
Chris Lattner
f658ad10f6 move these to the appropriate file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 22:28:45 +00:00
Evan Cheng
27b7db549e Implement x86 support for @llvm.prefetch. It corresponds to prefetcht{0|1|2} and prefetchnta instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 00:58:38 +00:00
Chris Lattner
d1108222fd mark frem as expand for all legal fp types on x86, regardless of whether
we're using SSE or not.  This fixes PR2122.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 06:36:32 +00:00
Gabor Greif
2cf36e0772 some more spelling changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-06 10:51:21 +00:00
Chris Lattner
4d93b2f16d evan implemented this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 17:11:51 +00:00
Evan Cheng
e9083d669a isTwoAddress = 1 -> Constraints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 08:19:16 +00:00
Evan Cheng
e7b8a8b713 PSLLWri etc. are two-address instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 08:11:27 +00:00
Chris Lattner
063d825208 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 07:22:39 +00:00
Evan Cheng
b7664c6173 Ignore debugging related instructions if they get this far.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 02:34:36 +00:00
Evan Cheng
0b21390a86 Rather than asserting. Dump out the MI that we are not able to encode and abort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 02:08:03 +00:00
Evan Cheng
6fd599fa69 Add a target lowering hook to control whether it's worthwhile to compress fp constant.
For x86, if sse2 is available, it's not a good idea since cvtss2sd is slower than a movsd load and it prevents load folding. On x87, it's important to shrink fp constant since fldt is very expensive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47931 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 01:30:59 +00:00
Andrew Lenharth
d19189e990 64bit CAS on 32bit x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 01:15:49 +00:00
Evan Cheng
6130f66eaa Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 00:59:57 +00:00
Andrew Lenharth
a76e2f0331 x86-64 atomics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:13:33 +00:00
Evan Cheng
32967d2c7d 80 column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 03:20:06 +00:00
Evan Cheng
07b7ea1a48 Remove -always-fold-and-in-test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 00:40:35 +00:00
Dan Gohman
4c1fa61652 Add support for lowering i64 SRA_PARTS and friends on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 22:22:09 +00:00
Devang Patel
41e2397b72 s/isReturnStruct()/hasStructRetAttr()/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 21:46:28 +00:00
Chris Lattner
767486b1d5 Evan implemented these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-02 18:05:14 +00:00
Andrew Lenharth
fe0753efba good catch anton
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 23:18:21 +00:00
Andrew Lenharth
ce1105da43 make CAS work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 22:27:48 +00:00
Andrew Lenharth
26ed8697d4 all but CAS working on x86
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 21:52:34 +00:00
Andrew Lenharth
ea7da50e5a Add lock prefix support to x86. Also add the instructions necessary for the atomic ops. They are still marked pseudo, since I cannot figure out what format to use, but they are the correct opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 13:37:02 +00:00
Anton Korobeynikov
8213f9cf94 Use enumeration for preffered EH dwarf encoding reason
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 22:09:08 +00:00
Anders Carlsson
b26947e967 Use the correct instruction encodings for the 64-bit MMX movd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 01:35:12 +00:00
Evan Cheng
d703ed6aed Added option -align-loops=<true/false> to disable loop aligner pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 23:29:57 +00:00
Evan Cheng
e526d8a955 Set to default: x86 no longer fold and into test if it has more than one use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 07:46:38 +00:00
Chris Lattner
daf6c541b2 Add a random not very important note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 04:52:59 +00:00
Evan Cheng
fb8075d03f Add a quick and dirty "loop aligner pass". x86 uses it to align its loops to 16-byte boundaries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 00:43:03 +00:00
Eli Friedman
41ce5b82da A few more small things I've run into.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-28 00:21:43 +00:00
Anton Korobeynikov
cee750fb1e Preparation step for some cleanup/generalization in EH information emission:
provide TAI hook for selection of EH data emission format. Currently unused.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47699 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 23:33:50 +00:00
Evan Cheng
fd1074f171 This is done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 20:26:32 +00:00
Chris Lattner
b09916bdfb Make X86TargetLowering::LowerSINT_TO_FP return without creating a dead
stack slot and store if the  SINT_TO_FP is actually legal.  This allows
us to compile:

double a(double b) {return (unsigned)b;}

to:

_a:
	cvttsd2siq	%xmm0, %rax
	movl	%eax, %eax
	cvtsi2sdq	%rax, %xmm0
	ret

instead of:

_a:
	subq	$8, %rsp
	cvttsd2siq	%xmm0, %rax
	movl	%eax, %eax
	cvtsi2sdq	%rax, %xmm0
	addq	$8, %rsp
	ret

crazy.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 05:57:41 +00:00
Chris Lattner
22eedf4eec this code is correct but strange looking ;-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 05:48:44 +00:00
Chris Lattner
d0ba2a9c14 Compile x86-64-and-mask.ll into:
_test:
	movl	%edi, %eax
	ret

instead of:

_test:
        movl    $4294967295, %ecx
        movq    %rdi, %rax
        andq    %rcx, %rax
        ret

It would be great to write this as a Pat pattern that used subregs 
instead of a 'pseudo' instruction, but I don't know how to do that
in td files.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 05:47:54 +00:00
Chris Lattner
ba309d43aa add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 01:17:20 +00:00
Arnold Schwaighofer
258bb1b8e8 Refactor according to Evan's and Anton's suggestions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 22:21:54 +00:00
Bill Wendling
74ab84c31e Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
would have been a Godsend here!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 21:11:01 +00:00
Arnold Schwaighofer
16a3e52d08 Correct function comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 17:50:59 +00:00
Bill Wendling
85db3a96b4 De-tabify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 10:57:23 +00:00