[patch] Clean up the shift generation code in h8300 port.

Kazu Hirata kazu@hxi.com
Tue Nov 13 15:03:00 GMT 2001


Hi,

Attached is a patch to clean up the shift generation code in h8300
port.

The patch reorganize the code that deals with 7-bit shifts in HImode.
No change is made to the code that's output by gcc.

Tested on h8300 port.  Committed.

Kazu Hirata

2001-11-14  Kazu Hirata  <kazu@hxi.com>

	* config/h8300/h8300.c (get_shift_alg): Reorganize the code
	that deals with 7-bit shifts in HImode.

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.80
diff -c -r1.80 h8300.c
*** h8300.c	2001/11/13 21:00:28	1.80
--- h8300.c	2001/11/13 21:23:24
***************
*** 2420,2451 ****
      case HIshift:
        if (count == 7)
  	{
! 	  if (shift_type == SHIFT_ASHIFT && TARGET_H8300)
  	    {
! 	      info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.b\t%t0\n\trotr.b\t%s0\n\tand.b\t#0x80,%s0";
  	      goto end;
! 	    }
! 
! 	  if (shift_type == SHIFT_ASHIFT && TARGET_H8300H)
! 	    {
! 	      info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.w\t%T0\n\tand.b\t#0x80,%s0";
! 	      goto end;
! 	    }
! 
! 	  if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300)
! 	    {
! 	      info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\trotl.b\t%t0\n\tand.b\t#0x01,%t0";
  	      goto end;
! 	    }
! 
! 	  if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300H)
! 	    {
! 	      info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.w\t%T0\n\tand.b\t#0x01,%t0";
! 	      goto end;
! 	    }
! 
! 	  if (shift_type == SHIFT_ASHIFTRT)
! 	    {
  	      info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\tsubx\t%t0,%t0";
  	      goto end;
  	    }
--- 2420,2440 ----
      case HIshift:
        if (count == 7)
  	{
! 	  switch (shift_type)
  	    {
! 	    case SHIFT_ASHIFT:
! 	      if (TARGET_H8300)
! 		info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.b\t%t0\n\trotr.b\t%s0\n\tand.b\t#0x80,%s0";
! 	      else
! 		info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.w\t%T0\n\tand.b\t#0x80,%s0";
  	      goto end;
! 	    case SHIFT_LSHIFTRT:
! 	      if (TARGET_H8300)
! 		info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\trotl.b\t%t0\n\tand.b\t#0x01,%t0";
! 	      else
! 		info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.w\t%T0\n\tand.b\t#0x01,%t0";
  	      goto end;
! 	    case SHIFT_ASHIFTRT:
  	      info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\tsubx\t%t0,%t0";
  	      goto end;
  	    }



More information about the Gcc-patches mailing list