This is the mail archive of the binutils@sources.redhat.com 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]

[PATCH] : For SH target, generate warning if Destination register is same for parallel insns


Hi !

The SH assembler currently does not generate a warning if the same
destination register is used in parallel instructions. As this can lead
to unexpected results, the user needs to be warned as
is done in other commercial assemblers.

For example,
	PADD X0,Y0,A0 PMULS A1,X0,A0 

The following patch generates the warning. I have also verified that it
does not cause any
side effect on other DSP instructions.

Regards,
Arati Dikey


Changelog 
2002-01-23  Arati Dikey <aratid@kpit.com>
 
 	* tc-sh.c (get_specific): Generate warning if the same
destination register is used in 		  parallel instructions.


*** tc-sh.c.org	Thu Jan 17 16:41:28 2002
--- tc-sh.c	Wed Jan 23 12:40:45 2002
*************** get_specific (opcode, operands)
*** 1108,1113 ****
--- 1108,1115 ----
    sh_opcode_info *this_try = opcode;
    char *name = opcode->name;
    int n = 0;
+   static boolean bIsPPI = false ;
+   static int nLastDestReg ;
  
    while (opcode->name)
      {
*************** get_specific (opcode, operands)
*** 1127,1132 ****
--- 1129,1157 ----
  	{
  	  sh_operand_info *user = operands + n;
  	  sh_arg_type arg = this_try->arg[n];
+ 
+ 	  /*
+ 	  if its a parallel insn and the destination register is being
looked
+ 	  at, store it to check it against the destination register of
second
+ 	  insn in the parallel insn.
+ 	  */
+ 	  if ((n == 2) && (this_try->nibbles[0] == PPI))
+ 	  {
+ 		  if (!bIsPPI)
+ 		  {
+ 		  	bIsPPI = true ;
+ 		  	nLastDestReg = user->reg ;
+ 	  	  }
+ 		  else /* second insn */
+ 		  {
+ 			  if (nLastDestReg == user->reg)
+ 			  {
+ 			  	 as_warn (_("Destination register is
same for parallel insns !"));
+ 
+ 			  }
+ 			  bIsPPI = false ;
+ 		  }
+ 	  }
  
  	  switch (arg)
  	    {

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNUSH tool chain for Hitachi's SH Series.
The following site also offers free support to European customers.
Read more at http://www.kpit.com/products/support.htm.
Latest version of GNUSH is released on Jan 1, 2002.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 


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