From 6865c0435a54e6d5f1fcc5cdcd56895e9a3c5484 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 14 Sep 2018 12:19:58 -0700 Subject: 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. --- gas/ChangeLog | 7 +++++++ gas/config/tc-i386.c | 31 ++++++++++++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 7b24076..ff09469 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,12 @@ 2018-09-14 H.J. Lu + 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. + +2018-09-14 H.J. Lu + PR binutils/23655 * testsuite/gas/i386/evex.d: Updated. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index e8284e0..d2ee3b4 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3499,10 +3499,13 @@ build_vex_prefix (const insn_template *t) of RXB bits from REX. */ i.vex.bytes[1] = (~i.rex & 0x7) << 5 | m; - /* Check the REX.W bit. */ - w = (i.rex & REX_W) ? 1 : 0; - if (i.tm.opcode_modifier.vexw == VEXW1) - w = 1; + /* Check the REX.W bit and VEXW. */ + if (i.tm.opcode_modifier.vexw == VEXWIG) + w = (i.rex & REX_W) ? 1 : 0; + else if (i.tm.opcode_modifier.vexw) + w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0; + else + w = (i.rex & REX_W) ? 1 : 0; i.vex.bytes[2] = (w << 7 | register_specifier << 3 @@ -3629,19 +3632,13 @@ build_evex_prefix (void) i.vrex &= ~vrex_used; gas_assert (i.vrex == 0); - /* Check the REX.W bit. */ - w = (i.rex & REX_W) ? 1 : 0; - if (i.tm.opcode_modifier.vexw) - { - if (i.tm.opcode_modifier.vexw == VEXW1) - w = 1; - } - /* If w is not set it means we are dealing with WIG instruction. */ - else if (!w) - { - if (evexwig == evexw1) - w = 1; - } + /* Check the REX.W bit and VEXW. */ + if (i.tm.opcode_modifier.vexw == VEXWIG) + w = (evexwig == evexw1 || (i.rex & REX_W)) ? 1 : 0; + else if (i.tm.opcode_modifier.vexw) + w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0; + else + w = (i.rex & REX_W) ? 1 : 0; /* Encode the U bit. */ implied_prefix |= 0x4; -- cgit v1.1