1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

1419 Commits

Author SHA1 Message Date
Dale Johannesen
f6b2759c5e Use FileCheck even though this means testing for something
that has nothing to do with the point of the test, per Chris.

llvm-svn: 79569
2009-08-20 22:12:08 +00:00
Dan Gohman
f2f57ebc84 Fix an x86 code size regression: prefer RIP-relative addressing
over absolute addressing even in non-PIC mode (unless the address
has an index or something else incompatible), because it has a
smaller encoding.

llvm-svn: 79553
2009-08-20 18:23:44 +00:00
Dale Johannesen
facc542d5e Use FileCheck for the test run where it's appropriate.
llvm-svn: 79534
2009-08-20 16:58:04 +00:00
Dale Johannesen
fc8ee02c25 Handle 'a' modifier in X86 asms. PR 4742.
llvm-svn: 79484
2009-08-19 22:44:41 +00:00
Bill Wendling
a62629a929 Make this test platform neutral.
llvm-svn: 79447
2009-08-19 18:51:45 +00:00
Dan Gohman
eb6fbd7fd1 Add an x86 peep that narrows TEST instructions to forms that use
a smaller encoding. These kinds of patterns are very frequent in
sqlite3, for example.

llvm-svn: 79439
2009-08-19 18:16:17 +00:00
Eli Friedman
914b41055a PR4737: Fix a nasty bug in load narrowing with non-power-of-two types.
llvm-svn: 79415
2009-08-19 08:46:10 +00:00
Dan Gohman
56c2c54a37 Legalize the shift amount operand of SRL_PARTS, SHL_PARTS, and
SRA_PARTS, as is done for SRL, SHL, and SRA.

llvm-svn: 79380
2009-08-18 23:36:17 +00:00
Dan Gohman
b2e9d23bd9 Make this test less sensitive to assembler differences.
llvm-svn: 79348
2009-08-18 17:19:46 +00:00
Chris Lattner
f0cde76e79 force a triple so this passes on darwin
llvm-svn: 79345
2009-08-18 16:55:45 +00:00
Dan Gohman
5022dd9cc9 Make tail merging handle blocks with repeated predecessors correctly, and
remove RemoveDuplicateSuccessor, as it is no longer necessary, and because
it breaks assumptions made in
MachineBasicBlock::isOnlyReachableByFallthrough.

Convert test/CodeGen/X86/omit-label.ll to FileCheck and add a testcase
for PR4732.

test/CodeGen/Thumb2/thumb2-ifcvt2.ll sees a diff with this commit due to
it being bugpoint-reduced to the point where it doesn't matter what the
condition for the branch is.

Add some more interesting code to
test/CodeGen/X86/2009-08-06-branchfolder-crash.ll, which is the testcase
that originally motivated the RemoveDuplicateSuccessor code, to help
verify that the original problem isn't being re-broken.

llvm-svn: 79338
2009-08-18 15:18:18 +00:00
Eli Friedman
d61a2e81bc Fix test on Linux.
llvm-svn: 79140
2009-08-15 21:28:17 +00:00
Chris Lattner
d910c3a30e implement support for CHECK-NEXT: in filecheck.
llvm-svn: 79123
2009-08-15 18:32:21 +00:00
Chris Lattner
56dc61a487 specify a target triple so global variable manglings are consistent etc.
llvm-svn: 79118
2009-08-15 17:35:05 +00:00
Chris Lattner
adc768c073 convert to filecheck.
llvm-svn: 79117
2009-08-15 17:28:09 +00:00
Chris Lattner
27345be0c7 rename this test to sse2.ll
llvm-svn: 79116
2009-08-15 17:24:09 +00:00
Chris Lattner
43cfb4db61 merge a bunch more sse3 tests into sse3.ll
llvm-svn: 79115
2009-08-15 17:21:44 +00:00
Chris Lattner
34e10616f5 convert test to filecheck format.
llvm-svn: 79114
2009-08-15 17:05:03 +00:00
Chris Lattner
58942aabef rename test
llvm-svn: 79113
2009-08-15 17:01:44 +00:00
Chris Lattner
83d747a703 this is a test for sse3, simplify it.
llvm-svn: 79112
2009-08-15 17:01:19 +00:00
Dan Gohman
d69323d37a On x86-64, for a varargs function, don't store the xmm registers to
the register save area if %al is 0. This avoids touching xmm
regsiters when they aren't actually used.

llvm-svn: 79061
2009-08-15 01:38:56 +00:00
Anton Korobeynikov
933d8e1118 Properly handle indirect win64 args when they're passed in memory
llvm-svn: 79009
2009-08-14 18:19:10 +00:00
Bruno Cardoso Lopes
f2855aabec Change MCSectionELF to represent a section semantically instead of
syntactically as a string, very similiar to what Chris did with MachO.
The parsing support and validation is not introduced yet.

llvm-svn: 78890
2009-08-13 05:07:35 +00:00
Dan Gohman
4b9cae5af3 Various AsmWriter output cleanups. Use WriteAsOperand instead of
PrintUnmangledNameSafely.

llvm-svn: 78878
2009-08-13 01:36:44 +00:00
Dan Gohman
8ce3f1d1df Use WriteAsOperand to print BasicBlock names.
llvm-svn: 78838
2009-08-12 20:56:56 +00:00
Dale Johannesen
f126196725 Test for 78821, sort of. While that bug is nondeterministic,
this test failed consistently on a Darwin build.

llvm-svn: 78822
2009-08-12 17:43:47 +00:00
Chris Lattner
1ba56c8c6c one last (?) bad x86 triple test.
llvm-svn: 78801
2009-08-12 06:49:44 +00:00
Chris Lattner
27cd94c25a fix some pastos in triple lines.
llvm-svn: 78800
2009-08-12 06:49:12 +00:00
Chris Lattner
f5d73f0aef another bogus triple
llvm-svn: 78798
2009-08-12 06:36:52 +00:00
Chris Lattner
c709c59153 fix another broken target triple.
llvm-svn: 78796
2009-08-12 06:29:18 +00:00
Chris Lattner
cfbcfcc3c4 fix an incorrect target triple.
llvm-svn: 78795
2009-08-12 06:28:51 +00:00
Dan Gohman
f64bbe9328 Fix a bug in the DAGCombiner's handling of multiple linked
MERGE_VALUES nodes. Replacing the result values with the
operands in one MERGE_VALUES node may cause another
MERGE_VALUES node be CSE'd with the first one, and bring
its uses along, so that the first one isn't dead, as this
code expects. Fix this by iterating until the node is
really dead. This fixes PR4699.

llvm-svn: 78619
2009-08-10 23:43:19 +00:00
Chris Lattner
cc70d578be Make the big switch: Change MCSectionMachO to represent a section *semantically*
instead of syntactically as a string.  This means that it keeps track of the 
segment, section, flags, etc directly and asmprints them in the right format.
This also includes parsing and validation support for llvm-mc and 
"attribute(section)", so we should now start getting errors about invalid 
section attributes from the compiler instead of the assembler on darwin.

Still todo: 
1) Uniquing of darwin mcsections
2) Move all the Darwin stuff out to MCSectionMachO.[cpp|h]
3) there are a few FIXMEs, for example what is the syntax to get the
   S_GB_ZEROFILL segment type?

llvm-svn: 78547
2009-08-10 01:39:42 +00:00
Eric Christopher
40031ed766 Add crc32 instruction and intrinsics. Add a new class of prefix
bytes for F2 0F 38 and propagate. Add a FIXME for a set
of possibilities which correspond to intrinsics already used.

New test.

llvm-svn: 78508
2009-08-08 21:55:08 +00:00
Anton Korobeynikov
e02d21a125 Do not generate 32-bit call on win64 when imm does not fit
llvm-svn: 78443
2009-08-07 23:59:21 +00:00
Chris Lattner
2a218ebe6a rename test
llvm-svn: 78441
2009-08-07 23:57:30 +00:00
Chris Lattner
bb68377453 merge a bunch of tests together into one, convert to filecheck which
is more tolerant of whitespace differences.

llvm-svn: 78439
2009-08-07 23:56:42 +00:00
Dale Johannesen
44233430ea Add the testcase from PR 4668. This works at the
moment, but it's a fragile area.

llvm-svn: 78358
2009-08-07 00:04:42 +00:00
Dale Johannesen
3cdd3d3633 Fix PR 4626, a crash in branch folding after OptimizeBlock
produced a CFG it wasn't prepared for.

llvm-svn: 78351
2009-08-06 22:56:40 +00:00
Dan Gohman
8456ae6bc8 Tidy up this testcase.
llvm-svn: 78322
2009-08-06 17:11:55 +00:00
Chris Lattner
c5342dabc4 reduce testcase.
llvm-svn: 78315
2009-08-06 16:14:33 +00:00
Dan Gohman
904eb68a6a Remove an over-aggressive assert. Functions with empty struct return
types don't have any return values, from CodeGen's perspective.
This fixes PR4688.

llvm-svn: 78311
2009-08-06 15:07:58 +00:00
Anton Korobeynikov
9c59e1a990 Add tests for X86-64 code model handling. Small and kernel for now.
llvm-svn: 78300
2009-08-06 12:25:20 +00:00
Dan Gohman
668a0ff5ef Fix a bug in x86's PreprocessForRMW logic that was exposed
by aggressive chain operand optimization. UpdateNodeOperands
does not modify the node in place if it would result in
a node identical to an existing node.

llvm-svn: 78297
2009-08-06 09:22:57 +00:00
Dan Gohman
01b8a3593b Fix a few places in DAGCombiner that were creating all-ones-bits
and high-bits values in ways that weren't correct for integer
types wider than 64 bits. This fixes a miscompile in
PPMacroExpansion.cpp in clang on x86-64.

llvm-svn: 78295
2009-08-06 09:18:59 +00:00
Dan Gohman
ac47a4b9ed Enable the new no-SP register classes by default. This is to address
PR4572. A few tests have some minor code regressions due to different
coalescing.

llvm-svn: 78217
2009-08-05 17:40:24 +00:00
Dan Gohman
1c75d47e13 Change these tests to use function attributes rather than special llc
command-line options.

llvm-svn: 78204
2009-08-05 16:37:27 +00:00
Dan Gohman
437fedf899 Revert changes accidentally committed along with r78163.
llvm-svn: 78165
2009-08-05 05:38:13 +00:00
Dan Gohman
1110fb6bbd Teach X86FastISel how to handle CCValAssign::BCvt, which is used for
MMX arguments. This fixes PR4684.

llvm-svn: 78163
2009-08-05 05:33:42 +00:00
Dan Gohman
5d566d918b Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.

This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.

This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.

llvm-svn: 78142
2009-08-05 01:29:28 +00:00
Jakob Stoklund Olesen
434f6a8d64 LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers.
When LowerExtract eliminates an EXTRACT_SUBREG with a kill flag, it moves the
kill flag to the place where the sub-register is killed. This can accidentally
overlap with the use of a sibling sub-register, and we have trouble.

In the test case we have this code:

Live Ins: %R0 %R1 %R2
	%R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
	%R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
	%R1L<def> = EXTRACT_SUBREG %R1<kill>, 1
	%R0L<def> = EXTRACT_SUBREG %R0<kill>, 1
	%R0H<def> = ADD16 %R2H<kill>, %R2L<kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: eliminated!
subreg: killed here: %R0H<def> = ADD16 %R2H, %R2L, %R2<imp-use,kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

The kill flag on %R2 is moved to the last instruction, and the live range overlaps with the definition of %R2H:

*** Bad machine code: Redefining a live physical register ***
- function:    f
- basic block:  0x18358c0 (#0)
- instruction: %R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
Register R2H was defined but already live.

The fix is to replace EXTRACT_SUBREG with IMPLICIT_DEF instead of eliminating
it completely:

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: replace by: %R2L<def> = IMPLICIT_DEF %R2<kill>

Note that these IMPLICIT_DEF instructions survive to the asm output. It is
necessary to fix the stack-color-with-reg test case because of that.

llvm-svn: 78093
2009-08-04 20:01:11 +00:00
Chris Lattner
8f9a2d3c85 enhance codegen to put 16-bit character strings into the
__TEXT,__ustring section on darwin.

llvm-svn: 78068
2009-08-04 16:27:13 +00:00
Chris Lattner
41ade57a63 Add support emiting for 2/4 byte mergable strings to the ".rodata.str*"
section on ELF targets.

llvm-svn: 78066
2009-08-04 16:13:09 +00:00
Anton Korobeynikov
0bac80c138 Unbreak Win64 CC. Step one: honour register save area, fix some alignment and provide a different set of call-clobberred registers.
llvm-svn: 77962
2009-08-03 08:12:53 +00:00
Rafael Espindola
14781bacfe Use movd instead of movq
llvm-svn: 77956
2009-08-03 05:21:05 +00:00
Daniel Dunbar
775da1948b Pass target triple string in to TargetMachine constructor.
This is not just a matter of passing in the target triple from the module;
currently backends are making decisions based on the build and host
architecture. The goal is to migrate to making these decisions based off of the
triple (in conjunction with the feature string). Thus most clients pass in the
target triple, or the host triple if that is empty.

This has one important change in the way behavior of the JIT and llc.

For the JIT, it was previously selecting the Target based on the host
(naturally), but it was setting the target machine features based on the triple
from the module. Now it is setting the target machine features based on the
triple of the host.

For LLC, -march was previously only used to select the target, the target
machine features were initialized from the module's triple (which may have been
empty). Now the target triple is taken from the module, or the host's triple is
used if that is empty. Then the triple is adjusted to match -march.

The take away is that -march for llc is now used in conjunction with the host
triple to initialize the subtarget. If users want more deterministic behavior
from llc, they should use -mtriple, or set the triple in the input module.

llvm-svn: 77946
2009-08-03 04:03:51 +00:00
Rafael Espindola
daefe7aa54 Use movq to move 64 bits in and out of mmx registers.
Fixes PR4669

llvm-svn: 77940
2009-08-03 02:45:34 +00:00
Chris Lattner
e1cc2c27b3 fix a problem Eli noticed where we would compile the attached ptrtoint
to:

.quad X

even on a 32-bit system, where X is not 64-bits.  There isn't much that
we can do here, so we just print:

.quad	((X) & 4294967295)

instead.

llvm-svn: 77818
2009-08-01 22:25:12 +00:00
Dan Gohman
512a0d9f42 Add nounwind to this test.
llvm-svn: 77792
2009-08-01 19:11:04 +00:00
David Greene
543296ed84 Simplify operand padding by keying off tabs in the asm stream. If
padding is disabled, tabs get replaced by spaces except in the case of
the first operand, where the tab is output to line up the operands after
the mnemonics.

Add some better comments and eliminate redundant code.

Fix some testcases to not assume tabs.

llvm-svn: 77740
2009-07-31 21:57:10 +00:00
Chris Lattner
85a3632c7a fix PR4650: we only track sizes for certain objects, so only put something
into the mergable section if it is one of our special cases.  This could
obviously be improved, but this is the minimal fix and restores us to the
previous behavior.

llvm-svn: 77679
2009-07-31 16:17:13 +00:00
Evan Cheng
148032a1a2 Optimize some common usage patterns of atomic built-ins __sync_add_and_fetch() and __sync_sub_and_fetch.
When the return value is not used (i.e. only care about the value in the memory), x86 does not have to use add to implement these. Instead, it can use add, sub, inc, dec instructions with the "lock" prefix.

This is currently implemented using a bit of instruction selection trick. The issue is the target independent pattern produces one output and a chain and we want to map it into one that just output a chain. The current trick is to select it into a merge_values with the first definition being an implicit_def. The proper solution is to add new ISD opcodes for the no-output variant. DAG combiner can then transform the node before it gets to target node selection.

Problem #2 is we are adding a whole bunch of x86 atomic instructions when in fact these instructions are identical to the non-lock versions. We need a way to add target specific information to target nodes and have this information carried over to machine instructions. Asm printer (or JIT) can use this information to add the "lock" prefix.

llvm-svn: 77582
2009-07-30 08:33:02 +00:00
Dan Gohman
3c7e8160f6 Add a new register class to describe operands that can't be SP,
due to x86 encoding restrictions. This is currently off by default
because it may cause code quality regressions. This is for PR4572.

llvm-svn: 77565
2009-07-30 01:56:29 +00:00
Chris Lattner
f8a9c2f843 fix PR4584 with a trivial patch now that the pieces are in place.
llvm-svn: 77434
2009-07-29 05:20:33 +00:00
Eric Christopher
88c1b51020 Add a couple more tests for the ptest intrinsics to make sure we're
grabbing them all correctly.

llvm-svn: 77413
2009-07-29 00:51:15 +00:00
Eric Christopher
c7b97d1f03 Add support for gcc __builtin_ia32_ptest{z,c,nzc} intrinsics. Lower
to ptest instruction plus setcc. Revamp ptest instruction. Add test.

llvm-svn: 77407
2009-07-29 00:28:05 +00:00
Chris Lattner
a8faf6b1b6 fix testcase for previous patch.
llvm-svn: 77338
2009-07-28 18:04:18 +00:00
Chris Lattner
986bd2bd0a Fix PR4639, a ELF-TLS regression from some of my refactoring.
llvm-svn: 77336
2009-07-28 17:57:51 +00:00
Chris Lattner
19c9914343 update testcase.
llvm-svn: 77192
2009-07-27 15:52:58 +00:00
Chris Lattner
5547fd80ad put normal data into .data instead of .data.rel on elf systems.
llvm-svn: 77116
2009-07-26 03:06:11 +00:00
Chris Lattner
9cd489c7f1 finish simplifying DarwinTargetAsmInfo::SelectSectionForGlobal
for now.  Make the section switching directives more consistent
by not including \n and including \t for them all.

llvm-svn: 77107
2009-07-26 01:24:18 +00:00
Chris Lattner
b95150b65a simplify DarwinTargetAsmInfo::SelectSectionForGlobal a bit
and make it more aggressive, we now put:

const int G2 __attribute__((weak)) = 42;

into the text (readonly) segment like gcc, previously we put
it into the data (readwrite) segment.

llvm-svn: 77104
2009-07-26 00:51:36 +00:00
Chris Lattner
cf7cc0ed7d add the most expedient hack to fix PR4619, along with a testcase.
Thanks to Rafael for the great example.

llvm-svn: 77083
2009-07-25 17:57:37 +00:00
Evan Cheng
12dd5c078f I've lost my mind. PR4572 has not been fixed.
llvm-svn: 77031
2009-07-25 01:11:46 +00:00
Evan Cheng
5faed6335e Forgot this test earlier.
llvm-svn: 77007
2009-07-24 22:42:45 +00:00
Eric Christopher
24a620ec3d Move insertps tests to sse41 combo test file, convert to filecheck
format and add an extract/insert test.

llvm-svn: 76994
2009-07-24 19:24:26 +00:00
Chris Lattner
7fd20e69f1 merge one more sse41 test into sse41.ll
llvm-svn: 76853
2009-07-23 04:49:39 +00:00
Chris Lattner
efe5b9aaf8 merge another sse41 test into sse41.ll
llvm-svn: 76852
2009-07-23 04:43:48 +00:00
Chris Lattner
c59ca858c8 merge sse41-pmovx.ll into sse41.ll
llvm-svn: 76850
2009-07-23 04:39:09 +00:00
Chris Lattner
313c95ea84 change a test to run in filecheck style. Rename it to be a general
dumping ground of various SSE4.1 tests, since filecheck can reasonably
handle them all in one file.  Generalize it to check x86-64 stuff as
well since it has a different ABI (a convenient way to test both the 
reg and mem forms of these instructions).

llvm-svn: 76848
2009-07-23 04:33:02 +00:00
Eric Christopher
c9299d5756 Support insertps via the intrinsic and add a couple of simple
testcases to make sure it's being generated.

llvm-svn: 76843
2009-07-23 02:22:41 +00:00
Eric Christopher
36eeebc1c4 Add test for pinsrd and pinsrb instructions.
llvm-svn: 76840
2009-07-23 01:58:04 +00:00
Dan Gohman
840e7f252e x86 isel tweak: use lea (%reg,%reg) instead of lea (,%reg,2).
llvm-svn: 76817
2009-07-22 23:26:55 +00:00
Dan Gohman
8b7a539e80 Make the grep line in this test more specific, to avoid
unintended matches.

llvm-svn: 76802
2009-07-22 22:02:42 +00:00
Evan Cheng
e0f52b2bf3 Remove a big test case.
llvm-svn: 76669
2009-07-21 22:52:04 +00:00
Evan Cheng
c142755cec Another rewriter bug exposed by recent coalescer changes. ReuseInfo::GetRegForReload() should make sure the "switched" register is in the desired register class. I'm surprised this hasn't caused more failures in the past.
llvm-svn: 76558
2009-07-21 09:15:00 +00:00
Evan Cheng
0cf19155ef Fix a dagga combiner bug: avoid creating illegal constant.
Is this really a winning transformation?
fold (shl (srl x, c1), c2) -> (shl (and x, (shl -1, c1)), (sub c2, c1)) or                                                                              
                              (srl (and x, (shl -1, c1)), (sub c1, c2))

llvm-svn: 76535
2009-07-21 05:40:15 +00:00
Evan Cheng
443ae1d494 Cross RC coalescing is now on by default.
llvm-svn: 76519
2009-07-21 00:22:59 +00:00
Evan Cheng
0048e876c3 Fix some sub-reg coalescing bugs where the coalescer wasn't updating the resulting interval's register class.
llvm-svn: 76458
2009-07-20 19:47:55 +00:00
Dan Gohman
00b05492f1 Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.

Remove a few optimizations that depended on this flag.

llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Chris Lattner
eac40b1473 implement a new magic global "llvm.compiler.used" which is like llvm.used, but
doesn't cause ".no_dead_strip" to be emitted on darwin.

llvm-svn: 76399
2009-07-20 06:14:25 +00:00
Jakob Stoklund Olesen
96f9a917c8 Fix http://llvm.org/bugs/show_bug.cgi?id=4583
Inline asm instructions may have additional <imp-def,kill> register operands.
These operands are not marked with a flag like the normal asm operands, so we
must not assert that there is a flag.

llvm-svn: 76373
2009-07-19 19:09:59 +00:00
Evan Cheng
a19ee1bb42 Catch more coalescing opportunities.
llvm-svn: 76282
2009-07-18 04:52:23 +00:00
Evan Cheng
84f06f0ee6 Enable cross register class coalescing.
llvm-svn: 76281
2009-07-18 02:10:10 +00:00
Evan Cheng
92fc255bb4 Fix pr4552. Stack slot coloring with register must take care not to generate illegal ams.
llvm-svn: 76258
2009-07-17 22:42:51 +00:00
Evan Cheng
67ccedff04 Fix x86 inline ams 'q' constraint support. In 32-bit mode, it's just like 'Q', i.e. EAX, EDX, ECX, EBX. In 64-bit mode, it just means all the i64r registers. Yeah, that makes sense.
llvm-svn: 76248
2009-07-17 22:13:25 +00:00
Chris Lattner
fb1ff2b993 rename test.
llvm-svn: 76197
2009-07-17 18:05:55 +00:00
Dale Johannesen
e08bda67c2 Assume an inline asm might be a call, so we get
stack alignment right when it is.  This is not
ideal but conservatively correct.  Adjust a test
to compensate for changed stack offset value.
gcc.apple/asm-block-57.c

llvm-svn: 76120
2009-07-16 22:34:45 +00:00
Evan Cheng
981276bb16 Changed my mind. We now allow remat of instructions whose defs have subreg indices.
llvm-svn: 76100
2009-07-16 20:15:00 +00:00
Evan Cheng
39e5f6205a With recent MC changes, RIP base register is explicitly modeled. Make sure we add it when x86 V_SET0 / V_SETALLONES (by transforming it into a constpool load) into the use instruction.
llvm-svn: 76094
2009-07-16 18:44:05 +00:00
Evan Cheng
7a6b20df7f Let callers decide the sub-register index on the def operand of rematerialized instructions.
Avoid remat'ing instructions whose def have sub-register indices for now. It's just really really hard to get all the cases right.

llvm-svn: 75900
2009-07-16 09:20:10 +00:00
Evan Cheng
83b99bb014 ShortenDeadCopySrcLiveRange needs to be more conservative in multi-kill situations.
llvm-svn: 75838
2009-07-15 21:39:50 +00:00
Chris Lattner
9f8b22c8ff convert to filecheck style, simplify RUN line, and add comment.
llvm-svn: 75667
2009-07-14 19:49:11 +00:00
Chris Lattner
6ec578688d Reapply my previous asmprinter changes now with more testing and two
additional bug fixes:

1. The bug that everyone hit was a problem in the asmprinter where it
   would remove $stub but keep the L prefix on a name when emitting the
   indirect symbol.  This is easy to fix by keeping the name of the stub
   and the name of the symbol in a StringMap instead of just keeping a
   StringSet and trying to reconstruct it late.

2. There was a problem printing the personality function.  The current
   logic to print out the personality function from the DWARF information
   is a bit of a cesspool right now that duplicates a bunch of other 
   logic in the asm printer.  The short version of it is that it depends
   on emitting both the L and _ prefix for symbols (at least on darwin)
   and until I can untangle it, it is best to switch the mangler back to
   emitting both prefixes.

llvm-svn: 75646
2009-07-14 18:17:16 +00:00
Daniel Dunbar
3d0c94fbbc Revert r75610 (and r75620, which was blocking the revert), in the hopes of
unbreaking llvm-gcc (on Darwin).

--- Reverse-merging r75620 into '.':
U    include/llvm/Support/Mangler.h
--- Reverse-merging r75610 into '.':
U    test/CodeGen/X86/loop-hoist.ll
G    include/llvm/Support/Mangler.h
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U    lib/VMCore/Mangler.cpp

llvm-svn: 75636
2009-07-14 15:57:55 +00:00
Chris Lattner
b0e0d16efb Change the X86 asmprinter to use the mangler to apply suffixes like "$non_lazy_ptr"
to symbols instead of doing it with "printSuffixedName".  This gets us to the point
where there is a real separation between computing a symbol name and printing it,
something I need for MC printer stuff.

This patch also fixes a corner case bug where unnamed private globals wouldn't get
the private label prefix.

Next up, rename all uses of getValueName -> getMangledName for better greppability,
and then tackle the ppc/arm backends to eliminate "printSuffixedName".

llvm-svn: 75610
2009-07-14 06:04:35 +00:00
Chris Lattner
2a6bb9bc51 Change the internal interface to makeNameProper to take a bool that
indicates whether the label is private or not, instead of taking
prefix stuff.  One effect of this is that symbols will be generated
with *just* the private prefix, instead of both the private prefix
*and* the user-label-prefix, but this doesn't matter as long as it
is consistent.  For example we'll now get "Lfoo" instead of "L_foo".
These are just assembler temporary labels anyway, so they never even
make it into the .o file.

llvm-svn: 75607
2009-07-14 04:50:12 +00:00
Bill Wendling
0751c92127 Check for the correct unnamed name.
llvm-svn: 75573
2009-07-14 00:53:58 +00:00
Chris Lattner
1ab26071d4 Two changes:
1) unique globals with the existing "Count" local in Mangler, not with
atomic nonsense.  Using atomics will give us nondeterminstic output
from the compiler when using multiple threads, which is bad.

2) Do not mangle an unknown global name with a type suffix.  We don't
   need this anymore now that llvm ir doesn't have type planes.

llvm-svn: 75541
2009-07-13 22:48:46 +00:00
Chris Lattner
35e5cff316 add nounwind
llvm-svn: 75407
2009-07-12 00:46:16 +00:00
Nick Lewycky
e5c1852b69 Darwin prepends an _ to internal globals, Linux doesn't.
llvm-svn: 75405
2009-07-11 23:48:59 +00:00
Chris Lattner
a54c70286c fix x86-64 static codegen to materialize the address of a global with movl instead
of lea.  It is better for code size (and presumably efficiency) to use:

  movl $foo, %eax

rather than:

  leal foo, eax

Both give a nice zero extending "move immediate" instruction, the former is just
smaller.  Note that global addresses should be handled different by the x86
backend, but I chose to follow the style already in place and add more fixme's.

llvm-svn: 75403
2009-07-11 23:17:29 +00:00
Chris Lattner
7015283356 this test was incorrect for x86-64 static. It passed on darwin, because darwin
doesn't have static x86-64 mode.

llvm-svn: 75392
2009-07-11 22:30:05 +00:00
Chris Lattner
496f872969 Fix PR4533, which is about buggy codegen in x86-64 -static mode.
Basically, using:
  lea symbol(%rip), %rax

is not valid in -static mode, because the current RIP may not be
within 32-bits of "symbol" when an app is built partially pic and
partially static.  The fix for this is to compile it to:

  lea symbol, %rax

It would be better to codegen this as:

  movq $symbol, %rax

but that will come next.


The hard part of fixing this bug was fixing abi-isel, which was actively
testing for the wrong behavior.  Also, the RUN lines are completely impossible
to understand what they are testing.  To help with this, convert the -static 
x86-64 codegen tests to use filecheck.  This is much more stable and makes it
more clear what the codegen is expected to be.

llvm-svn: 75382
2009-07-11 20:29:19 +00:00
Chris Lattner
6bfeeb798a We get the P modifier wrong in a lot of cases, just add some more rigorous testing.
In addition to fixing this, I still need to do some more testing on darwin.

llvm-svn: 75362
2009-07-11 08:30:22 +00:00
Eli Friedman
08991c716a Make EXTRACT_VECTOR_ELT a bit more flexible in terms of the returned
value.  Adjust other code to deal with that correctly.  Make 
DAGTypeLegalizer::PromoteIntRes_EXTRACT_VECTOR_ELT take advantage of 
this new flexibility to simplify the code and make it deal with unusual 
vectors (like <4 x i1>) correctly.  Fixes PR3037.

llvm-svn: 75176
2009-07-09 22:01:03 +00:00
Evan Cheng
4f87295872 Targets sometimes assign fixed stack object to spill certain callee-saved
registers based on dynamic conditions. For example, X86 EBP/RBP, when used as
frame register has to be spilled in the first fixed object. It should inform
PEI this so it doesn't get allocated another stack object. Also, it should not
be spilled as other callee-saved registers but rather its spilling and restoring
are being handled by emitPrologue and emitEpilogue. Avoid spilling it twice.

llvm-svn: 75116
2009-07-09 06:53:48 +00:00
Chris Lattner
ee12a671e5 remove eh, convert to FileCheck style
llvm-svn: 75087
2009-07-09 01:07:22 +00:00
Chris Lattner
9aa10daa2d we have no tests for dllimport/export. Add one.
llvm-svn: 75085
2009-07-09 00:53:44 +00:00
Chris Lattner
f321f1f93f * add some assertions for sanity checking.
* remove some old code that was needed when we'd put ESP in the scale instead of 
  the base of some instructions.
* Fix a bug with the P modifier in inline asm that caused us to drop it.

llvm-svn: 75077
2009-07-09 00:27:29 +00:00
Chris Lattner
8747eae8e9 add a test for dale's recent change.
llvm-svn: 75074
2009-07-09 00:00:16 +00:00
Chris Lattner
0122ff1be6 switch test to FileCheck-style and test the P and non-P cases.
llvm-svn: 75071
2009-07-08 23:44:06 +00:00
Chris Lattner
ddf2433b7b rename a test to make it a feature test.
llvm-svn: 75070
2009-07-08 23:40:57 +00:00
Chris Lattner
1eeea0d262 add some more check for vector compares.
llvm-svn: 75024
2009-07-08 18:51:25 +00:00
Chris Lattner
182817004d convert a test to "FileCheck" style.
llvm-svn: 75023
2009-07-08 18:48:24 +00:00
Chris Lattner
c153b998d9 eliminate the v[if]cmp versions of these tests, now that [if]cmp+sext works.
llvm-svn: 74980
2009-07-08 00:49:35 +00:00
Chris Lattner
ea7bd9b484 dag combine sext(setcc) -> vsetcc before legalize. To make this safe,
VSETCC must define all bits, which is different than it was documented
to before.  Since all targets that implement VSETCC already have this
behavior, and we don't optimize based on this, just change the 
documentation.  We now get nice code for vec_compare.ll

llvm-svn: 74978
2009-07-08 00:31:33 +00:00
Chris Lattner
e2435c4f6f add support for legalizing an icmp where the result is illegal (4xi1) but
the input is legal (4 x i32)

llvm-svn: 74964
2009-07-07 23:03:54 +00:00
Chris Lattner
1de1b3155b add a trivial test that vector compares work.
llvm-svn: 74963
2009-07-07 22:51:09 +00:00
Chris Lattner
a754f344b2 implement support for spliting and scalarizing vector setcc's. This
finishes off enough support for vector compares to get the icmp/fcmp
version of 2008-07-23-VSetCC.ll passing.

llvm-svn: 74961
2009-07-07 22:47:46 +00:00
Chris Lattner
573a3eeda2 verify that the fcmp version of this works just as well as the
vfcmp version.  We actually get better code for this silly testcase.

llvm-svn: 74954
2009-07-07 22:07:47 +00:00
Evan Cheng
29ce3bfbb8 Avoid adding a duplicate def. This fixes PR4478.
llvm-svn: 74857
2009-07-06 21:34:05 +00:00
Chris Lattner
4cddab0f14 @GOTPCREL is also rip-relative. Fix fast-isel to do the right thing.
This fixes an llvm-gcc bootstrap problem I introduced.

llvm-svn: 74691
2009-07-02 04:22:01 +00:00
Chris Lattner
e703feb0ac Fix yet-another bug I introduced into fastisel, this time handling
constant pool references that weren't getting properly rip-relative.

llvm-svn: 74689
2009-07-02 03:14:25 +00:00
Chris Lattner
2bbdc61f92 Fix some fast-isel problems selecting global variable addressing in
pic mode.

llvm-svn: 74582
2009-07-01 03:27:19 +00:00
Rafael Espindola
340632e814 Fix PR4485.
Avoid unnecessary duplication of operand 0 of X86::FpSET_ST0_80. This duplication would
cause one register to remain on the stack at the function return.

llvm-svn: 74534
2009-06-30 16:40:03 +00:00
Rafael Espindola
33b0aa0274 Fix PR4484.
This was caused by me confounding FP0 and ST(0).

llvm-svn: 74523
2009-06-30 12:18:16 +00:00
Rafael Espindola
a0fdda93be FIX PR 4459.
Not sure I understand how the temp register gets used,
but this fixes a bug and introduces no regressions.

llvm-svn: 74446
2009-06-29 20:29:59 +00:00
Chris Lattner
e711b85035 factor some logic out into a helper function, allow remat of loads from constant
globals.  This implements remat-constant.ll even without aggressive-remat.

llvm-svn: 74373
2009-06-27 04:38:55 +00:00
Chris Lattner
19eb0dad26 Reimplement rip-relative addressing in the X86-64 backend. The new
implementation primarily differs from the former in that the asmprinter
doesn't make a zillion decisions about whether or not something will be
RIP relative or not.  Instead, those decisions are made by isel lowering
and propagated through to the asm printer.  To achieve this, we:

1. Represent RIP relative addresses by setting the base of the X86 addr
   mode to X86::RIP.
2. When ISel Lowering decides that it is safe to use RIP, it lowers to
   X86ISD::WrapperRIP.  When it is unsafe to use RIP, it lowers to
   X86ISD::Wrapper as before.
3. This removes isRIPRel from X86ISelAddressMode, representing it with
   a basereg of RIP instead.
4. The addressing mode matching logic in isel is greatly simplified.
5. The asmprinter is greatly simplified, notably the "NotRIPRel" predicate
   passed through various printoperand routines is gone now.
6. The various symbol printing routines in asmprinter now no longer infer
   when to emit (%rip), they just print the symbol.

I think this is a big improvement over the previous situation.  It does have
two small caveats though: 1. I implemented a horrible "no-rip" modifier for
the inline asm "P" constraint modifier.  This is a short term hack, there is
a much better, but more involved, solution.  2. I had to xfail an 
-aggressive-remat testcase because it isn't handling the use of RIP in the
constant-pool reading instruction.  This specific test is easy to fix without
-aggressive-remat, which I intend to do next.

llvm-svn: 74372
2009-06-27 04:16:01 +00:00
Chris Lattner
aef726f8b9 remove some unneeded eh info.
llvm-svn: 74371
2009-06-27 04:07:31 +00:00
Chris Lattner
3e94ce2426 testcase for PR4466
llvm-svn: 74367
2009-06-27 01:33:35 +00:00
Dan Gohman
49b2ecafe7 Add some testcases for some of the recent ScalarEvolution bug fixes.
llvm-svn: 74353
2009-06-26 22:54:11 +00:00
Chris Lattner
4384816259 remove unwind info, add test for asmprinting of jump table labels with (%rip)
llvm-svn: 74337
2009-06-26 22:16:49 +00:00
Evan Cheng
016ed65455 Add x86 support for 'n' inline asm modifier. This will be handled target independently as part of MC work.
llvm-svn: 74336
2009-06-26 22:00:19 +00:00
Chris Lattner
f035685176 down with unwind info :)
llvm-svn: 74206
2009-06-25 21:48:17 +00:00
Chris Lattner
6e06dc1168 unwind info not needed.
llvm-svn: 74112
2009-06-24 19:48:04 +00:00
Evan Cheng
7292cadf06 Fix support for inline asm input / output operand tying when operand spans across multiple registers (e.g. two i64 operands in 32-bit mode).
llvm-svn: 74053
2009-06-24 02:05:51 +00:00
Dan Gohman
4f4bda36df Extend ScalarEvolution's multiple-exit support to compute exact
trip counts in more cases.

Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.

test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.

llvm-svn: 74048
2009-06-24 01:18:18 +00:00
Rafael Espindola
373c6bdbc5 Fix PR4185.
Handle FpSET_ST0_80 being used when ST0 is still alive.

llvm-svn: 73850
2009-06-21 12:02:51 +00:00