This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug: gather/scatter accepts same registers in destination/src and index


>>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]