[PATCH/RFA] h8300-elf-sim: shift and carry flag

Michael Snyder msnyder@redhat.com
Tue Apr 8 06:18:00 GMT 2003


This corrects an error in computing the carry flag for right shift
(both arithmatic and logical).  The mask wants to be unsigned, because
(signed) 0x80000000 >> 1 is 0xc0000000.
-------------- next part --------------
2003-04-07  Michael Snyder  <msnyder@redhat.com>

	* compile.c (OSHIFTS): hm mask for computing carry flag
	must be unsigned, so that shifting it will not extend it.

Index: compile.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/h8300/compile.c,v
retrieving revision 1.70
diff -p -r1.70 compile.c
*** compile.c	2003/03/27 22:01:29	1.70
--- compile.c	2003/04/08 06:14:07
*************** case O (name, SW):				\
*** 940,946 ****
  case O (name, SL):				\
  {						\
    int t;					\
!   int hm = 0x80000000; 				\
    rd = GET_L_REG (code->src.reg);		\
    if ((GET_MEMORY_B (pc + 1) & 0x40) == 0)	\
      {						\
--- 941,947 ----
  case O (name, SL):				\
  {						\
    int t;					\
!   unsigned int hm = 0x80000000; 		\
    rd = GET_L_REG (code->src.reg);		\
    if ((GET_MEMORY_B (pc + 1) & 0x40) == 0)	\
      {						\


More information about the Gdb-patches mailing list