Commit Graph

6134 Commits

Author SHA1 Message Date
Bruno Cardoso Lopes 535aa8ea91 Reapply support for AVX unpack and interleave instructions, with
testcases this time.

llvm-svn: 106593
2010-06-22 23:02:38 +00:00
Bruno Cardoso Lopes 1a890f9dc0 Add AVX MOV{SS,SD}{rr,rm} instructions
llvm-svn: 106588
2010-06-22 22:38:56 +00:00
Bill Wendling 8ce69cd95a Fix the formatting of the switch statement and add a missing break.
llvm-svn: 106586
2010-06-22 22:16:17 +00:00
Jim Grosbach 6c275bc5a2 fix typo
llvm-svn: 106574
2010-06-22 20:52:02 +00:00
Bruno Cardoso Lopes 3af915f84b Reorganize logical and arithmetic SSE 1 & 2 instructions
llvm-svn: 106557
2010-06-22 18:17:40 +00:00
Bruno Cardoso Lopes b91af24d3e Reorganize SSE instructions, making easier to see oportunities for refactoring
llvm-svn: 106556
2010-06-22 18:09:32 +00:00
Dan Gohman d2d1ae105d Use pre-increment instead of post-increment when the result is not used.
llvm-svn: 106542
2010-06-22 15:08:57 +00:00
Bruno Cardoso Lopes b7dadb0e95 revert r106482
llvm-svn: 106499
2010-06-21 22:59:03 +00:00
Bruno Cardoso Lopes 510d9a3404 change parameter name to avoid confusion with global definition
llvm-svn: 106486
2010-06-21 21:28:07 +00:00
Bruno Cardoso Lopes 374b2195f6 Add unpack and interleave AVX instructions, encoding tests cooming soon
llvm-svn: 106482
2010-06-21 21:21:48 +00:00
Bruno Cardoso Lopes 29a894dd64 Move part of SSE 1 & 2 compare, shuffle and unpack instructions closely. Preparing them for refactoring and to the addition of their AVX forms
llvm-svn: 106437
2010-06-21 18:36:04 +00:00
Bruno Cardoso Lopes 20de4258f8 Add AVX regular (non-aliased ones) and,or,xor,andn packed instructions. They are already tested in the MC framework, no test needed
llvm-svn: 106436
2010-06-21 18:22:54 +00:00
Eric Christopher bf572c7cea Add some codegen patterns for x86_64-linux-gnu tls codegen matching.
Based on a patch by Patrick Marlier!

llvm-svn: 106433
2010-06-21 18:21:27 +00:00
Rafael Espindola 1cae86f704 Fix an unintentional commit. I think I typed "git svn dcommit" in the wrong branch.
I was trying to do some refactoring on the copyRegToReg, but this is realyl a work in progress and not generally useful yet.

llvm-svn: 106413
2010-06-21 13:31:32 +00:00
Rafael Espindola c596baa56d wip
llvm-svn: 106408
2010-06-21 02:17:34 +00:00
Nick Lewycky dcc7b6dcb6 Fix warning in no-asserts build.
llvm-svn: 106405
2010-06-20 20:27:42 +00:00
Bruno Cardoso Lopes b86a3abcc7 Refactoring of regular logical packed instructions to prepare for AVX ones.
llvm-svn: 106375
2010-06-19 04:09:22 +00:00
Bruno Cardoso Lopes 8737b7d73d Refactor aliased packed logical instructions, also add
AVX AND,OR,XOR,NAND{P}{S,D}{rr,rm} instructions.

llvm-svn: 106374
2010-06-19 02:44:01 +00:00
Bruno Cardoso Lopes a588049ce9 Move new sse 1 & 2 generic classes to a more appropriate place
llvm-svn: 106372
2010-06-19 01:32:46 +00:00
Bruno Cardoso Lopes 2787efd961 Remove unnecessary arguments
llvm-svn: 106371
2010-06-19 01:22:34 +00:00
Bruno Cardoso Lopes 00ada89f95 Add AVX packed intrinsics for MIN, MAX
llvm-svn: 106370
2010-06-19 01:17:05 +00:00
Eric Christopher 42105b2976 Finish ripping isTwoAddress out of X86. Some mindless formatting
and operand renaming to help.

The giant turn the constraints on and selectively turn it off
should probably be inverted at some point since it's just largely
50/50.

llvm-svn: 106367
2010-06-19 00:37:40 +00:00
Bruno Cardoso Lopes 1e205f6b1c Shrink down code and add for free AVX {MIN,MAX}P{S,D}{rm,rr} instructions
llvm-svn: 106366
2010-06-19 00:37:31 +00:00
Chris Lattner c60cecd88b rip out dead code.
llvm-svn: 106365
2010-06-19 00:34:14 +00:00
Chris Lattner e808a78ac1 fix rdar://7873482 by teaching the instruction encoder to emit
segment prefixes.  Daniel wrote most of this patch.

llvm-svn: 106364
2010-06-19 00:34:00 +00:00
Bruno Cardoso Lopes 1888f11887 Clean up: remove now unnecessary Constraints
llvm-svn: 106361
2010-06-19 00:09:27 +00:00
Bruno Cardoso Lopes 502c4fe61c more refactoring! yay! big win over the intrinsics
llvm-svn: 106359
2010-06-19 00:00:22 +00:00
Eric Christopher 6bdbdb5544 Remove isTwoAddress from here too.
llvm-svn: 106358
2010-06-18 23:56:07 +00:00
Bruno Cardoso Lopes 66d2d57d9b Fix typo, SSE1 should be used by XS, not SSE2
llvm-svn: 106357
2010-06-18 23:53:27 +00:00
Eric Christopher 3577c1b811 Remove isTwoAddress from 64-bit files.
llvm-svn: 106356
2010-06-18 23:51:21 +00:00
Dan Gohman 8693650422 Teach regular and fast isel to set dead flags on unused implicit defs
on calls and similar instructions.

llvm-svn: 106353
2010-06-18 23:28:01 +00:00
Bruno Cardoso Lopes 2bfad417a1 Apply some refactor to packed instructions
llvm-svn: 106349
2010-06-18 23:13:35 +00:00
Bruno Cardoso Lopes 871439abd2 Use the new 'defm' class inheritance in SSE
llvm-svn: 106327
2010-06-18 22:10:11 +00:00
Dan Gohman a46d607545 Make this comment less specific.
llvm-svn: 106311
2010-06-18 20:45:41 +00:00
Dan Gohman af4903d6ee Fix X86FastISel's address-mode folding to stay within the
original basic block. This avoids trouble with examining
instructions in other basic blocks which haven't been
assigned registers yet.

llvm-svn: 106310
2010-06-18 20:44:47 +00:00
Dan Gohman 92c11acdb8 Change UpdateNodeOperands' operand and return value from SDValue to
SDNode *, since it doesn't care about the ResNo value.

llvm-svn: 106282
2010-06-18 15:30:29 +00:00
Dan Gohman c3479f5342 Delete unused variables.
llvm-svn: 106280
2010-06-18 14:32:32 +00:00
Dan Gohman f1d8304fe3 Eliminate unnecessary uses of getZExtValue().
llvm-svn: 106279
2010-06-18 14:22:04 +00:00
Dan Gohman 35b6f9a929 isValueValidForType can be a static member function.
llvm-svn: 106278
2010-06-18 14:01:07 +00:00
Eric Christopher 67d25f91c5 Some assorted isTwoAddress -> Constraints cleanup.
llvm-svn: 106273
2010-06-18 02:41:19 +00:00
Dan Gohman 99ba4dac59 Don't maintain a set of deleted nodes; instead, use a HandleSDNode
to track a node over CSE events. This fixes PR7368.

llvm-svn: 106266
2010-06-18 01:24:29 +00:00
Bruno Cardoso Lopes 2323168705 Add {mix,max}{ss,sd}{rr,rm} AVX forms.
llvm-svn: 106264
2010-06-18 01:12:56 +00:00
Dan Gohman b92156d5e4 Fold the ShrinkDemandedOps pass into the regular DAGCombiner pass,
which is faster, simpler, and less surprising.

llvm-svn: 106263
2010-06-18 01:05:21 +00:00
Bruno Cardoso Lopes 6b98f7129f Use new tablegen resources in SSE tablegen code. This will
be done incrementally and intermixed with the adding of more
AVX instructions. This is a first step in that direction

llvm-svn: 106251
2010-06-17 23:05:30 +00:00
Stuart Hastings 0125b6410a Add a DebugLoc parameter to TargetInstrInfo::InsertBranch(). This
addresses a longstanding deficiency noted in many FIXMEs scattered
across all the targets.

This effectively moves the problem up one level, replacing eleven
FIXMEs in the targets with eight FIXMEs in CodeGen, plus one path
through FastISel where we actually supply a DebugLoc, fixing Radar
7421831.

llvm-svn: 106243
2010-06-17 22:43:56 +00:00
Eric Christopher 29b58afdf1 Hack to let the move lowering handle dynamic-no-pic absolute moves of
TLVP:

movl _a@TLVP, %eax

Daniel: Please review if you get a chance.
llvm-svn: 106194
2010-06-17 00:51:48 +00:00
Bill Wendling 8c0cf0994d Create a more targeted fix for not sinking instructions into a range where it
will conflict with another live range. The place which creates this scenerio is
the code in X86 that lowers a select instruction by splitting the MBBs. This
eliminates the need to check from the bottom up in an MBB for live pregs.

llvm-svn: 106066
2010-06-15 23:46:31 +00:00
Eric Christopher 6c4d63e1a5 For 32-bit non-pic tlv mach-o addressing we don't need a pic base or
a relative address.

llvm-svn: 106064
2010-06-15 23:08:42 +00:00
Dale Johannesen 89456b2612 Reapply 105986 with fix for bug pointed out by Jakob:
flag argument to addReg is not the same format as flags attached
to MachineOperand, although both have the same info.  I don't
think this actually mattered; the bootstrap failure did not
reproduce on the next run anyway.

llvm-svn: 106049
2010-06-15 21:36:43 +00:00
Chris Lattner 874c92bd47 fix fastisel to handle GS and FS relative pointers. Patch by
Nelson Elhage!

llvm-svn: 106031
2010-06-15 19:08:40 +00:00
Dale Johannesen 3f253d2353 Revert 105986; looks like I'd better try bootstrapping.
llvm-svn: 105988
2010-06-15 04:55:06 +00:00
Dale Johannesen c338ef2b65 The form of BuildMI used for TAILJMPr was changing the register
containing the target address, an input, into an output.  I don't
think this actually broke anything on x86 (it does on ARM), but
it's wrong.

llvm-svn: 105986
2010-06-15 03:13:49 +00:00
Chris Lattner faa7bdccbf fix a nasty bug where we were not treating available_externally
symbols as declarations in the X86 backend.  This would manifest
on darwin x86-32 as errors like this with -fvisibility=hidden:

symbol '__ZNSbIcED1Ev' can not be undefined in a subtraction expression

This fixes PR7353.

llvm-svn: 105954
2010-06-14 20:11:56 +00:00
Eli Friedman ba1f1fcae5 Add back some possible optimizations for va_arg, with wording that makes it
more clear what exactly is missing.

llvm-svn: 105934
2010-06-14 07:03:30 +00:00
Rafael Espindola e302f833e1 Merge getStoreRegOpcode and getLoadRegOpcode.
llvm-svn: 105900
2010-06-12 20:13:29 +00:00
Bruno Cardoso Lopes ada854f8b6 make the avx intrinsics 3 address
llvm-svn: 105876
2010-06-12 03:12:14 +00:00
Bruno Cardoso Lopes f203703467 Add some basic fp intrinsics for AVX
llvm-svn: 105873
2010-06-12 02:38:32 +00:00
Bruno Cardoso Lopes a714ea0f7d More AVX: {ADD,SUB,MUL,DIV}{PD,PS}rm
llvm-svn: 105870
2010-06-12 01:53:48 +00:00
Bruno Cardoso Lopes b06f54b852 More AVX: {ADD,SUB,MUL,DIV}{PD,PS}rr
Handle OpSize TSFlag for AVX

llvm-svn: 105869
2010-06-12 01:23:26 +00:00
Bruno Cardoso Lopes 8947c32493 Add some comments about REX fields
llvm-svn: 105860
2010-06-12 00:03:52 +00:00
Bruno Cardoso Lopes fd5458d4bd More AVX instructions ({ADD,SUB,MUL,DIV}{SS,SD}rm)
Introduce the VEX_X field

llvm-svn: 105859
2010-06-11 23:50:47 +00:00
Eli Friedman ab44d1281a A few new x86-64 specific README entries.
llvm-svn: 105674
2010-06-09 02:43:17 +00:00
Kevin Enderby 0de0f3fc02 Incremental improvement to the handling of the x86 "Jump if rCX Zero"
instruction.  Added the 64-bit version "jrcxz" so it is recognized and also
added the checks for incorrect uses of "jcxz" in 64-bit mode and "jrcxz" in
32-bit mode.  Still to do is to correctly handle the encoding of the
instruction adding the Address-size override prefix byte, 0x67, when the width
of the count register is not the same as the mode the machine is running in.
Which for example means the encoding of "jecxz" depends if you are assembling
as a 32-bit target or a 64-bit target.

llvm-svn: 105661
2010-06-08 23:48:44 +00:00
Eric Christopher 6ab55c5683 Split out these asserts so it's more apparent why we're not assembling
that rip-relative address when executing in 32-bit mode.

llvm-svn: 105656
2010-06-08 22:57:33 +00:00
Bruno Cardoso Lopes c2f87b7bb2 Reapply r105521, this time appending "LLU" to 64 bit
immediates to avoid breaking the build.

llvm-svn: 105652
2010-06-08 22:51:23 +00:00
Eric Christopher 89d103a8ce Ensure that mov and not lea are used to stick the address into
the register.  While we're at it, make sure it's in the right one.

llvm-svn: 105645
2010-06-08 22:04:25 +00:00
Duncan Sands e4f45cc88f This bug is also present in MSVC10. Requested by Elrood on IRC.
llvm-svn: 105527
2010-06-05 12:40:43 +00:00
Chris Lattner fdd2614330 revert r105521, which is breaking the buildbots with stuff like this:
In file included from X86InstrInfo.cpp:16:
X86GenInstrInfo.inc:2789: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2790: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2792: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2793: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2808: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2809: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2816: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2817: error: integer constant is too large for 'long' type

llvm-svn: 105524
2010-06-05 04:17:30 +00:00
Bruno Cardoso Lopes 594fa26317 Initial AVX support for some instructions. No patterns matched
yet, only assembly encoding support.

llvm-svn: 105521
2010-06-05 03:53:24 +00:00
Dale Johannesen df1a7f83bf Fix some liveout handling related to tail calls, see comments.
I don't think this ever resulted in problems on x86, but it
would on ARM.

llvm-svn: 105509
2010-06-05 00:30:45 +00:00
Eric Christopher b0e1a458ce Add first pass at darwin tls compiler support.
llvm-svn: 105381
2010-06-03 04:07:48 +00:00
Eli Friedman ceb13f2af3 Remove some already-fixed README entries.
llvm-svn: 105377
2010-06-03 01:47:31 +00:00
Eli Friedman a59b7a72b9 Remove README entry which no longer compiles to something sane.
llvm-svn: 105376
2010-06-03 01:16:51 +00:00
Eli Friedman 1f41303260 Remove a fixed item, update a couple partially-fixed items.
llvm-svn: 105375
2010-06-03 01:01:48 +00:00
Jakob Stoklund Olesen a8ad97743d Slightly change the meaning of the reMaterialize target hook when the original
instruction defines subregisters.

Any existing subreg indices on the original instruction are preserved or
composed with the new subreg index.

Also substitute multiple operands mentioning the original register by using the
new MachineInstr::substituteRegister() function. This is necessary because there
will soon be <imp-def> operands added to non read-modify-write partial
definitions. This instruction:

  %reg1234:foo = FLAP %reg1234<imp-def>

will reMaterialize(%reg3333, bar) like this:

  %reg3333:bar-foo = FLAP %reg333:bar<imp-def>

Finally, replace the TargetRegisterInfo pointer argument with a reference to
indicate that it cannot be NULL.

llvm-svn: 105358
2010-06-02 22:47:25 +00:00
Rafael Espindola f2dffcef82 Remove the TargetRegisterClass member from CalleeSavedInfo
llvm-svn: 105344
2010-06-02 20:02:30 +00:00
Eli Friedman 6e3d5af945 Fix comment so it doesn't include comments which are irrelevant to the x86
backend.  Add a FIXME noting what can be fixed here.

llvm-svn: 105342
2010-06-02 19:35:46 +00:00
Dan Gohman a690618c58 Use comments to document non-obvious code rather than
mailing list archives.

llvm-svn: 105341
2010-06-02 19:13:40 +00:00
Rafael Espindola 7881a64a50 Remove unused function.
llvm-svn: 105325
2010-06-02 15:44:20 +00:00
Eli Friedman 526e6d045f Don't try to custom-lower 64-bit add-with-overflow and friends on x86-32; the
x86 backend currently doesn't know how to handle them.

This doesn't really fix anything because LegalizeTypes doesn't know how to
handle them either.  We do get a better error message, though.

llvm-svn: 105305
2010-06-02 00:27:18 +00:00
Eli Friedman 6382c9c681 Remove outdated README entries.
llvm-svn: 105303
2010-06-02 00:10:36 +00:00
Dan Gohman 47a0724425 Fix the allocation of shadow space for the Win64 calling convention
in X86FastISel. Patch by Jan Sjodin.

llvm-svn: 105290
2010-06-01 21:09:47 +00:00
Bruno Cardoso Lopes d44677ba69 Refactor some SSE 2 unpack instructions
llvm-svn: 105276
2010-06-01 17:02:50 +00:00
Evan Cheng 27c4933e02 Fix PR7193: if sibling call address can take a register, make sure there are enough registers available by counting inreg arguments.
llvm-svn: 105092
2010-05-29 01:35:22 +00:00
Dale Johannesen e8be73f3e7 Fix comment typos.
llvm-svn: 105059
2010-05-28 23:24:28 +00:00
Bruno Cardoso Lopes 1f79289806 More SSE 1 & 2 merge, this time with logical instructions
llvm-svn: 105014
2010-05-28 22:47:03 +00:00
Kevin Enderby 4c71e08ed8 MC/X86: Add alias for movzx.
llvm-svn: 105005
2010-05-28 21:20:21 +00:00
Kevin Enderby b29228905f MC/X86: Add alias for fwait.
llvm-svn: 105001
2010-05-28 20:59:10 +00:00
Kevin Enderby 76413597a9 Fix the use of x86 control and debug registers so that the assertion failure in
getX86RegNum() does not happen.  Patch by Shantonu Sen!

llvm-svn: 104994
2010-05-28 19:01:27 +00:00
Kevin Enderby 9738f64bd9 MC/X86: Add aliases for Jcc variants.
llvm-svn: 104890
2010-05-27 21:33:19 +00:00
Dale Johannesen 9e43c07bc5 Mark some math lib intrinsic nodes Legal on SSE4.1.
No functional effect as these nodes are not generated yet.

llvm-svn: 104879
2010-05-27 20:12:41 +00:00
Dan Gohman dc53f1cb5c FastISel doesn't yet handle callee-pop functions.
To support this, move IsCalleePop from X86ISelLowering to X86Subtarget.

llvm-svn: 104866
2010-05-27 18:43:40 +00:00
Bruno Cardoso Lopes 54b07ad2cd Merge basic binops SSE 1 & 2 instruction classes. This is a step towards refactoring
common code between SSE versions.

llvm-svn: 104860
2010-05-27 18:17:40 +00:00
Daniel Dunbar c0b69020cd AsmMatcher/X86: Mark _REV instructions as "code gen only", they aren't expected
to be matched.

llvm-svn: 104757
2010-05-26 22:21:28 +00:00
Jakob Stoklund Olesen d1d7ed63ff Add StringRef::compare_numeric and use it to sort TableGen register records.
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...

llvm-svn: 104745
2010-05-26 21:47:28 +00:00
Kevin Enderby 70e34983e8 Fix the x86 move to/from segment register instructions.
llvm-svn: 104731
2010-05-26 20:10:45 +00:00
Daniel Dunbar 7c8bd0fc98 MC: Change RelaxInstruction to only take the input and output instructions.
llvm-svn: 104713
2010-05-26 18:15:06 +00:00
Dan Gohman 338674a323 Fix a typo in a comment that Gabor noticed.
llvm-svn: 104711
2010-05-26 18:03:53 +00:00
Daniel Dunbar a19838e107 MC: Simplify MayNeedRelaxation to not provide the fixups, so we can query it
before encoding.

llvm-svn: 104707
2010-05-26 17:45:29 +00:00
Jakob Stoklund Olesen 7de379467e Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104704
2010-05-26 17:27:12 +00:00
Daniel Dunbar b34440a6a8 MC: Eliminate MCAsmFixup, replace with MCFixup.
llvm-svn: 104699
2010-05-26 15:18:56 +00:00
Daniel Dunbar 353a91ff76 MC: Use accessors for access to MCAsmFixup.
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Daniel Dunbar 3627af5da4 MC: Change MCInst::dump_pretty to not include a trailing newline.
llvm-svn: 104696
2010-05-26 15:18:13 +00:00
Zhongxing Xu 730a977e02 SRetReturnReg was set in LowerFormalArguments(). So only assert it here.
llvm-svn: 104691
2010-05-26 08:10:02 +00:00
Jakob Stoklund Olesen 50eec620f4 Revert "Replace the SubRegSet tablegen class with a less error-prone mechanism."
This reverts commit 104654.

llvm-svn: 104660
2010-05-26 01:21:14 +00:00
Jakob Stoklund Olesen 0b0274524c Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104654
2010-05-26 00:28:19 +00:00
Kevin Enderby 492d4f409a Changed the encoding of X86 floating point stack operations where both operands
are st(0).  These can be encoded using an opcode for storing in st(0) or using
an opcode for storing in st(i), where i can also be 0.  To allow testing with
the darwin assembler and get a matching binary the opcode for storing in st(0)
is now used.  To do this the same logical trick is use from the darwin assembler
in converting things like this:

fmul %st(0), %st

into this:

fmul %st(0)

by looking for the second operand being X86::ST0 for specific floating point
mnemonics then removing the second X86::ST0 operand.  This also has the add
benefit to allow things like:

fmul %st(1), %st

that llvm-mc did not assemble.

llvm-svn: 104634
2010-05-25 20:52:34 +00:00
Jakob Stoklund Olesen 3311eb50d7 Separate unrelated cases that once shared a numeric value
llvm-svn: 104629
2010-05-25 19:49:40 +00:00
Jakob Stoklund Olesen 673e7e0f37 Remove NumberHack entirely.
SubRegIndex instances are now numbered uniquely the same way Register instances
are - in lexicographical order by name.

llvm-svn: 104627
2010-05-25 19:49:33 +00:00
Daniel Dunbar 0e767d7364 MC/X86: Add a hack to allow recognizing 'cmpltps' and friends.
llvm-svn: 104626
2010-05-25 19:49:32 +00:00
Daniel Dunbar 4a5b2c597b MC/X86: Define explicit immediate forms of cmp{ss,sd,ps,pd}.
llvm-svn: 104622
2010-05-25 18:40:53 +00:00
Kevin Enderby c798965e63 The BT64ri8 record in X86Instr64bit.td was missing a REX_W which is required
for the 64-bit version of the Bit Test instruction.

llvm-svn: 104621
2010-05-25 18:16:58 +00:00
Eric Christopher f6562d35ac Make sure aeskeygenassist uses an unsigned immediate field.
Fixes rdar://8017638

llvm-svn: 104617
2010-05-25 17:33:22 +00:00
Jakob Stoklund Olesen 3b59e0601e Ignore NumberHack and give each SubRegIndex instance a unique enum value instead.
This passes lit tests, but I'll give it a go through the buildbots to smoke out
any remaining places that depend on the old SubRegIndex numbering.

Then I'll remove NumberHack entirely.

llvm-svn: 104615
2010-05-25 17:21:04 +00:00
Jakob Stoklund Olesen 396c8802b2 Use enums instead of literals for X86 subregisters.
The cases in getMatchingSuperRegClass cannot be broken up until the enums have
unique values.

llvm-svn: 104611
2010-05-25 17:04:16 +00:00
Jakob Stoklund Olesen fdb25de17e Switch SubRegSet to using symbolic SubRegIndices
llvm-svn: 104571
2010-05-24 23:03:18 +00:00
Jakob Stoklund Olesen edab242488 Replace the tablegen RegisterClass field SubRegClassList with an alist-like data
structure that represents a mapping without any dependencies on SubRegIndex
numbering.

This brings us closer to being able to remove the explicit SubRegIndex
numbering, and it is now possible to specify any mapping without inventing
*_INVALID register classes.

llvm-svn: 104563
2010-05-24 21:46:58 +00:00
Dan Gohman 79b6a0f140 Fix an mmx movd encoding.
llvm-svn: 104552
2010-05-24 20:51:08 +00:00
Kevin Enderby dc71cc794b MC/X86: Add aliases for CMOVcc variants.
llvm-svn: 104549
2010-05-24 20:32:23 +00:00
Jakob Stoklund Olesen 9340ea59e1 Rename X86 subregister indices to something shorter.
Use the tablegen-produced enums.

llvm-svn: 104493
2010-05-24 14:48:17 +00:00
Jakob Stoklund Olesen 1c69646e99 Add the SubRegIndex TableGen class.
This is the beginning of purely symbolic subregister indices, but we need a bit
of jiggling before the explicit numeric indices can be completely removed.

llvm-svn: 104492
2010-05-24 14:48:12 +00:00
Daniel Dunbar b52fcd6304 MC/X86: Subdivide immediates a bit more, so that we properly recognize immediates based on the width of the target instruction. For example:
addw $0xFFFF, %ax
should match the same as
  addw $-1, %ax
but we used to match it to the longer encoding.

llvm-svn: 104453
2010-05-22 21:02:33 +00:00
Daniel Dunbar 346782c12c tblgen/AsmMatcher: Change AsmOperandClass to allow a list of superclasses instead of just one.
llvm-svn: 104452
2010-05-22 21:02:29 +00:00
Daniel Dunbar d459e29a0a MC/X86: Add alias for setz, setnz, jz, jnz.
llvm-svn: 104435
2010-05-22 06:37:33 +00:00
Evan Cheng 168ced94d8 Implement @llvm.returnaddress. rdar://8015977.
llvm-svn: 104421
2010-05-22 01:47:14 +00:00
Kevin Enderby 7e7482c80f Added retl for 32-bit x86 and added retq for 64-bit x86.
llvm-svn: 104394
2010-05-21 23:01:38 +00:00
Evan Cheng 3858451e09 - Change MachineInstr::findRegisterDefOperandIdx so it can also look for defs
that are aliases of the specified register.
- Rename modifiesRegister to definesRegister since it's looking a def of the
specific register or one of its super-registers. It's not looking for def of a
sub-register or alias that could change the specified register.
- Added modifiesRegister to look for defs of aliases.

llvm-svn: 104377
2010-05-21 20:53:24 +00:00
Dale Johannesen 2b78565842 Previous commit message should refer to 104308.
llvm-svn: 104337
2010-05-21 18:44:47 +00:00
Dale Johannesen 6361e3e8a2 Fix two bugs in 104348:
Case where MMX is disabled wasn't handled right.
MMX->MMX bitconverts are Legal.

llvm-svn: 104336
2010-05-21 18:40:15 +00:00
Chris Lattner 0735ecfe17 now that fp reg kill insertion stuff happens as a separate
pass after isel instead of being interlaced with it, we can
trust that all the code for a function has been isel'd before
it is run.

The practical impact of this is that we can scan for machine
instr phis instead of doing a fuzzy match on the LLVM BB for
phi nodes.  Doing the fuzzy match required knowing when isel
would produce an fp reg stack phi which was gross.  It was
also wrong in cases where select got lowered to a branch
tree because cmovs aren't available (PR6828).

Just do the scan on machine phis which is simpler, faster
and more correct.  This fixes PR6828.

llvm-svn: 104333
2010-05-21 18:17:54 +00:00
Chris Lattner 058a207436 Use less evil form of switch stmt.
llvm-svn: 104331
2010-05-21 18:02:42 +00:00
Chris Lattner 39a8a43bd8 use continue to reduce nesting.
llvm-svn: 104330
2010-05-21 18:01:24 +00:00
Chris Lattner b7d68a2256 pull a nested loop of this pass out to its own function,
eliminating the gymnastics around the ContainsFPCode var.

llvm-svn: 104328
2010-05-21 17:57:03 +00:00
Chris Lattner fb41aaefeb modernize this pass a bit, fit in 80 columns.
llvm-svn: 104326
2010-05-21 17:49:07 +00:00
Matt Fleming 638cdb2db1 Currently, createMachOStreamer() is invoked directly in llvm-mc which
isn't ideal if we want to be able to use another object file format.

Add a createObjectStreamer() factory method so that the correct object
file streamer can be instantiated for a given target triple.

llvm-svn: 104318
2010-05-21 12:54:43 +00:00
Matt Fleming 5abb6dd61e Split out the x86_32 an x86_64 ELF backends as they handle ELF
differently. This will make adding ELF support easier in the long run.

llvm-svn: 104317
2010-05-21 11:39:07 +00:00
Dale Johannesen b3b9c8ac48 Fix i64->f64 conversion, x86-64, -no-sse. A bit
tricky since there's a 3rd 64-bit type, MMX vectors.
PR 7135.

llvm-svn: 104308
2010-05-21 00:52:33 +00:00
Daniel Dunbar baf2eea6f4 MC/X86: Add movq alias for movabsq, to allow matching 64-bit immediates with movq.
llvm-svn: 104275
2010-05-20 20:36:29 +00:00
Daniel Dunbar 61655aa2bb X86: Model i64i32imm properly, as a subclass of all immediates.
llvm-svn: 104272
2010-05-20 20:20:39 +00:00
Daniel Dunbar 6d4c66dc1d X86: Fix immediate type of FOO64i32 operations.
llvm-svn: 104271
2010-05-20 20:20:35 +00:00
Dan Gohman 098a47931c Delete MMX_MOVQ64gmr. It was the same as MMX_MOVQ64mr, but it didn't
have a pattern and it had an invalid encoding.

llvm-svn: 104244
2010-05-20 18:05:01 +00:00
Dan Gohman 29790edb93 Fix assembly parsing and encoding of the pushf and popf family of
instructions.

llvm-svn: 104231
2010-05-20 16:16:00 +00:00
Dan Gohman 5238275478 Set neverHasSideEffects on 64-bit pushf and popf, for consistency with
16-bit and 32-bit pushf and popf.

llvm-svn: 104228
2010-05-20 15:42:55 +00:00
Dan Gohman 1e19eab963 Define the x86 pause instruction.
llvm-svn: 104204
2010-05-20 01:35:50 +00:00
Dan Gohman a3b7570a3a Fix the sfence instruction to use MRM_F8 instead of MRM7r, since it
doesn't have a register operand. Also, use I instead of PSI, for
consistency with mfence and lfence.

llvm-svn: 104203
2010-05-20 01:23:41 +00:00
Evan Cheng 738e920edf Code refactoring: pull SchedPreference enum from TargetLowering.h to TargetMachine.h and put it in its own namespace.
llvm-svn: 104147
2010-05-19 20:19:50 +00:00
Daniel Dunbar 52e37becf6 MC/X86: Add missing entry for TAILJMP_1 to getRelaxedOpcode().
llvm-svn: 104122
2010-05-19 17:20:58 +00:00
Daniel Dunbar d2f78e755f MC/X86: Lower TAILCALLd[64] to JMP_1, to allow relaxation and to avoid same
prefix byte problem as in r104062.
 - As a total hack to keep the TAILCALL markers in the output, which some tests depend on, this invents a new TAILJMP_1 instruction.

llvm-svn: 104120
2010-05-19 15:26:43 +00:00
Daniel Dunbar b243dfb085 MC/X86: Strip spurious operands from TAILJMPr64 as we do for CALL64r and
CALL64pcrel32, for the same reason.

llvm-svn: 104116
2010-05-19 08:07:12 +00:00
Daniel Dunbar 4f6c7c6d94 MC/X86: Lower MOV{8,16,32,64}{rm,mr} to fixed-register forms, as appropriate.
llvm-svn: 104112
2010-05-19 06:20:44 +00:00
Daniel Dunbar 45ace40959 MC/X86: Strip spurious operands from CALL64r as we do for CALL64pcrel32, to
avoid same prefix byte problem as in r104062.

llvm-svn: 104108
2010-05-19 04:31:36 +00:00
Dan Gohman 58c6f21453 Factor out the code for picking integer arithmetic with immediate
opcodes into a helper function. This fixes a few places in the code
which were not properly selecting the 8-bit-immediate opcodes.

llvm-svn: 104091
2010-05-19 00:53:19 +00:00
Dan Gohman f8bf663873 Teach mode load folding and unfolding code about CMP32ri8 and friends.
llvm-svn: 104068
2010-05-18 21:54:15 +00:00
Dan Gohman 887dd1cd31 When converting a test to a cmp to fold a load, use the cmp that has an
8-bit immediate field rather than one with a wider immediate field.

llvm-svn: 104064
2010-05-18 21:42:03 +00:00
Chris Lattner 9f46539e07 make mcinstlower remove all but the first operand to CALL64pcrel32.
The register use operands (e.g. the first argument is passed in a 
register) is currently being modeled as a normal register use,
instead of correctly being an implicit use.  This causes the operand
to get propagated onto the mcinst, which was causing the encoder to
emit a rex prefix byte, which generates an invalid call.

This fixes rdar://7998435

llvm-svn: 104062
2010-05-18 21:40:18 +00:00
Daniel Dunbar a4820fcc78 MC/X86: Implement custom lowering to make sure we match things like
X86::ADC32ri $0, %eax
to
  X86::ADC32i32 $0

llvm-svn: 104030
2010-05-18 17:22:24 +00:00
Eric Christopher bf79238599 Add some section and constant support for darwin TLS.
llvm-svn: 103974
2010-05-17 21:02:07 +00:00
Dale Johannesen 2ef974ee0e Revert 103911; it broke a test that expects bitconvert
<1xi64> -> i64 to work in MMX registers on hosts where -no-sse
is the default (not mine).  The right thing is
to accept this and make i64->f64 conversions go through memory,
but I don't have time right now.

llvm-svn: 103914
2010-05-16 20:19:04 +00:00
Dale Johannesen fc1492d71b Make x86-64 64-bit bitconvert work when SSE is not available.
(This worked as of about 6 months ago and I didn't track down
exactly what broke it; I think this fix is appropriate.)

llvm-svn: 103911
2010-05-16 18:22:38 +00:00
Anton Korobeynikov 8f35fabbc1 Add support for thiscall calling convention.
Patch by Charles Davis and Steven Watanabe!

llvm-svn: 103902
2010-05-16 09:08:45 +00:00
Dale Johannesen 3a366a88f2 Fix uint64->{float, double} conversion to do rounding correctly in 32-bit.
The implementation in LegalizeIntegerTypes to handle this as 
sint64->float + appropriate power of 2 is subject to double rounding,
considered incorrect by numerics people.  Use this implementation only
when it is safe.  This leads to using library calls in some cases
that produced inline code before, but it's correct now.
(EVTToAPFloatSemantics belongs somewhere else, any suggestions?)

Add a correctly rounding (though not particularly fast) conversion
that uses X87 80-bit computations for x86-32.

7885399, 5901940.  This shows up in gcc.c-torture/execute/ieee/rbug.c
in the gcc testsuite on some platforms.

llvm-svn: 103883
2010-05-15 18:51:12 +00:00
Bill Wendling 1713d95874 Several tail call tests apparently rely upon this being "adjusts stack" instead
of "has calls". That's probably wrong, but it needs further
investigation. Revert to the original behavior until this is settled.

llvm-svn: 103824
2010-05-14 21:58:35 +00:00
Bill Wendling e9ac7ad68c This should happen if there are no calls, not if it just doesn't adjust the
stack.

llvm-svn: 103813
2010-05-14 21:38:44 +00:00
Bill Wendling db4bc54c4f Revert r103804. The comment is correct.
llvm-svn: 103808
2010-05-14 21:28:24 +00:00
Bill Wendling 7bf4bae5dc Fix comment.
llvm-svn: 103804
2010-05-14 21:17:29 +00:00
Bill Wendling 95f6ebcb37 Rename "HasCalls" in MachineFrameInfo to "AdjustsStack" to better describe what
the variable actually tracks.

N.B., several back-ends are using "HasCalls" as being synonymous for something
that adjusts the stack. This isn't 100% correct and should be looked into.

llvm-svn: 103802
2010-05-14 21:14:32 +00:00
Dan Gohman 35dd005d22 Lowering of atomic instructions can result in operands being
used more than once. If ISel had put a kill flag on one of them,
it's not valid to transfer the kill flag to each new instance.

llvm-svn: 103799
2010-05-14 21:01:44 +00:00
Kevin Enderby 7bc111f5a9 Fix so "int3" is correctly accepted, added "into" and fixed "int" with an
argument, like "int $4", to not get an Assertion error.

llvm-svn: 103791
2010-05-14 19:16:02 +00:00
Dan Gohman 30e3db2ba3 Set isTerminator on TRAP instructions.
llvm-svn: 103778
2010-05-14 16:46:02 +00:00
Dan Gohman 02d9947e60 Add mayLoad and mayStore flags to instructions which missed them.
llvm-svn: 103776
2010-05-14 16:34:55 +00:00
Oscar Fuentes 82135e5a2f CMake: fixes 64 bit Visual Studio IDE build. Fixes bug 4936.
Patch by Dimitry Andric!

llvm-svn: 103727
2010-05-13 19:34:06 +00:00
Chris Lattner 9efef006cf reapply r103668 with a fix. Never make "minor syntax changes"
after testing before committing.

llvm-svn: 103681
2010-05-13 00:02:47 +00:00
Chris Lattner e354235512 revert r103668 for now, it is apparently breaking things.
llvm-svn: 103677
2010-05-12 23:40:59 +00:00
Chris Lattner a6df4650fd moffset forms of moves are x86-32 only, make the parser
lower them to the correct x86-64 instructions since we 
don't have a clean way to handle this in td files yet.
rdar://7947184

llvm-svn: 103668
2010-05-12 23:13:36 +00:00
Chris Lattner e132b0a92c fix the encoding of the obscure "moffset" forms of moves, i386
part first.  rdar://7947184

llvm-svn: 103660
2010-05-12 22:48:24 +00:00
Daniel Dunbar 059379a9d7 MC/X86: Extend suffix matching hack to match 'q' suffix.
llvm-svn: 103535
2010-05-12 00:54:20 +00:00
Daniel Dunbar ba2f4c3884 MC/Mach-O/x86_64: Add a new hook for checking whether a particular section can
be diced into atoms, and adjust getAtom() to take this into account.
 - This fixes relocations to symbols in fixed size literal sections, for
   example.

llvm-svn: 103532
2010-05-12 00:38:17 +00:00
Dan Gohman 1a1b51ff59 Add initial kill flag support to FastISel.
llvm-svn: 103529
2010-05-11 23:54:07 +00:00
Duncan Sands 6c5e4355bb I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it
to LLVM_LIBRARY_VISIBILITY and introduce LLVM_GLOBAL_VISIBILITY, which is
the opposite, for future use by dragonegg.

llvm-svn: 103495
2010-05-11 20:16:09 +00:00
Dan Gohman bb919dfb6b Implement a bunch more TargetSelectionDAGInfo infrastructure.
Move EmitTargetCodeForMemcpy, EmitTargetCodeForMemset, and
EmitTargetCodeForMemmove out of TargetLowering and into
SelectionDAGInfo to exercise this.

llvm-svn: 103481
2010-05-11 17:31:57 +00:00
Dan Gohman 4df9d9ce11 Remove the TargetLowering::getSubtarget() virtual function, which
was unused. TargetMachine::getSubtarget() is used instead.

llvm-svn: 103474
2010-05-11 16:21:03 +00:00
Nathan Jeffords b19c598843 updated handling dllexport in X86AsmPrinter
changed dllexport code to use EmitBytes instead of EmitRawText, and changed the export option to use /EXPORT: instead of -export: on the windows platform

llvm-svn: 103377
2010-05-09 08:40:06 +00:00
Nathan Jeffords 2760216c89 made COFF target dllexport logic apply to all subtargets
llvm-svn: 103373
2010-05-09 05:52:28 +00:00
Chris Lattner 72afa956db break coff symbol definition stuff out into proper MCStreamer callbacks,
patch by Nathan Jeffords!

llvm-svn: 103346
2010-05-08 19:54:22 +00:00
Devang Patel 4423abd734 Use overloaded operators instead of DIDescriptor::getNode()
llvm-svn: 103276
2010-05-07 18:19:32 +00:00
Chris Lattner 87cffa9498 switch MCSectionCOFF from a syntactic to semantic representation,
patch by Peter Housel!

llvm-svn: 103267
2010-05-07 17:17:41 +00:00
Dan Gohman 90c600d6d2 When rematerializing, use the debug location of the original
instruction, rather than a location near where the new instruction
is being inserted.

llvm-svn: 103232
2010-05-07 01:28:10 +00:00
Daniel Dunbar 21aa523c28 MC/X86: X86AbsMemAsmOperand is subclass of X86NoSegMemAsmOperand.
- This fixes "leal 0, %eax", for example.

llvm-svn: 103205
2010-05-06 22:39:14 +00:00
Chris Lattner 348dc9b15a fix rdar://7947167 - llvm-mc doesn't match movsq
llvm-svn: 103199
2010-05-06 21:48:14 +00:00
Sean Callanan e7e1cf9fbd Eliminated the classification of control registers into %ecr_
and %rcr_, leaving just %cr_ which is what people expect.
Updated the disassembler to support this unified register set.
Added a testcase to verify that the registers continue to be
decoded correctly.

llvm-svn: 103196
2010-05-06 20:59:00 +00:00
Daniel Dunbar 358b29c855 MC/X86: Error out if we see a non-constant FK_Data_1 or FK_Data_2 fixup, since
we don't currently support relaxing them.

llvm-svn: 103195
2010-05-06 20:34:01 +00:00
Dan Gohman 779c69bbc5 Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.

llvm-svn: 103194
2010-05-06 20:33:48 +00:00
Evan Cheng efb126a665 Add argument TargetRegisterInfo to loadRegFromStackSlot and storeRegToStackSlot.
llvm-svn: 103193
2010-05-06 19:06:44 +00:00
Evan Cheng 31cdcd46d6 Re-apply 103156 and 103157. 103156 didn't break anything. 10315 exposed a coalescer bug that's fixed by 103170.
llvm-svn: 103172
2010-05-06 06:36:08 +00:00
Eric Christopher 9feb1bb117 Revert r103156 since it was breaking the build bots.
Reverse-merging r103156 into '.':
U    lib/Target/ARM/ARMInstrNEON.td
U    lib/Target/ARM/ARMRegisterInfo.h
U    lib/Target/ARM/ARMBaseRegisterInfo.cpp
U    lib/Target/ARM/ARMBaseInstrInfo.cpp
U    lib/Target/ARM/ARMRegisterInfo.td

llvm-svn: 103159
2010-05-06 02:29:06 +00:00
Sean Callanan 4cd930f417 Fixed a sign-extension bug in the X86 disassembler
that was causing PC-relative branch targets to be
evaluated incorrectly.  Also added support for
checking operand values to the llvm-mc tester.

llvm-svn: 103128
2010-05-05 22:47:27 +00:00
Evan Cheng 5ab29366b5 Trim include.
llvm-svn: 103103
2010-05-05 18:27:57 +00:00
Eric Christopher 4e7e4e6b60 Revert 102941, we're going to do this via attr and can just
hack the code to turn it off when debugging.

llvm-svn: 103083
2010-05-05 07:35:59 +00:00
Eric Christopher a00830df31 Update comment.
llvm-svn: 103057
2010-05-04 22:13:03 +00:00
Daniel Dunbar c3e0bafc6d MC/X86: Chris pointed that 'as' isn't consistent in accepting the long form of
instructions which have no direct register usage.

Darwin 'as' accepts:
  add $0, (%rax)
but rejects
  mov $0, (%rax)
for example.

Given that, only accept suffix matches which match exactly one form. We still
need to emit nice diagnostics for failures...

llvm-svn: 103015
2010-05-04 17:31:02 +00:00