public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] h8300.c: Clean up output_a_shift().
@ 2002-12-19 20:06 Kazu Hirata
  0 siblings, 0 replies; only message in thread
From: Kazu Hirata @ 2002-12-19 20:06 UTC (permalink / raw)
  To: gcc-patches

Hi,

Attached is a patch to clean up output_a_shift().

On h8300 port, some shifts in SImode used to use rotation followed by
and, but not anymore, so the patch removes the code to output such
assembly instructions.

Tested on h8300 port.  Committed.

Kazu Hirata

2002-12-19  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/h8300.md (output_a_shift): Clean up the code to
	output shifts using rotation.

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.175
diff -c -r1.175 h8300.c
*** h8300.c	16 Dec 2002 18:21:13 -0000	1.175
--- h8300.c	19 Dec 2002 20:18:04 -0000
***************
*** 3026,3055 ****
  	      output_asm_insn (info.shift1, operands);
  
  	    /* Now mask off the high bits.  */
! 	    if (TARGET_H8300)
  	      {
! 		switch (mode)
  		  {
- 		  case QImode:
- 		    sprintf (insn_buf, "and\t#%d,%%X0", mask);
- 		    cc_status.value1 = operands[0];
- 		    cc_status.flags |= CC_NO_CARRY;
- 		    break;
- 		  case HImode:
  		    sprintf (insn_buf, "and\t#%d,%%s0\n\tand\t#%d,%%t0",
  			     mask & 255, mask >> 8);
- 		    break;
- 		  default:
- 		    abort ();
  		  }
! 	      }
! 	    else
! 	      {
! 		sprintf (insn_buf, "and.%c\t#%d,%%%c0",
! 			 "bwl"[shift_mode], mask,
! 			 mode == QImode ? 'X' : mode == HImode ? 'T' : 'S');
! 		cc_status.value1 = operands[0];
! 		cc_status.flags |= CC_NO_CARRY;
  	      }
  	    output_asm_insn (insn_buf, operands);
  	    return "";
--- 3026,3053 ----
  	      output_asm_insn (info.shift1, operands);
  
  	    /* Now mask off the high bits.  */
! 	    switch (mode)
  	      {
! 	      case QImode:
! 		sprintf (insn_buf, "and\t#%d,%%X0", mask);
! 		cc_status.value1 = operands[0];
! 		cc_status.flags |= CC_NO_CARRY;
! 		break;
! 	      case HImode:
! 		if (TARGET_H8300)
  		  {
  		    sprintf (insn_buf, "and\t#%d,%%s0\n\tand\t#%d,%%t0",
  			     mask & 255, mask >> 8);
  		  }
! 		else
! 		  {
! 		    sprintf (insn_buf, "and.w\t#%d,%%T0", mask);
! 		    cc_status.value1 = operands[0];
! 		    cc_status.flags |= CC_NO_CARRY;
! 		  }
! 		break;
! 	      default:
! 		abort ();
  	      }
  	    output_asm_insn (insn_buf, operands);
  	    return "";

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-20  4:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-19 20:06 [patch] h8300.c: Clean up output_a_shift() Kazu Hirata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).