This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[RFA] h8-sim: all IMM16s should be zero-extended


According to the docs (and I believe this was also the prior
simulator behavior), immediates should always be zero-extended.

2003-07-02  Michael Snyder  <msnyder@redhat.com>

	* compile.c (decode): IMM16 is always zero-extended.

Index: compile.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/h8sx/compile.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -p -r1.84 -r1.85
*** compile.c	2003/06/19 04:18:52	1.84
--- compile.c	2003/07/02 19:09:27	1.85
*************** decode (SIM_DESC sd, int addr, unsigned 
*** 818,824 ****
  		       (looking_for & SIZE) == L_16U)
  		{
  		  cst[opnum] = (data[len / 2] << 8) + data[len / 2 + 1];
! 		  if ((looking_for & SIZE) != L_16U)
  		    cst[opnum] = (short) cst[opnum];	/* Sign extend.  */
  		}
  	      else if (looking_for & ABSJMP)
--- 818,826 ----
  		       (looking_for & SIZE) == L_16U)
  		{
  		  cst[opnum] = (data[len / 2] << 8) + data[len / 2 + 1];
! 		  /* Immediates are always unsigned.  */
! 		  if ((looking_for & SIZE) != L_16U &&
! 		      (looking_for & MODE) != IMM)
  		    cst[opnum] = (short) cst[opnum];	/* Sign extend.  */
  		}
  	      else if (looking_for & ABSJMP)

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