[PATCH] x86: Determine vector length from the last vector operand
Jan Beulich
JBeulich@suse.com
Tue Jul 24 09:56:00 GMT 2018
>>> On 22.07.18 at 21:02, <hjl.tools@gmail.com> wrote:
> Determine VEX/EVEXE vector length from the last multi-length vector
> operand.
I see you've committed this already: It would have been really
helpful to say _why_ you're doing the change in the commit message.
For posterity as well as my understanding - could you at least do so
here please? That's even more so that VEX and EVEX processing
differed in that regard before your change.
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -3363,10 +3363,12 @@ build_vex_prefix (const insn_template *t)
> vector_length = 1;
> else
> {
> - unsigned int op;
> + int op;
This is the sort of change I would have objected to, btw. Variables
used to index arrays should be unsigned whenever possible. And
doing so would have been easy enough here:
> @@ -3611,20 +3613,31 @@ build_evex_prefix (void)
> if (!i.tm.opcode_modifier.evex
> || i.tm.opcode_modifier.evex == EVEXDYN)
> {
> - unsigned int op;
> + int op;
>
> + /* Determine vector length from the last multi-length vector
> + operand. */
> vec_length = 0;
> - for (op = 0; op < i.tm.operands; ++op)
> + for (op = i.operands - 1; op >= 0; op--)
for (op = i.operands; op--; )
(similarly further down).
> if (i.tm.operand_types[op].bitfield.xmmword
> + i.tm.operand_types[op].bitfield.ymmword
> + i.tm.operand_types[op].bitfield.zmmword > 1)
> {
> if (i.types[op].bitfield.zmmword)
> - i.tm.opcode_modifier.evex = EVEX512;
> + {
> + i.tm.opcode_modifier.evex = EVEX512;
> + break;
> + }
> else if (i.types[op].bitfield.ymmword)
> - i.tm.opcode_modifier.evex = EVEX256;
> + {
> + i.tm.opcode_modifier.evex = EVEX256;
> + break;
> + }
> else if (i.types[op].bitfield.xmmword)
> - i.tm.opcode_modifier.evex = EVEX128;
> + {
> + i.tm.opcode_modifier.evex = EVEX128;
> + break;
> + }
> else if (i.broadcast && (int) op == i.broadcast->operand)
This has rendered all the "else" pointless.
Jan
More information about the Binutils
mailing list