diff mbox series

[committed] Fix minor H8 bug exposed by recent combiner changes

Message ID c7b8578a-7a2a-3934-21fc-7fe4b9d2b255@redhat.com
State New
Headers show
Series [committed] Fix minor H8 bug exposed by recent combiner changes | expand

Commit Message

Jeff Law Oct. 23, 2018, 10:55 p.m. UTC
This has been latent since it's H8/SX support went in like 15 years ago...

The recent combiner changes twiddled the set of registers we need to
save sometimes.  No big deal, except for a minor bug in the H8/S H8/SX
support for stm.

On the H8/S (but not the SX) there are restrictions on the alignment of
the set of consecutive registers to save (or restore in the case of
ldm).  For example, pairs have to start on an even register.

The code had it backwards -- it had the H8/S with no restrictions, but
restrictions on the H8/SX.

This caused builds in  my tester to fail to build newlib for the H8/S.

Fixed thusly.  Installing on the trunk.

Jeff
* config/h8300/h8300.c (h8300_expand_prologue): Fix stm generation
	for H8/S.
diff mbox series

Patch

diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 596f2fd2cda..24b7485602f 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -865,15 +865,15 @@  h8300_expand_prologue (void)
 	  if (TARGET_H8300S)
 	    {
 	      /* See how many registers we can push at the same time.  */
-	      if ((!TARGET_H8300SX || (regno & 3) == 0)
+	      if ((TARGET_H8300SX || (regno & 3) == 0)
 		  && ((saved_regs >> regno) & 0x0f) == 0x0f)
 		n_regs = 4;
 
-	      else if ((!TARGET_H8300SX || (regno & 3) == 0)
+	      else if ((TARGET_H8300SX || (regno & 3) == 0)
 		       && ((saved_regs >> regno) & 0x07) == 0x07)
 		n_regs = 3;
 
-	      else if ((!TARGET_H8300SX || (regno & 1) == 0)
+	      else if ((TARGET_H8300SX || (regno & 1) == 0)
 		       && ((saved_regs >> regno) & 0x03) == 0x03)
 		n_regs = 2;
 	    }