This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Bug: gather/scatter accepts same registers in destination/src and index
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "Michael V. Zolotukhin" <michael dot v dot zolotukhin at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 21 Jan 2014 11:44:18 +0000
- Subject: Re: Bug: gather/scatter accepts same registers in destination/src and index
- Authentication-results: sourceware.org; auth=none
- References: <CANtU078XuYEQ8AnKR2BQoRSSByKLAf_TrzdpjEO=4h09U524gQ at mail dot gmail dot com> <52DE438B0200007800115421 at nat28 dot tlf dot novell dot com> <20140121111627 dot GC13904 at msticlxl57 dot ims dot intel dot com>
>>> On 21.01.14 at 12:16, "Michael V. Zolotukhin" <michael.v.zolotukhin@gmail.com> wrote:
> @@ -4374,11 +4374,9 @@ check_VecOperands (const insn_template *t)
> if (i.reg_operands == 2 && !i.mask)
> {
> gas_assert (i.types[0].bitfield.regxmm
> - || i.types[0].bitfield.regymm
> - || i.types[0].bitfield.regzmm);
> + || i.types[0].bitfield.regymm);
> gas_assert (i.types[2].bitfield.regxmm
> - || i.types[2].bitfield.regymm
> - || i.types[2].bitfield.regzmm);
> + || i.types[2].bitfield.regymm);
How come zmm registers would no longer get here?
> @@ -4395,6 +4393,40 @@ check_VecOperands (const insn_template *t)
> }
> as_warn (_("mask, index, and destination registers should be distinct"));
> }
> + else if (i.reg_operands == 1 && i.mask)
> + {
> + gas_assert (i.types[0].bitfield.regymm
> + || i.types[0].bitfield.regzmm
> + || i.types[1].bitfield.regymm
> + || i.types[1].bitfield.regzmm);
> + if (operand_check != check_none)
> + {
> + if ((i.types[0].bitfield.regymm
> + || i.types[0].bitfield.regzmm)
> + && (register_number (i.op[0].regs)
> + == register_number (i.index_reg)))
> + {
> + if (operand_check == check_error)
> + {
> + i.error = invalid_vector_register_set;
> + return 1;
> + }
> + as_warn (_("index and source registers should be distinct"));
> + }
> + else if ((i.types[1].bitfield.regymm
> + || i.types[1].bitfield.regzmm)
> + && (register_number (i.op[1].regs)
> + == register_number (i.index_reg)))
> + {
> + if (operand_check == check_error)
> + {
> + i.error = invalid_vector_register_set;
> + return 1;
> + }
> + as_warn (_("index and destination registers should be distinct"));
> + }
> + }
> + }
> }
>
> /* Check if broadcast is supported by the instruction and is applied
> @@ -4940,7 +4972,7 @@ check_reverse:
> err_msg = _("invalid VSIB address");
> break;
> case invalid_vector_register_set:
> - err_msg = _("mask, index, and destination registers must be distinct");
> + err_msg = _("mask, index, and destination/source registers must be distinct");
I don't think scatter has as strict requirements as gather, hence
the message would be misleading if indeed possible to be issued
for a scatter instruction. Hence _if_ scatter handling can make it
here, separate messages would be needed; if not, the message
should be left unchanged.
Jan