Commit Graph

275 Commits

Author SHA1 Message Date
H.J. Lu db4cc66567 x86: Set VexW=3 on AVX vrsqrtss
AVX vrsqrtss is a VEX WIG instruction.

	* i386-opc.tbl: Set VexW=3 on AVX vrsqrtss.
	* i386-tbl.h: Regenerated.
2018-09-15 17:10:17 -07:00
H.J. Lu 3c3741435f x86: Set Vex=1 on VEX.128 only vmovq
AVX "VMOVQ xmm1, xmm2/m64" and "VMOVQ xmm1/m64, xmm2" can only be
encoded with VEX.128.  Set Vex=1 on VEX.128 only vmovq and update
assembler tests.

gas/

	PR gas/23665
	* testsuite/gas/i386/avx-scalar-intel.d: Updated.
	* testsuite/gas/i386/avx-scalar.d: Likewise.
	* testsuite/gas/i386/x86-64-avx-scalar-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-avx-scalar.d: Likewise.

opcodes/

	PR gas/23665
	* i386-dis.c (vex_len_table): Update VEX_LEN_0F7E_P_1 and
	VEX_LEN_0FD6_P_2 entries.
	* i386-opc.tbl: Set Vex=1 on VEX.128 only vmovq.
	* i386-tbl.h: Regenerated.
2018-09-15 14:50:40 -07:00
H.J. Lu 6865c0435a x86: Support VEX/EVEX WIG encoding
Add VEXWIG, defined as 3, to indicate that the VEX.W/EVEX.W bit is
ignored by such VEX/EVEX instructions, aka WIG instructions.  Set
VexW=3 on VEX/EVEX WIG instructions.  Update assembler to check
VEXWIG when setting the VEX.W bit.

gas/

	PR gas/23642
	* config/tc-i386.c (build_vex_prefix): Check VEXWIG when setting
	the VEX.W bit.
	(build_evex_prefix): Check VEXWIG when setting the EVEX.W bit.

opcodes/

	PR gas/23642
	* i386-opc.h (VEXWIG): New.
	* i386-opc.tbl: Set VexW=3 on VEX/EVEX WIG instructions.
	* i386-tbl.h: Regenerated.
2018-09-14 12:20:10 -07:00
Jan Beulich 556059dd13 x86: fold CRC32 templates
Just like other insns having byte and word forms, these can also make
use of the W modifier, which at the same time allows simplifying some
other code a little bit.
2018-09-14 11:21:15 +02:00
H.J. Lu 5be12fc1ad x86: Remove VexW=1 from WIG VEX movq and vmovq
Put back changes lost in commit 41d1ab6a6d.
2018-09-13 07:38:45 -07:00
H.J. Lu 41d1ab6a6d i386: Update VexW field for VEX instructions
1. Mark VEX.W0 VEX instructions with VexW=1.
2. Mark VEX.W1 VEX instructions with VexW=2.
3. Remove VexW=1 from WIG VEX instructions.

	* i386-opc.tbl: Add VexW=1 to VEX.W0 VEX movd, cvtsi2ss, cvtsi2sd,
	pextrd, pinsrd, vcvtsi2sd, vcvtsi2ss, vmovd, vpextrd and vpinsrd.
	Add VexW=2 to VEX.W1 VEX movd, movq, pextrq, pinsrq, vmod, vmovq,
	vpextrq and vpinsrq.  Remove VexW=1 from WIG VEX movq and vmovq.
	* i386-tbl.h: Regenerated.
2018-09-13 06:21:19 -07:00
Jan Beulich 57f6375ec1 x86: drop bogus IgnoreSize from a few further insns 2018-09-13 11:26:06 +02:00
Jan Beulich 2589a7e59b x86: drop bogus IgnoreSize from AVX512_4* insns 2018-09-13 11:25:30 +02:00
Jan Beulich a760eb41aa x86: drop bogus IgnoreSize from AVX512DQ insns 2018-09-13 11:24:53 +02:00
Jan Beulich e90426589d x86: drop bogus IgnoreSize from AVX512BW insns 2018-09-13 11:24:23 +02:00
Jan Beulich 9caa306f80 x86: drop bogus IgnoreSize from AVX512VL insns 2018-09-13 11:23:50 +02:00
Jan Beulich fb6ce599e0 x86: drop bogus IgnoreSize from AVX512ER insns 2018-09-13 11:23:17 +02:00
Jan Beulich 6a8da88669 x86: drop bogus IgnoreSize from AVX512F insns 2018-09-13 11:22:49 +02:00
Jan Beulich c7f279191f x86: drop bogus IgnoreSize from SHA insns 2018-09-13 11:22:03 +02:00
Jan Beulich 0f407ee9f4 x86: drop bogus IgnoreSize from XOP and SSE4a insns 2018-09-13 11:21:36 +02:00
Jan Beulich 2fbbbee5e7 x86: drop bogus IgnoreSize from AVX2 insns 2018-09-13 11:19:21 +02:00
Jan Beulich 2b02b9a2ab x86: drop bogus IgnoreSize from AVX insns 2018-09-13 11:18:52 +02:00
Jan Beulich 963c68aa4a x86: drop bogus IgnoreSize from GNFI insns 2018-09-13 11:16:49 +02:00
Jan Beulich 64e025c3a1 x86: drop bogus IgnoreSize from PCLMUL/VPCLMUL insns 2018-09-13 11:16:19 +02:00
Jan Beulich 47603f888d x86: drop bogus IgnoreSize from AES/VAES insns 2018-09-13 11:15:38 +02:00
Jan Beulich 0001cfd00c x86: drop bogus IgnoreSize from SSE4.2 insns 2018-09-13 11:15:01 +02:00
Jan Beulich be4b452e28 x86: drop bogus IgnoreSize from SSE4.1 insns 2018-09-13 11:14:32 +02:00
Jan Beulich d09a13943b x86: drop bogus IgnoreSize from SSSE3 insns 2018-09-13 11:13:46 +02:00
Jan Beulich 07599e13ac x86: drop bogus IgnoreSize from SSE3 insns 2018-09-13 11:12:23 +02:00
Jan Beulich 1ee3e48715 x86: drop bogus IgnoreSize from SSE2 insns 2018-09-13 11:11:55 +02:00
Jan Beulich a5f580e51a x86: drop bogus IgnoreSize from SSE insns 2018-09-13 11:11:26 +02:00
Jan Beulich 49d5d12d0e x86: drop unnecessary {,No}Rex64 2018-09-13 11:08:37 +02:00
Jan Beulich f5eb1d70fb x86: also allow D on 3-operand insns
For now this is just for VMOVS{D,S}.
2018-09-13 11:07:55 +02:00
Jan Beulich dbbc8b7e62 x86: use D attribute also for SIMD templates
Various moves come in load and store forms, and just like on the GPR
and FPU sides there would better be only one pattern. In some cases this
is not feasible because the opcodes are too different, but quite a few
cases follow a similar standard scheme. Introduce Opcode_SIMD_FloatD and
Opcode_SIMD_IntD, generalize handling in operand_size_match() (reverse
operand handling there simply needs to match "straight" operand one),
and fix a long standing, but so far only latent bug with when to zap
found_reverse_match.

Also once again drop IgnoreSize where pointlessly applied to templates
touched anyway as well as *word when redundant with Reg*.
2018-09-13 11:07:07 +02:00
H.J. Lu d871f3f483 x86: Add CpuCMOV and CpuFXSR
There are separate CPUID feature bits for fxsave/fxrstor and cmovCC
instructions.  This patch adds CpuCMOV and CpuFXSR to replace Cpu686
on corresponding instructions.

gas/

	* config/tc-i386.c (cpu_arch): Add .cmov and .fxsr.
	(cpu_noarch): Add nocmov and nofxsr.
	* doc/c-i386.texi: Document cmov and fxsr.

opcodes/

	* i386-gen.c (cpu_flag_init): Add CpuCMOV and CpuFXSR to
	CPU_I686_FLAGS.  Add CPU_CMOV_FLAGS, CPU_FXSR_FLAGS,
	CPU_ANY_CMOV_FLAGS and CPU_ANY_FXSR_FLAGS.
	(cpu_flags): Add CpuCMOV and CpuFXSR.
	* i386-opc.tbl: Replace Cpu686 with CpuFXSR on fxsave, fxsave64,
	fxrstor and fxrstor64.  Replace Cpu686 with CpuCMOV on cmovCC.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2018-08-11 14:37:32 -07:00
Jan Beulich dbf8be89ed x86: drop NoRex64 from {,v}pmov{s,z}x*
They're pointless with IgnoreSize also specified, and even more so when
no Qword operand exists.
2018-08-03 09:30:58 +02:00
Jan Beulich 1424ad8677 x86: also optimize KXOR{D,Q} and KANDN{D,Q}
These can be converted to 2-byte VEX encoding when both source registers
are the same, by using KXORW / KANDNW as replacement.
2018-07-31 10:58:05 +02:00
Jan Beulich ae2387feae x86: fold various AVX512 templates with so far differing Masking attributes
There's no insn allowing ZEROING_MASKING alone. Re-purpose its value for
handling the not uncommon case of insns allowing either form of masking
with register operands, but only merging masking with a memory operand.
2018-07-31 10:57:09 +02:00
Jan Beulich 6ff00b5e12 x86/Intel: correct permitted operand sizes for AVX512 scatter/gather
AVX gather insns correctly allow the element size to be specified rather
than the full vector size. Make AVX512 ones match.
2018-07-31 10:55:17 +02:00
Jan Beulich 4174bfff8a x86-64: correct AVX512F vcvtsi2s{d,s} handling
Just like for their AVX counterparts and CVTSI2S{D,S}, a memory source
here is ambiguous and hence
- in source files should be qualified with a suitable suffix or operand
  size specifier (not doing so is an error in Intel mode, and will gain
  a diagnostic in AT&T mode in the future),
- in disassembly should be properly suffixed (the Intel operand size
  specifiers were emitted correctly already).
2018-07-24 09:46:27 +02:00
Jan Beulich 5f32791e1e x86: fold narrowing VCVT* templates
When multiple (here: two) forms of an insn take different width inputs
but produce identical size outputs (here: RegXMM), the templates can be
combined.

Also drop IgnoreSize (and the now redundant size specifiers) wherever
applicable.
2018-07-19 08:36:19 +02:00
Jan Beulich 625cbd7ac1 x86: fold VFPCLASSP{D,S} templates
These are special because they may not have a register operand to derive
the vector length from, which requires to also deal with the braodcast
case when determining vector length in build_evex_prefix().

Also drop IgnoreSize (and the now redundant size specifiers) from their
suffixed counterparts.
2018-07-19 08:35:38 +02:00
Jan Beulich 86b15c3204 x86: fold various AVX512* templates 2018-07-19 08:34:45 +02:00
Jan Beulich cf769ed505 x86: fold various AVX512DQ templates 2018-07-19 08:34:01 +02:00
Jan Beulich 8282b7ad0d x86: fold various AVX512BW templates 2018-07-19 08:32:17 +02:00
Jan Beulich 755908cce5 x86: fold various AVX512CD templates 2018-07-19 08:31:24 +02:00
Jan Beulich 7091c61201 x86: fold various AVX512VL templates into their AVX512F counterparts 2018-07-19 08:29:35 +02:00
Jan Beulich c30be56ebf x86: pre-process opcodes table before parsing
Instead of expanding macro-like constructs in i386-gen, have the C pre-
processor do this for us. Besides being a prerequisite for the next
template folding steps, this also paves the way for removing various
hidden dependencies between #define-s in i386-opc.h and plain literal
numbers used in i386-opc.tbl.

The #undef of None is solely to leave the generated i386-tbl.h entirely
unchanged.
2018-07-19 08:28:29 +02:00
H.J. Lu 11a322db5c x86: Split vcvtps2{,u}qq and vcvttps2{,u}qq
After

commit 1b54b8d7e4
Author: Jan Beulich <jbeulich@novell.com>
Date:   Mon Dec 18 09:36:14 2017 +0100

    x86: fold RegXMM/RegYMM/RegZMM into RegSIMD

    ... qualified by their respective sizes, allowing to drop FirstXmm0 at
    the same time.

folded RegXMM, RegYMM and RegZMM into RegSIMD, it's no longer impossible
to distinguish if Xmmword can represent a memory reference when operand
specification contains SIMD register. For example, template operands
specification like these

RegXMM|...|Xmmword|...

and

RegXMM|...

The Xmmword bitfield is always set by RegXMM which is represented by
"RegSIMD|Xmmword".  This patch splits each of vcvtps2qq, vcvtps2uqq,
vcvttps2qq and vcvttps2uqq into 2 templates: one template only has
RegXMM source operand and the other only has mempry source operand.

gas/

	PR gas/23418
	* testsuite/gas/i386/xmmword.s: Add tests for vcvtps2qq,
	vcvtps2uqq, vcvttps2qq and vcvttps2uqq.
	* testsuite/gas/i386/xmmword.l: Updated.

opcodes/

	PR gas/23418
	* i386-opc.h (Byte): Update comments.
	(Word): Likewise.
	(Dword): Likewise.
	(Fword): Likewise.
	(Qword): Likewise.
	(Tbyte): Likewise.
	(Xmmword): Likewise.
	(Ymmword): Likewise.
	(Zmmword): Likewise.
	* i386-opc.tbl: Split vcvtps2qq, vcvtps2uqq, vcvttps2qq and
	vcvttps2uqq.
	* i386-tbl.h: Regenerated.
2018-07-18 05:33:50 -07:00
Jan Beulich a79eaed6a5 x86: adjust monitor/mwait templates
Architecturally, MONITOR's and MONITORX'es memory operand is a 16- or
32-bit register outside of 64-bit mode, and a 64- or 32-bit register
inside 64-bit mode. The other register operands, including all of them
for MWAIT and MWAITX, are uniformly 32-bit, irrespective of mode. Retain
the original 64-bit MONITOR{,X} templates for compatibility only, and
fold the MWAIT{,X} ones.
2018-07-11 10:30:00 +02:00
Jan Beulich 7f5cad3047 x86/Intel: accept memory operand size specifiers for CET insns 2018-07-11 10:25:40 +02:00
Jan Beulich 733bd0abdd x86: fold MOV to/from segment register templates
First of all there's no point in having separate Cpu386 templates - the
respective SReg3 registers can't be specified for pre-386 anyway; see
parse_real_register().

And then we can also make use of D here for the memory forms of the
insn. This cannot be done for the non-64bit GPR forms because of the
IgnoreSize that cannot be dropped from the to-SREG variant.
2018-06-01 08:41:16 +02:00
Jan Beulich dfd27d4183 x86: don't emit REX.W for SLDT and STR
Just like for other selector register reads, they're unnecessary and
should hence be avoided.
2018-06-01 08:40:38 +02:00
Jan Beulich 6479571075 x86/Intel: accept "oword ptr" for INVPCID
The insn is no different in this reagrd from INVEPT and INVVPID.
2018-06-01 08:37:24 +02:00
H.J. Lu 06cfb1c895 x86: Remove Disp<N> from movidir{i,64b}
* i386-opc.tbl: Remove Disp<N> from movidir{i,64b}.
2018-05-09 11:17:26 -07:00