Commit Graph

1512 Commits

Author SHA1 Message Date
Wouter van Oortmerssen
17406f3a2a [WebAssembly] Modified tablegen defs to have 2 parallel instuction sets.
Summary:
One for register based, much like the existing definitions,
and one for stack based (suffix _S).

This allows us to use registers in most of LLVM (which works better),
and stack based in MC (which results in a simpler and more readable
assembler / disassembler).

Tried to keep this change as small as possible while passing tests,
follow-up commit will:
- Add reg->stack conversion in MI.
- Fix asm/disasm in MC to be stack based.
- Fix emitter to be stack based.

tests passing:
llvm-lit -v `find test -name WebAssembly`

test/CodeGen/WebAssembly
test/MC/WebAssembly
test/MC/Disassembler/WebAssembly
test/DebugInfo/WebAssembly
test/CodeGen/MIR/WebAssembly
test/tools/llvm-objdump/WebAssembly

Reviewers: dschuff, sbc100, jgravelle-google, sunfish

Subscribers: aheejin, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D48183

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334985 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-18 21:22:44 +00:00
Craig Topper
7cdce818bd [X86] Properly disassemble gather/scatter instructions where xmm4/ymm4/zmm4 are used as the index.
These encodings correspond to the cases in the normal encoding scheme where there is no index and our modrm reading code initially decodes it as such. The VSIB handling code tried to compensate for this, but failed to add the base needed to make later code do the right thing.

Fixes PR37712.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334121 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 19:15:15 +00:00
Craig Topper
af54ec44f0 [X86][Disassembler] Make it an error to set EVEX.R' to 0 when modrm.reg encodes a GPR.
This is different than the behavior of EVEX.X extending modrm.rm to 5 bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333728 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 06:11:29 +00:00
Craig Topper
983b09a88b [X86][Disassembler] Ignore EVEX.X extension of modrm.rm to 5-bits when modrm.rm encodes a k-register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333727 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 05:36:08 +00:00
Craig Topper
d62e7ad882 [X86][Disassembler] Clamp index to 4-bits when decoding GPR registers.
A 5-bit value can occur when EVEX.X is 0 due to it being used to extend modrm.rm to encode XMM16-31. But if modrm.rm instead encodes a GPR, the Intel documentation says EVEX.X should be ignored so just mask it to 4 bits once we know its a GPR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333725 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 05:12:44 +00:00
Craig Topper
3ff438cbeb [X86] Add a test case showing a bad disassembling of an EVEX instruction with EVEX.X=0 and a GPR encoded in modrm.rm.
EVEX.X is used to extended modrm.rm when the instruction encodes a XMM/YMM/ZMM register. But we aren't properly ignoring it when it encodes a GPR and we end up printing whatever registers exist in X86 register enum after the GPRs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333724 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 05:12:43 +00:00
Craig Topper
6b95374465 [X86][Disassembler] Make sure EVEX.X is not used to extend base registers of memory operations.
This was an accidental side effect of EVEX.X being used to encode XMM16-XMM31 using modrm.rm with modrm.mod==0x3.

I think there are still more bugs related to this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333722 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 04:29:34 +00:00
Craig Topper
9f563c4301 [X86] Make sure the check for VEX.vvvv being all ones on instructions that don't use it doesn't ignore a bit in 32-bit mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333717 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 01:23:52 +00:00
Craig Topper
d0d3e796b7 [X86][Disassembler] Suppress reading of EVEX.V' and EVEX.R' in 32-bit mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333714 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 00:10:36 +00:00
Craig Topper
f431a94a97 [X86] Add test cases showing the disassembler producing an xmm16-xmm31 register in 32-bit mode.
We aren't properly suppressing the reading of VEX.R' and VEX.V' in 32-bit mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333713 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 00:10:32 +00:00
Simon Dardis
056c0666f5 [mips] Correct the predicates of arithmetic and logic instructions.
As part of this effort, duplicate and correct the predicates of some
aliases. Also disable code generation of some short form instructions
for FastISel, as it would otherwise reject them.

Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D47075


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 11:33:35 +00:00
Simon Dardis
1b5b9b6170 [mips] Correct the predicates for a number of instructions.
Previously, their listed predicates were overridden at the scope level.

Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D46947


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 09:56:19 +00:00
Simon Dardis
e7c11b7093 [mips] Add microMIPSR6 ll/sc instructions.
Previously the compiler was using the microMIPSR3 variants, incorrectly.

Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D46948


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332820 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-20 17:21:00 +00:00
Petar Jovanovic
6209d969a2 [mips] Add support for Global INValidate ASE
This includes

  Instructions: ginvi, ginvt,

  Assembler directives: .set ginv, .set noginv, .module ginv, .module noginv

  Attribute: ginv

  .MIPS.abiflags: GINV (0x20000)

Patch by Vladimir Stefanovic.

Differential Revision: https://reviews.llvm.org/D46268


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:30:32 +00:00
Konstantin Zhuravlyov
c924185571 AMDGPU: Fix v_dot{4, 8}* instruction encoding
Differential Revision: https://reviews.llvm.org/D46848


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332387 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 19:32:47 +00:00
Konstantin Zhuravlyov
e8cfe2231c AMDGPU: Add disasm tests for deep learning instructions + fix v_fmac_f32 disasm
Differential Revision: https://reviews.llvm.org/D46853


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332377 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 17:39:13 +00:00
Simon Dardis
3319b10cf9 [mips] Add disassembly support for comparison instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332340 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 11:18:24 +00:00
Simon Dardis
e9a999eea8 [mips] Fix predicates of mfc1, mtc1 instructions
Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D46692


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332339 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 11:10:30 +00:00
Simon Dardis
08ef88f001 [mips] Fix the predicates of round, ceiling, floor and trunc.
Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D46691


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332258 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 16:26:50 +00:00
Simon Dardis
d91853e2c4 [mips] Correct the predicates of indexed floating point stores and loads.
Also, fix the register class for microMIPS.

Reviewers: atanasyan, abeserminji, smaksimovic

Differential Revision: https://reviews.llvm.org/D46689


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332227 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 10:53:15 +00:00
Simon Dardis
a884ad2442 [mips] Enable disassembly of fused (negative) multiply add/sub instructions
Reviewers: atanasyan, smaksimovic, abeserminji

Differential Revision: https://reviews.llvm.org/D46392


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332097 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-11 15:21:40 +00:00
Sam Clegg
04cf0d7c9c [WebAssembly] Initial Disassembler.
This implements a new table-gen emitter to create tables for
a wasm disassembler, and a dissassembler to use them.

Comes with 2 tests, that tests a few instructions manually. Is also able to
disassemble large .wasm files with objdump reasonably.

Not working so well, to be addressed in followups:
- objdump appears to be passing an incorrect starting point.
- since the disassembler works an instruction at a time, and it is
  disassembling stack instruction, it has no idea of pseudo register assignments.
  These registers are required for the instruction printing code that follows.
  For now, all such registers appear in the output as $0.

Patch by Wouter van Oortmerssen

Differential Revision: https://reviews.llvm.org/D45848

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332052 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 22:16:44 +00:00
Simon Dardis
0f6b0335f9 [mips] Correct the predicates of cvt.fmt.fmt instructions
Reviewers: atanasyan, smaksimovic, abeserminji

Differential Revision: https://reviews.llvm.org/D46390


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331969 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 10:42:30 +00:00
Simon Dardis
beccc07820 [mips] Move conditional moves out of isCodeGenOnly
Reviewers: atanasyan, smaksimovic, abeserminji

Differential Revision: https://reviews.llvm.org/D46389


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331863 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 10:33:21 +00:00
Gabor Buella
ceb5c6fec6 [x86] Introduce the enclv instruction
Summary:
and use the -msgx flag as a requirement
for the SGX instructions.

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D46436


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331742 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-08 07:11:05 +00:00
Gabor Buella
a4f2996da0 [x86] Introduce the pconfig instruction
Reviewers: craig.topper, zvi

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D46430


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331739 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-08 06:47:36 +00:00
Gabor Buella
03a7ebed88 [X86] movdiri and movdir64b instructions
Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper, RKSimon

Differential Revision: https://reviews.llvm.org/D45983


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331248 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 10:01:16 +00:00
Craig Topper
52c132f528 [X86] Remove 'opaque ptr' from the intel syntax parser and printer.
Previously for instructions like fxsave we would print "opaque ptr" as part of the memory operand. Now we print nothing.

We also no longer accept "opaque ptr" in the parser. We still accept any size to be specified for these instructions, but we may want to consider only parsing when no explicit size is specified. This what gas does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331243 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 04:42:00 +00:00
Matt Arsenault
ac9b3ef76a AMDGPU: Add Vega12 and Vega20
Changes by
  Matt Arsenault
  Konstantin Zhuravlyov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 19:08:16 +00:00
Craig Topper
519e2e52fa [X86] Add suffixes to the LGDT/LIDT/SGDT/SIDT mnemonics in Intel syntax. Add aliases based on 16/32-bit mode to choose the default.
This allows the instruction selection to follow mode in Intel syntax. And allows a suffix to be used to change size.

This matches gas behavior from what I could tell.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331138 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-29 06:24:09 +00:00
Petar Jovanovic
0059657b9a [mips] Add support for Virtualization ASE
This includes

  Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
                mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,

  Assembler directives: .set virt, .set novirt, .module virt, .module novirt

  Attribute: virt

  .MIPS.abiflags: VZ (0x100)

Patch by Vladimir Stefanovic.

Differential Revision: https://reviews.llvm.org/D44905


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331024 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 09:12:08 +00:00
Simon Dardis
5ce6b66393 [mips] Fix the definition of sync, synci
Also, fix the disassembly of synci for microMIPS.

Reviewers: abeserminji, smaksimovic, atanasyan

Differential Revision: https://reviews.llvm.org/D45870


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 10:19:22 +00:00
Craig Topper
1e1ca09b35 [X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.
This encoding is recognized by the CPU, but the behavior is undefined. This makes the disassembler handle it correctly so we don't print bswapl with a 16-bit register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330682 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 04:28:02 +00:00
Gabor Buella
4dd24c474b [X86] Revert r330638 - accidental commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330640 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 20:05:51 +00:00
Gabor Buella
abc9d03bfc [X86] movdiri and movdir64b instructions
Reviewers: craig.topper


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330638 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 20:00:59 +00:00
Craig Topper
14d8c6dfc0 [X86] Add disassembler test cases for bswap.
This demonstrates a bug where the encoding for a 16-bit bswap prints a 16-bit register and a 32-bit mnemonic. Intel docs say 16-bit bswap is undefined. We should either claim it as an invalid encoding or we should print a 16-bit mnemonic.

objdump does print the encoding as bswap with a 16-bit register. But it doesn't seem to ever print a suffix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330621 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 17:47:33 +00:00
Craig Topper
eeb236b7dc [X86] Add VEX_WIG to VEX encoded version of VCMPPSY/VCMPPDY.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330563 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 04:50:01 +00:00
Gabor Buella
b0e095336f [X86] WaitPKG instructions
Three new instructions:

umonitor - Sets up a linear address range to be
monitored by hardware and activates the monitor.
The address range should be a writeback memory
caching type.

umwait - A hint that allows the processor to
stop instruction execution and enter an
implementation-dependent optimized state
until occurrence of a class of events.

tpause - Directs the processor to enter an
implementation-dependent optimized state
until the TSC reaches the value in EDX:EAX.

Also modifying the description of the mfence
instruction, as the rep prefix (0xF3) was allowed
before, which would conflict with umonitor during
disassembly.

Before:
$ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble
.text
mfence

After:
$ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble
.text
umonitor        %rax

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D45253


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330462 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 18:42:47 +00:00
Dmitry Preobrazhensky
3210e64b49 [AMDGPU][MC][VI][GFX9] Added support of SDWA/DPP for v_cndmask_b32
See bug 36356: https://bugs.llvm.org/show_bug.cgi?id=36356

Differential Revision: https://reviews.llvm.org/D45446

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330123 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-16 12:41:38 +00:00
Craig Topper
c4082cf631 [X86] Add the bizarro movsww and movzww mnemonics for the disassembler.
The destination size of the movzx/movsx instruction is controlled by the normal operand size mechanisms. Only the input type is fixed.

This means that a 0x66 prefix on the encoding for zext/sext 16->32 should really produce a 16->16 instruction. Functionally this is equivalent to a GR16->GR16 move since bits 16 and above will be preserved. So nothing is actually extended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 23:57:54 +00:00
Yan Luo
8b2b901a7e [ARC] Add LImm support for J/JL
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330031 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 15:10:34 +00:00
Gabor Buella
31add1057f [X86] Introduce cldemote instruction
Hint to hardware to move the cache line containing the
address to a more distant level of the cache without
writing back to memory.

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D45256


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329992 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 07:35:08 +00:00
Simon Dardis
e671fc896b [mips] Correct the predicates for special nops, tlb ctrl instrs, software breakpoint and prefx.
Reviewers: atanasyan, abeserminji

Differential Revision: https://reviews.llvm.org/D44436


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329905 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 12:37:02 +00:00
Gabor Buella
8822a56047 [X86] Describe wbnoinvd instruction
Similar to the wbinvd instruction, except this
one does not invalidate caches. Ring 0 only.
The encoding matches a wbinvd instruction with
an F3 prefix.

Reviewers: craig.topper, zvi, ashlykov

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D43816


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329847 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 20:01:57 +00:00
Dmitry Preobrazhensky
7cb386167d [AMDGPU][MC][GFX9] Added v_screen_partition_4se_b32
See bug 36845: https://bugs.llvm.org/show_bug.cgi?id=36845

Differential Revision: https://reviews.llvm.org/D45443

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329801 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 13:13:30 +00:00
Dmitry Preobrazhensky
4f1ff651c8 [AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32
See bugs
  36841: https://bugs.llvm.org/show_bug.cgi?id=36841
  36842: https://bugs.llvm.org/show_bug.cgi?id=36842

Differential Revision: https://reviews.llvm.org/D45251

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329562 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 13:10:33 +00:00
Dmitry Preobrazhensky
7ba710792a [AMDGPU][MC][GFX9] Added s_call_b64
See bug 36843: https://bugs.llvm.org/show_bug.cgi?id=36843

Differential Revision: https://reviews.llvm.org/D45268

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329440 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 18:24:49 +00:00
Dmitry Preobrazhensky
a708d8da8f [AMDGPU][MC][GFX9] Added instruction s_endpgm_ordered_ps_done
See bug 36844: https://bugs.llvm.org/show_bug.cgi?id=36844

Differential Revision: https://reviews.llvm.org/D45313

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329430 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 17:25:00 +00:00
Dmitry Preobrazhensky
04f5112d69 [AMDGPU][MC][GFX9] Added instructions *saveexec*, *wrexec* and *bitreplicate*
See bug 36840: https://bugs.llvm.org/show_bug.cgi?id=36840

Differential Revision: https://reviews.llvm.org/D45250

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 16:35:11 +00:00
Dmitry Preobrazhensky
730ed467c7 [AMDGPU][MC][VI][GFX9] Added s_atc_probe* instructions
See bug 36839: https://bugs.llvm.org/show_bug.cgi?id=36839

Differential Revision: https://reviews.llvm.org/D45249

Reviewers: artem.tamazov, arsenm, timcorringham

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329408 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 15:48:39 +00:00