[patch] h8300.c: Fix the insn length computation.

Kazu Hirata kazu@cs.umass.edu
Fri Nov 22 06:16:00 GMT 2002


Hi,

Attached is a patch to fix the insn length computation when xor.l is
output as a part of shift code.

This bug was hit by execute/ashldi-1.c when I was testing some other
patch.

The problem is that compute_a_shift_length_insn() assumes that every
assembly instruction used as a part of shift code is 2 byte even
though xor.l actually takes 4 bytes.

The patch fixes the problem by pretending that xor.l actually counts
as two assembly instructions.

Tested on h8300 port.  Committed.

Kazu Hirata

2002-11-22  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/h8300.c (compute_a_shift_length): Fix the insn
	length computation when xor.l is output.

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.160
diff -u -r1.160 h8300.c
--- h8300.c	21 Nov 2002 14:09:31 -0000	1.160
+++ h8300.c	21 Nov 2002 21:53:14 -0000
@@ -3096,6 +3096,14 @@
 	{
 	case SHIFT_SPECIAL:
 	  wlength += h8300_asm_insn_count (info.special);
+
+	  /* Every assembly instruction used in SHIFT_SPECIAL case
+	     takes 2 bytes except xor.l, which takes 4 bytes, so if we
+	     see xor.l, we just pretend that xor.l counts as two insns
+	     so that the insn length will be computed correctly.  */
+	  if (strstr (info.special, "xor.l") != NULL)
+	    wlength++;
+
 	  /* Fall through.  */
 
 	case SHIFT_INLINE:



More information about the Gcc-patches mailing list