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]

H8300 assembler generates incorrect machine code for stm.l (er0-er1),@-er7


Hi,
The H8300-*-as generates incorrect machine code for stm.l (er0-er1),@-er7 instruction ( or similar stm.l/ldm.l instructions). But it generates correct machine code for stm.l  er0-er1,@-er7. 

Either it should give error if operands are given in '(' ')' or it should generate correct code.

Following patch makes it to accept the '(' ')' in the instruction.
The patch is for binutils version 2.12.1.

Regards
Shrinivas

=====================================================================

*** gas/config/tc-h8300.org.c	Thu May  9 08:12:57 2002
--- gas/config/tc-h8300.c	Fri May 31 10:56:58 2002
***************
*** 414,417 ****
--- 414,418 ----
    unsigned int num;
    unsigned int len;
+   unsigned int iPos=0;
  
    op->mode = E;
***************
*** 419,429 ****
    /* Gross.  Gross.  ldm and stm have a format not easily handled
       by get_operand.  We deal with it explicitly here.  */
!   if (src[0] == 'e' && src[1] == 'r' && ISDIGIT (src[2])
!       && src[3] == '-' && src[4] == 'e' && src[5] == 'r' && ISDIGIT (src[6]))
      {
        int low, high;
  
!       low = src[2] - '0';
!       high = src[6] - '0';
  
        if (high < low)
--- 420,436 ----
    /* Gross.  Gross.  ldm and stm have a format not easily handled
       by get_operand.  We deal with it explicitly here.  */
!   
!   /* Check for '(' and ')' for instructions ldm and stm */
!   
!   if(src[0] == '(' && src[8] == ')')
!   		iPos++;
!   		
!   if (src[0+iPos] == 'e' && src[1+iPos] == 'r' && ISDIGIT (src[2+iPos])
!       && src[3+iPos] == '-' && src[4+iPos] == 'e' && src[5+iPos] == 'r' && ISDIGIT (src[6+iPos]))
      {
        int low, high;
  
!       low = src[2+iPos] - '0';
!       high = src[6+iPos] - '0';
  
        if (high < low)
***************
*** 446,450 ****
        op->reg = 0x80000000 | (high << 8) | low;
        op->mode = REG;
!       *ptr = src + 7;
        return;
      }
--- 453,457 ----
        op->reg = 0x80000000 | (high << 8) | low;
        op->mode = REG;
!       *ptr = src + 7 + (iPos*2); 
        return;
      }
==========================================================================

-----------------------------------------------------------------------------
Free download of GNUSH and GNUH8 tool chains for Hitachi's SH and H8 Series.
The following site also offers free support to European customers.
Read more at http://www.kpit.com/products/support.htm
Latest versions of GNUSH and GNUH8 are released on Apr 1, 2002.
-----------------------------------------------------------------------------


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