This is the mail archive of the mailing list for the GCC 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]

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


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

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  <>

	* 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 @@
 	  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.  */

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