+2020-06-09 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (vex_encoding_error): New enumerator.
+ (VEX_check_operands): Rename to VEX_check_encoding. Check
+ for vex_encoding_error. Move Imm4 handling ...
+ (check_VecOperands): ... here.
+ (match_template): Call VEX_check_encoding when there are no
+ operands. Split construct calling check_VecOperands and
+ VEX_check_encoding (when there are operands).
+ (check_register): Don't blindly set vex_encoding_evex.
+ * testsuite/gas/i386/pseudos-bad.s,
+ testsuite/gas/i386/pseudos-bad.l: New.
+ * testsuite/gas/i386/i386.exp: Run new test.
+ * testsuite/gas/i386/xmmhi64.s: Drop {vex2}.
+
2020-06-08 Alex Coplan <alex.coplan@arm.com>
* config/tc-arm.c (insns): Add dfb.
vex_encoding_default = 0,
vex_encoding_vex,
vex_encoding_vex3,
- vex_encoding_evex
+ vex_encoding_evex,
+ vex_encoding_error
} vec_encoding;
/* REP prefix. */
}
}
+ /* Check the special Imm4 cases; must be the first operand. */
+ if (t->cpu_flags.bitfield.cpuxop && t->operands == 5)
+ {
+ if (i.op[0].imms->X_op != O_constant
+ || !fits_in_imm4 (i.op[0].imms->X_add_number))
+ {
+ i.error = bad_imm4;
+ return 1;
+ }
+
+ /* Turn off Imm<N> so that update_imm won't complain. */
+ operand_type_set (&i.types[0], 0);
+ }
+
/* Check vector Disp8 operand. */
if (t->opcode_modifier.disp8memshift
&& i.disp_encoding != disp_encoding_32bit)
return 0;
}
-/* Check if operands are valid for the instruction. Update VEX
- operand types. */
+/* Check if encoding requirements are met by the instruction. */
static int
-VEX_check_operands (const insn_template *t)
+VEX_check_encoding (const insn_template *t)
{
+ if (i.vec_encoding == vex_encoding_error)
+ {
+ i.error = unsupported;
+ return 1;
+ }
+
if (i.vec_encoding == vex_encoding_evex)
{
/* This instruction must be encoded with EVEX prefix. */
return 0;
}
- /* Check the special Imm4 cases; must be the first operand. */
- if (t->cpu_flags.bitfield.cpuxop && t->operands == 5)
- {
- if (i.op[0].imms->X_op != O_constant
- || !fits_in_imm4 (i.op[0].imms->X_add_number))
- {
- i.error = bad_imm4;
- return 1;
- }
-
- /* Turn off Imm<N> so that update_imm won't complain. */
- operand_type_set (&i.types[0], 0);
- }
-
return 0;
}
/* Do not verify operands when there are none. */
if (!t->operands)
- /* We've found a match; break out of loop. */
- break;
+ {
+ if (VEX_check_encoding (t))
+ {
+ specific_error = i.error;
+ continue;
+ }
+
+ /* We've found a match; break out of loop. */
+ break;
+ }
if (!t->opcode_modifier.jump
|| t->opcode_modifier.jump == JUMP_ABSOLUTE)
slip through to break. */
}
- /* Check if vector and VEX operands are valid. */
- if (check_VecOperands (t) || VEX_check_operands (t))
+ /* Check if vector operands are valid. */
+ if (check_VecOperands (t))
+ {
+ specific_error = i.error;
+ continue;
+ }
+
+ /* Check if VEX/EVEX encoding requirements can be satisfied. */
+ if (VEX_check_encoding (t))
{
specific_error = i.error;
continue;
|| flag_code != CODE_64BIT)
return FALSE;
- i.vec_encoding = vex_encoding_evex;
+ if (i.vec_encoding == vex_encoding_default)
+ i.vec_encoding = vex_encoding_evex;
+ else if (i.vec_encoding != vex_encoding_evex)
+ i.vec_encoding = vex_encoding_error;
}
if (((r->reg_flags & (RegRex64 | RegRex)) || r->reg_type.bitfield.qword)
run_list_test "cet-ibt-inval"
run_list_test "cet-shstk-inval"
run_dump_test "pseudos"
+ run_list_test "pseudos-bad"
run_dump_test "notrack"
run_dump_test "notrack-intel"
run_list_test "notrackbad" "-al"
run_list_test "x86-64-cet-ibt-inval"
run_list_test "x86-64-cet-shstk-inval"
run_dump_test "x86-64-pseudos"
+ run_list_test "x86-64-pseudos-bad"
run_dump_test "x86-64-notrack"
run_dump_test "x86-64-notrack-intel"
run_list_test "x86-64-notrackbad" "-al"
.intel_syntax noprefix
.code64
xmm:
- {vex2} vaddps xmm0, xmm1, xmm16
- {vex2} vaddps ymm0, ymm1, ymm16
- {vex2} vaddps zmm0, zmm1, zmm16
+ vaddps xmm0, xmm1, xmm16
+ vaddps ymm0, ymm1, ymm16
+ vaddps zmm0, zmm1, zmm16