Chandler Carruth
84e68b2994
[Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
...
definition below all of the header #include lines, lib/Target/...
edition.
llvm-svn: 206842
2014-04-22 02:41:26 +00:00
Rafael Espindola
6c76d1d7df
Handle _GLOBAL_OFFSET_TABLE_ in 64 bit mode.
...
With this MC is able to handle _GLOBAL_OFFSET_TABLE_ in 64 bit mode, which is
needed for medium and large code models.
This fixes pr19470.
llvm-svn: 206793
2014-04-21 21:15:45 +00:00
Craig Topper
39012ccee9
[C++11] Add 'override' keyword to virtual methods that override their base class.
...
llvm-svn: 203418
2014-03-09 18:03:14 +00:00
Elena Demikhovsky
8fae565f08
AVX-512: fixed comressed displacement - by Robert Khazanov
...
llvm-svn: 203096
2014-03-06 08:15:35 +00:00
Craig Topper
56f0ed815e
Remove special FP opcode maps and instead add enough MRM_XX formats to handle all the FP operations. This increases format by 1 bit, but decreases opcode map by 1 bit so the TSFlags size doesn't change.
...
llvm-svn: 201649
2014-02-19 08:25:02 +00:00
Craig Topper
0d1fd55c13
Remove A6/A7 opcode maps. They can all be handled with a TB map, opcode of 0xa6/0xa7, and adding MRM_C0/MRM_E0 forms. Removes 376K from the disassembler tables.
...
llvm-svn: 201641
2014-02-19 05:34:21 +00:00
Craig Topper
a0869dceea
Recommit r201059 and r201060 with hopefully a fix for its original failure.
...
Original commits messages:
Add MRMXr/MRMXm form to X86 for use by instructions which treat the 'reg' field of modrm byte as a don't care value. Will allow for simplification of disassembler code.
Simplify a bunch of code by removing the need for the x86 disassembler table builder to know about extended opcodes. The modrm forms are sufficient to convey the information.
llvm-svn: 201065
2014-02-10 06:55:41 +00:00
Bob Wilson
ebdae7c2ff
Revert r201059 and r201060.
...
r201059 appears to cause a crash in a bootstrapped build of clang. Craig
isn't available to look at it right now, so I'm reverting it while he
investigates.
llvm-svn: 201064
2014-02-10 05:28:30 +00:00
Craig Topper
0d88de8c56
Add MRMXr/MRMXm form to X86 for use by instructions which treat the 'reg' field of modrm byte as a don't care value. Will allow for simplification of disassembler code.
...
llvm-svn: 201059
2014-02-10 00:50:34 +00:00
Elena Demikhovsky
a38114c45e
AVX-512: fixed a bug in EVEX encoding (the bug appeared after r200624)
...
llvm-svn: 200837
2014-02-05 13:03:01 +00:00
Craig Topper
fa6298a162
Merge x86 HasOpSizePrefix/HasOpSize16Prefix into a 2-bit OpSize field with 0 meaning no 0x66 prefix in any mode. Rename Opsize16->OpSize32 and OpSize->OpSize16. The classes now refer to their operand size rather than the mode in which they need a 0x66 prefix. Hopefully can merge REX_W into this as OpSize64.
...
llvm-svn: 200626
2014-02-02 09:25:09 +00:00
Craig Topper
d402df3ce8
Merge HasVEXPrefix/HasEVEXPrefix/HasXOPPrefix into a 2-bit 'encoding' field in TSFlags.
...
llvm-svn: 200624
2014-02-02 07:08:01 +00:00
Craig Topper
10243c8907
Separate x86 opcode maps and 0x66/0xf2/0xf3 prefixes from each other in the TSFlags. This greatly simplifies the switch statements in the disassembler tables and the code emitters.
...
llvm-svn: 200522
2014-01-31 08:47:06 +00:00
Craig Topper
ec68866f55
Move REP out of the Prefix field of the X86 format. Give it its own bit. It had special handling anyway and this enables a future patch.
...
llvm-svn: 200520
2014-01-31 07:00:55 +00:00
Craig Topper
327f13b43b
Move address override handling in X86MCCodeEmitter to a place where it works for VEX encoded instructions too. This allows 32-bit addressing to work in 64-bit mode.
...
llvm-svn: 200516
2014-01-31 05:33:45 +00:00
David Woodhouse
0b6c94909e
[x86] Fix signed relocations for i64i32imm operands
...
These should end up (in ELF) as R_X86_64_32S relocs, not R_X86_64_32.
Kill the horrid and incomplete special case and FIXME in
EncodeInstruction() and set things up so it can infer the signedness
from the ImmType just like it can the size and whether it's PC-relative.
llvm-svn: 200495
2014-01-30 22:20:41 +00:00
David Woodhouse
d2cca113df
Delete MCSubtargetInfo data members from target MCCodeEmitter classes
...
The subtarget info is explicitly passed to the EncodeInstruction
method and we should use that subtarget info to influence any
encoding decisions.
llvm-svn: 200350
2014-01-28 23:13:25 +00:00
David Woodhouse
9784cef38d
Explictly pass MCSubtargetInfo to MCCodeEmitter::EncodeInstruction()
...
llvm-svn: 200348
2014-01-28 23:13:07 +00:00
David Woodhouse
7a7c192e3e
[x86] Silence unused diReg variable warning in non-asserting builds
...
llvm-svn: 199812
2014-01-22 15:31:32 +00:00
David Woodhouse
9bbf7ca13d
]x86] Allow segment and address-size overrides for CMPS[BWLQ] (PR9385)
...
llvm-svn: 199806
2014-01-22 15:08:36 +00:00
David Woodhouse
b33c2ef215
[x86] Allow address-size overrides for STOS[BWLQ] (PR9385)
...
llvm-svn: 199804
2014-01-22 15:08:21 +00:00
David Woodhouse
2ef8d9c05c
[x86] Allow segment and address-size overrides for LODS[BWLQ] (PR9385)
...
llvm-svn: 199803
2014-01-22 15:08:08 +00:00
Craig Topper
3cbe160619
Replace duplicated code with a existing helper function.
...
llvm-svn: 199468
2014-01-17 06:42:38 +00:00
Craig Topper
35da3d190a
Allow x86 mov instructions to/from memory with absolute address to be encoded and disassembled with a segment override prefix. Fixes PR16962.
...
llvm-svn: 199364
2014-01-16 07:36:58 +00:00
Craig Topper
8a60fff260
Remove use of OpSize for populating VEX_PP field. A prefix encoding is now used instead. Simplify some other code. No functional changes intended.
...
llvm-svn: 199353
2014-01-16 06:14:45 +00:00
Craig Topper
ae11aed9d7
Separate the concept of 16-bit/32-bit operand size controlled by 0x66 prefix and the current mode from the concept of SSE instructions using 0x66 prefix as part of their encoding without being affected by the mode.
...
This should allow SSE instructions to be encoded correctly in 16-bit mode which r198586 probably broke.
llvm-svn: 199193
2014-01-14 07:41:20 +00:00
Elena Demikhovsky
b19c9dc1a1
AVX-512: Embedded Rounding Control - encoding and printing
...
Changed intrinsics for vrcp14/vrcp28 vrsqrt14/vrsqrt28 - aligned with GCC.
llvm-svn: 199102
2014-01-13 12:55:03 +00:00
David Woodhouse
32da3c8f3b
[x86] Fix MOV8ao8 et al for 16-bit mode, fix up disassembler to understand
...
It seems there is no separate instruction class for having AdSize *and*
OpSize bits set, which is required in order to disambiguate between all
these instructions. So add that to the disassembler.
Hm, perhaps we do need an AdSize16 bit after all?
llvm-svn: 198759
2014-01-08 12:58:24 +00:00
David Woodhouse
374243a290
[x86] Use 16-bit addressing where possible in 16-bit mode
...
Where "where possible" means that it's an immediate value and it's below
0x10000. In fact GAS will either truncate or error with larger values,
and will insist on using the addr32 prefix to get 32-bit addressing. So
perhaps we should do that, in a later patch.
llvm-svn: 198758
2014-01-08 12:58:18 +00:00
David Woodhouse
84ed54f91e
[x86] Fix JCXZ,JECXZ_32 for 16-bit mode
...
JCXZ should have the 0x67 prefix only if we're in 32-bit mode, so make that
appropriately conditional. And JECXZ needs the prefix instead.
llvm-svn: 198757
2014-01-08 12:58:12 +00:00
Craig Topper
7c6baa7834
Remove SegOvrBits from X86 TSFlags since they weren't being used.
...
llvm-svn: 198588
2014-01-06 06:51:58 +00:00
Craig Topper
78e58b28a5
Remove argument to fix build bot failure.
...
llvm-svn: 198587
2014-01-06 06:09:03 +00:00
Craig Topper
7ceb54a2a1
Add OpSize16 bit, for instructions which need 0x66 prefix in 16-bit mode
...
The 0x66 prefix toggles between 16-bit and 32-bit addressing mode.
So in 32-bit mode it is used to switch to 16-bit addressing mode for the
following instruction, while in 16-bit mode it's the other way round — it's
used to switch to 32-bit mode instead.
Thus, emit the 0x66 prefix byte for OpSize only in 32-bit (and 64-bit) mode,
and introduce a new OpSize16 bit which is used in 16-bit mode instead.
This is just the basic infrastructure for that change; a subsequent patch
will add the new OpSize16 bit to the 32-bit instructions that need it.
Patch from David Woodhouse.
llvm-svn: 198586
2014-01-06 06:02:58 +00:00
Craig Topper
3c80d62a6c
[x86] Add basic support for .code16
...
This is not really expected to work right yet. Mostly because we will
still emit the OpSize (0x66) prefix in all the wrong places, along with
a number of other corner cases. Those will all be fixed in the subsequent
commits.
Patch from David Woodhouse.
llvm-svn: 198584
2014-01-06 04:55:54 +00:00
Craig Topper
21ba8fbc18
Fix ModR/M byte output for 16-bit addressing modes (PR18220)
...
Add some tests to validate correct register selection, including a fix
to an existing test which was requiring the *wrong* output.
Patch from David Woodhouse.
llvm-svn: 198566
2014-01-05 19:40:56 +00:00
Elena Demikhovsky
de3f751baf
AVX-512: Added intrinsics for vcvt, vcvtt, vrndscale, vcmp
...
Printing rounding control.
Enncoding for EVEX_RC (rounding control).
llvm-svn: 198277
2014-01-01 15:12:34 +00:00
Craig Topper
99f02458e5
Remove MRMInitReg form now that it's last use is gone.
...
llvm-svn: 198257
2013-12-31 03:19:03 +00:00
Craig Topper
258ab6abc9
Merge case statements to remove redundant code.
...
llvm-svn: 198241
2013-12-30 19:47:49 +00:00
Craig Topper
3aef88b1c7
Change type of XOP flag in code emitters to a bool. Remove a some unneeded cases from switch.
...
llvm-svn: 191632
2013-09-29 08:33:34 +00:00
Craig Topper
e75666f47a
Add comments for XOPA map introduced with TBM instructions.a
...
llvm-svn: 191630
2013-09-29 06:31:18 +00:00
Yunzhong Gao
b8bbcbfcc8
Adding intrinsics to the llvm backend for TBM instruction set.
...
Phabricator code review is located here: http://llvm-reviews.chandlerc.com/D1750
llvm-svn: 191539
2013-09-27 18:38:42 +00:00
Elena Demikhovsky
c35219e3ee
AVX-512: Added masked SHIFT commands, more encoding tests
...
llvm-svn: 189005
2013-08-22 12:18:28 +00:00
Craig Topper
77df9cdd0b
Synchronize VEX JIT encoding code with the MCJIT version. Fix a bug in the MCJIT code where CurOp was being incremented even if the operand it was pointing at wasn't used. Maybe only matters if there are any EVEX_K instructions that aren't VEX_4V.
...
llvm-svn: 188868
2013-08-21 05:57:45 +00:00
Elena Demikhovsky
b1266b5447
EVEX and compressed displacement encoding for AVX512
...
llvm-svn: 187576
2013-08-01 13:34:06 +00:00
Bill Wendling
bc07a8900c
Use pointers to the MCAsmInfo and MCRegInfo.
...
Someone may want to do something crazy, like replace these objects if they
change or something.
No functionality change intended.
llvm-svn: 184175
2013-06-18 07:20:20 +00:00
Rafael Espindola
b770f897ee
Fix section relocation for SECTIONREL32 with immediate offset.
...
Patch by Kai Nacke. This matches the gnu as output.
llvm-svn: 180568
2013-04-25 19:27:05 +00:00
Michael Liao
95d9440348
Add CLAC/STAC instruction encoding/decoding support
...
As these two instructions in AVX extension are privileged instructions for
special purpose, it's only expected to be used in inlined assembly.
llvm-svn: 179266
2013-04-11 04:52:28 +00:00
Preston Gurd
ddf96b5072
In the X86 back end, getMemoryOperandNo() returns the offset
...
into the operand array of the start of the memory reference descriptor.
Additional code in EncodeInstruction provides an additional adjustment.
This patch places that additional code in a separate function,
called getOperandBias, so that any caller of getMemoryOperandNo
can also call getOperandBias.
llvm-svn: 179211
2013-04-10 20:11:59 +00:00
Dave Zarzycki
656e8515fc
x86 -- add the XTEST instruction
...
llvm-svn: 177888
2013-03-25 18:59:43 +00:00
Craig Topper
612f7bfa4d
Add X86 code emitter support AVX encoded MRMDestReg instructions.
...
Previously we weren't skipping the VVVV encoded register. Based on patch by Michael Liao.
llvm-svn: 177221
2013-03-16 03:44:31 +00:00
Craig Topper
872999737d
Fix a bug in the calculation of the VEX.B bit for FMA4 rr with the VEX.W bit set. The VEX.B was being calculated from the wrong operand. Fixes at least some portion of PR14185.
...
llvm-svn: 177014
2013-03-14 07:40:52 +00:00
Michael Liao
73cffddb95
Add support of RTM from TSX extension
...
- Add RTM code generation support throught 3 X86 intrinsics:
xbegin()/xend() to start/end a transaction region, and xabort() to abort a
tranaction region
llvm-svn: 167573
2012-11-08 07:28:54 +00:00
Michael Liao
f54249b55f
Add register encoding support in X86 backend
...
- Add 'HwEncoding' for X86 registers and call getEncodingValue() to
retrieve their encoding values.
- This's the first step to adopt new scheme. Furthur revising is onging.
llvm-svn: 165241
2012-10-04 19:50:43 +00:00
Craig Topper
3f23c1a8b9
Remove code for setting the VEX L-bit as a function of operand size from the code emitters and the disassembler table builder. Fix a couple instructions that were still missing VEX_L.
...
llvm-svn: 164204
2012-09-19 06:37:45 +00:00
Craig Topper
a60c0f1163
Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
...
llvm-svn: 163974
2012-09-15 17:09:36 +00:00
Craig Topper
f7755df776
Update GATHER instructions to support 2 read-write operands. Patch from myself and Manman Ren.
...
llvm-svn: 160110
2012-07-12 06:52:41 +00:00
Manman Ren
a09820414a
X86: add GATHER intrinsics (AVX2) in LLVM
...
Support the following intrinsics:
llvm.x86.avx2.gather.d.pd, llvm.x86.avx2.gather.q.pd
llvm.x86.avx2.gather.d.pd.256, llvm.x86.avx2.gather.q.pd.256
llvm.x86.avx2.gather.d.ps, llvm.x86.avx2.gather.q.ps
llvm.x86.avx2.gather.d.ps.256, llvm.x86.avx2.gather.q.ps.256
Modified Disassembler to handle VSIB addressing mode.
llvm-svn: 159221
2012-06-26 19:47:59 +00:00
Elena Demikhovsky
602f3a26d6
Added FMA3 Intel instructions.
...
I disabled FMA3 autodetection, since the result may differ from expected for some benchmarks.
I added tests for GodeGen and intrinsics.
I did not change llvm.fma.f32/64 - it may be done later.
llvm-svn: 157737
2012-05-31 09:20:20 +00:00
Benjamin Kramer
ef479ea854
Add intrinsics, code gen, assembler and disassembler support for the SSE4a extrq and insertq instructions.
...
This required light surgery on the assembler and disassembler
because the instructions use an uncommon encoding. They are
the only two instructions in x86 that use register operands
and two immediates.
llvm-svn: 157634
2012-05-29 19:05:25 +00:00
Craig Topper
1964b6d39d
Tidy up some spacing and inconsistent use of pre/post increment. No functional change intended.
...
llvm-svn: 157122
2012-05-19 19:14:18 +00:00
Jim Grosbach
c3b0427921
Allow MCCodeEmitter access to the target MCRegisterInfo.
...
Add the MCRegisterInfo to the factories and constructors.
Patch by Tom Stellard <Tom.Stellard@amd.com>.
llvm-svn: 156828
2012-05-15 17:35:52 +00:00
Joerg Sonnenberger
a29b5bd2a8
Put Is64BitMemOperand into !defined(NDEBUG) for now.
...
llvm-svn: 153185
2012-03-21 14:09:26 +00:00
Joerg Sonnenberger
5463e66768
Fix generation of the address size override prefix. Add assertions for
...
the invalid cases. At least 16bit operand in 64bit mode is currently not
rejected in the parser.
llvm-svn: 153166
2012-03-21 05:48:07 +00:00
Craig Topper
66a3597a4a
Add vmfunc instruction to X86 assembler and disassembler.
...
llvm-svn: 150899
2012-02-19 01:39:49 +00:00
Jia Liu
b22310fda6
Emacs-tag and some comment fix for all ARM, CellSPU, Hexagon, MBlaze, MSP430, PPC, PTX, Sparc, X86, XCore.
...
llvm-svn: 150878
2012-02-18 12:03:15 +00:00
Craig Topper
ed7aa46366
Add X86 assembler and disassembler support for AMD SVM instructions. Original patch by Kay Tiong Khoo. Few tweaks by me for code density and to reduce replication.
...
llvm-svn: 150873
2012-02-18 08:19:49 +00:00
Anton Korobeynikov
c6b4017ce2
Add support for implicit TLS model used with MS VC runtime.
...
Patch by Kai Nacke!
llvm-svn: 150307
2012-02-11 17:26:53 +00:00
Craig Topper
4ed7278ff4
Convert assert(0) to llvm_unreachable in X86 Target directory.
...
llvm-svn: 149809
2012-02-05 05:38:58 +00:00
Jim Grosbach
8f28dbdde5
Keep source location information for X86 MCFixup's.
...
llvm-svn: 149106
2012-01-27 00:51:27 +00:00
Craig Topper
cd93de93fa
Separate the concept of having memory access in operand 4 from the concept of having the W bit set for XOP instructons. Removes ORing W-bits in the encoder and will similarly simplify the disassembler implementation.
...
llvm-svn: 147366
2011-12-30 04:48:54 +00:00
Jan Sjödin
6dd2488383
XOP encoding bits and logic.
...
llvm-svn: 146397
2011-12-12 19:12:26 +00:00
Rafael Espindola
c7f355b8e1
Handle expressions of the form _GLOBAL_OFFSET_TABLE_-symbol the same way gas
...
does. The _GLOBAL_OFFSET_TABLE_ is still magical in that we get a R_386_GOTPC,
but it doesn't change the immediate in the same way as when the expression
has no right hand side symbol.
llvm-svn: 146311
2011-12-10 02:28:43 +00:00
Jan Sjödin
d19760a40c
Src2 and src3 were accidentally swapped for the FMA4 rr patterns. Undo this and fix the encoding.
...
llvm-svn: 146151
2011-12-08 14:43:19 +00:00
Bruno Cardoso Lopes
0f9a1f5e6c
This patch contains support for encoding FMA4 instructions and
...
tablegen patterns for scalar FMA4 operations and intrinsic. Also
add tests for vfmaddsd.
Patch by Jan Sjodin
llvm-svn: 145133
2011-11-25 19:33:42 +00:00
Craig Topper
980d59832a
Add X86 RORX instruction
...
llvm-svn: 142741
2011-10-23 07:34:00 +00:00
Craig Topper
96fa597828
Add X86 PEXTR and PDEP instructions.
...
llvm-svn: 142141
2011-10-16 16:50:08 +00:00
Craig Topper
aea148c366
Add X86 BZHI instruction as well as BMI2 feature detection.
...
llvm-svn: 142122
2011-10-16 07:55:05 +00:00
Craig Topper
25ea4e5ad3
Add X86 BEXTR instruction. This instruction uses VEX.vvvv to encode Operand 3 instead of Operand 2 so needs special casing in the disassembler and code emitter. Ultimately, should pass this information from tablegen
...
llvm-svn: 142105
2011-10-16 03:51:13 +00:00
Craig Topper
27ad12539d
Add support for X86 blsr, blsmsk, and blsi instructions. Required extra work because these are the first VEX encoded instructions to use the reg field as an opcode extension.
...
llvm-svn: 142082
2011-10-15 20:46:47 +00:00
Bruno Cardoso Lopes
60aa85b672
Tidy up a bit more, fix tab and remove trailing whitespaces
...
llvm-svn: 140186
2011-09-20 21:45:26 +00:00
Bruno Cardoso Lopes
05f3f4939a
Tidy up code!
...
llvm-svn: 140183
2011-09-20 21:39:06 +00:00
Bruno Cardoso Lopes
d126347f32
Re-write part of VEX encoding logic, to be more easy to read! Also fix
...
a bug and add a testcase!
llvm-svn: 138123
2011-08-19 22:27:29 +00:00
Bruno Cardoso Lopes
22241acc29
Fix PR10677. Initial patch and idea by Peter Cooper but I've changed the
...
implementation!
llvm-svn: 138029
2011-08-19 02:23:56 +00:00
Evan Cheng
eda1d4f3ba
Emit an error is asm parser parsed X86_64 only registers, e.g. %rax, %sil.
...
This can happen in cases where TableGen generated asm matcher cannot check
whether a register operand is in the right register class. e.g. mem operands.
rdar://8204588
llvm-svn: 136292
2011-07-27 23:22:03 +00:00
Jeffrey Yasskin
6381c0100b
Explicitly cast narrowing conversions inside {}s that will become errors in
...
C++0x.
llvm-svn: 136211
2011-07-27 06:22:51 +00:00
Evan Cheng
b25310095f
More refactoring.
...
llvm-svn: 135939
2011-07-25 19:33:48 +00:00