This is the mail archive of the gcc-patches@gcc.gnu.org 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]

assertify h8300 target


This patch assertifies the h8300 target files.  I built an h8300-none-elf
cross compiler and built a newlib for same to test.  Although I did get
a large number of failures, I didn't get any different failures with
and without the patch. (Actually, I got one extra failure due to a timed
out test at -O3 -unroll-all=loops -inline, which I believe was caused
by the change in machine load at the time.  I manually ran that test
subsequently, and all was ok.)

ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-04-29  Nathan Sidwell  <nathan@codesourcery.com>

	* config/h8300/h8300.c (byte_reg): Use gcc_assert and
	gcc_unreachable as appropriate.
	(split_adds_subs, cond_string, print_operand,
	h8300_initial_elimination_offset, h8300_classify_operand,
	h8300_unary_length, h8300_short_immediate_length,
	h8300_bitfield_length, h8300_binary_length,
	h8300_insn_length_from_table, compute_mov_length, output_plussi,
	compute_plussi_length, compute_plussi_cc, output_logical_op,
	compute_logical_op_length, compute_logical_op_cc,
	output_h8sx_shift, get_shift_alg, h8300_shift_needs_scratch_p,
	output_a_shift, compute_a_shift_length, compute_a_shift_cc,
	output_a_rotate, compute_a_rotate_length, fix_bit_operand,
	h8300_regs_ok_for_stm): Likewise.
	* config/h8300/h8300.md (*movsi_h8300, *movsf_h8300,
	monitor_prologue): Likewise.

Index: config/h8300/h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.297
diff -c -3 -p -r1.297 h8300.c
*** config/h8300/h8300.c	23 Apr 2005 21:28:19 -0000	1.297
--- config/h8300/h8300.c	29 Apr 2005 14:10:54 -0000
*************** byte_reg (rtx x, int b)
*** 481,488 ****
      "r4l", "r4h", "r5l", "r5h", "r6l", "r6h", "r7l", "r7h"
    };
  
!   if (!REG_P (x))
!     abort ();
  
    return names_small[REGNO (x) * 2 + b];
  }
--- 481,487 ----
      "r4l", "r4h", "r5l", "r5h", "r6l", "r6h", "r7l", "r7h"
    };
  
!   gcc_assert (REG_P (x));
  
    return names_small[REGNO (x) * 2 + b];
  }
*************** split_adds_subs (enum machine_mode mode,
*** 1001,1007 ****
        break;
  
      default:
!       abort ();
      }
  
    /* Try different amounts in descending order.  */
--- 1000,1006 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
  
    /* Try different amounts in descending order.  */
*************** cond_string (enum rtx_code code)
*** 1366,1372 ****
      case LTU:
        return "lo";
      default:
!       abort ();
      }
  }
  
--- 1365,1371 ----
      case LTU:
        return "lo";
      default:
!       gcc_unreachable ();
      }
  }
  
*************** print_operand (FILE *file, rtx x, int co
*** 1391,1397 ****
  	  fprintf (file, "#%ld", (-INTVAL (x)) & 0xff);
  	  break;
  	default:
! 	  abort ();
  	}
        break;
      case 'F':
--- 1390,1396 ----
  	  fprintf (file, "#%ld", (-INTVAL (x)) & 0xff);
  	  break;
  	default:
! 	  gcc_unreachable ();
  	}
        break;
      case 'F':
*************** print_operand (FILE *file, rtx x, int co
*** 1404,1415 ****
  	  fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8);
  	  break;
  	default:
! 	  abort ();
  	}
        break;
      case 'G':
!       if (GET_CODE (x) != CONST_INT)
! 	abort ();
        fprintf (file, "#%ld", 0xff & (-INTVAL (x)));
        break;
      case 'S':
--- 1403,1413 ----
  	  fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8);
  	  break;
  	default:
! 	  gcc_unreachable ();
  	}
        break;
      case 'G':
!       gcc_assert (GET_CODE (x) == CONST_INT);
        fprintf (file, "#%ld", 0xff & (-INTVAL (x)));
        break;
      case 'S':
*************** print_operand (FILE *file, rtx x, int co
*** 1426,1439 ****
        break;
      case 'V':
        bitint = exact_log2 (INTVAL (x) & 0xff);
!       if (bitint == -1)
! 	abort ();
        fprintf (file, "#%d", bitint);
        break;
      case 'W':
        bitint = exact_log2 ((~INTVAL (x)) & 0xff);
!       if (bitint == -1)
! 	abort ();
        fprintf (file, "#%d", bitint);
        break;
      case 'R':
--- 1424,1435 ----
        break;
      case 'V':
        bitint = exact_log2 (INTVAL (x) & 0xff);
!       gcc_assert (bitint >= 0);
        fprintf (file, "#%d", bitint);
        break;
      case 'W':
        bitint = exact_log2 ((~INTVAL (x)) & 0xff);
!       gcc_assert (bitint >= 0);
        fprintf (file, "#%d", bitint);
        break;
      case 'R':
*************** print_operand (FILE *file, rtx x, int co
*** 1444,1451 ****
  	goto def;
        break;
      case 'Y':
!       if (bitint == -1)
! 	abort ();
        if (GET_CODE (x) == REG)
  	fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l');
        else
--- 1440,1446 ----
  	goto def;
        break;
      case 'Y':
!       gcc_assert (bitint >= 0);
        if (GET_CODE (x) == REG)
  	fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l');
        else
*************** print_operand (FILE *file, rtx x, int co
*** 1497,1503 ****
  	    break;
  	  }
  	default:
! 	  abort ();
  	  break;
  	}
        break;
--- 1492,1498 ----
  	    break;
  	  }
  	default:
! 	  gcc_unreachable ();
  	  break;
  	}
        break;
*************** print_operand (FILE *file, rtx x, int co
*** 1527,1533 ****
  	    break;
  	  }
  	default:
! 	  abort ();
  	}
        break;
      case 'j':
--- 1522,1528 ----
  	    break;
  	  }
  	default:
! 	  gcc_unreachable ();
  	}
        break;
      case 'j':
*************** print_operand (FILE *file, rtx x, int co
*** 1537,1552 ****
        fputs (cond_string (reverse_condition (GET_CODE (x))), file);
        break;
      case 'm':
!       if (GET_CODE (x) != CONST_INT)
! 	abort ();
!       if (INTVAL (x) == 1)
! 	fputs (".b", file);
!       else if (INTVAL (x) == 2)
! 	fputs (".w", file);
!       else if (INTVAL (x) == 4)
! 	fputs (".l", file);
!       else
! 	abort ();
        break;
      case 'o':
        print_operand_address (file, x);
--- 1532,1555 ----
        fputs (cond_string (reverse_condition (GET_CODE (x))), file);
        break;
      case 'm':
!       gcc_assert (GET_CODE (x) == CONST_INT);
!       switch (INTVAL (x))
! 	{
! 	case 1:
! 	  fputs (".b", file);
! 	  break;
! 
! 	case 2:
! 	  fputs (".w", file);
! 	  break;
! 
! 	case 4:
! 	  fputs (".l", file);
! 	  break;
! 
! 	default:
! 	  gcc_unreachable ();
! 	}
        break;
      case 'o':
        print_operand_address (file, x);
*************** print_operand (FILE *file, rtx x, int co
*** 1612,1618 ****
  	      fprintf (file, "%s", names_extended[REGNO (x)]);
  	      break;
  	    default:
! 	      abort ();
  	    }
  	  break;
  
--- 1615,1621 ----
  	      fprintf (file, "%s", names_extended[REGNO (x)]);
  	      break;
  	    default:
! 	      gcc_unreachable ();
  	    }
  	  break;
  
*************** h8300_initial_elimination_offset (int fr
*** 1846,1853 ****
       pointer int account.  */
    saved_regs_size -= fp_size;
  
!   if (to == HARD_FRAME_POINTER_REGNUM)
      {
        switch (from)
  	{
  	case ARG_POINTER_REGNUM:
--- 1849,1857 ----
       pointer int account.  */
    saved_regs_size -= fp_size;
  
!   switch (to)
      {
+     case HARD_FRAME_POINTER_REGNUM:
        switch (from)
  	{
  	case ARG_POINTER_REGNUM:
*************** h8300_initial_elimination_offset (int fr
*** 1857,1867 ****
  	case FRAME_POINTER_REGNUM:
  	  return -saved_regs_size;
  	default:
! 	  abort ();
  	}
!     }
!   else if (to == STACK_POINTER_REGNUM)
!     {
        switch (from)
  	{
  	case ARG_POINTER_REGNUM:
--- 1861,1870 ----
  	case FRAME_POINTER_REGNUM:
  	  return -saved_regs_size;
  	default:
! 	  gcc_unreachable ();
  	}
!       break;
!     case STACK_POINTER_REGNUM:
        switch (from)
  	{
  	case ARG_POINTER_REGNUM:
*************** h8300_initial_elimination_offset (int fr
*** 1871,1881 ****
  	case FRAME_POINTER_REGNUM:
  	  return frame_size;
  	default:
! 	  abort ();
  	}
      }
!   else
!     abort ();
  }
  
  /* Worker function for RETURN_ADDR_RTX.  */
--- 1874,1886 ----
  	case FRAME_POINTER_REGNUM:
  	  return frame_size;
  	default:
! 	  gcc_unreachable ();
  	}
+       break;
+     default:
+       gcc_unreachable ();
      }
!   gcc_unreachable ();
  }
  
  /* Worker function for RETURN_ADDR_RTX.  */
*************** h8300_classify_operand (rtx op, int size
*** 2196,2207 ****
  	  return 0;
  	}
      }
!   else if (register_operand (op, VOIDmode))
!     {
!       *class = H8OP_REGISTER;
!       return 0;
!     }
!   abort ();
  }
  
  /* Return the length of the instruction described by TABLE given that
--- 2201,2209 ----
  	  return 0;
  	}
      }
!   gcc_assert (register_operand (op, VOIDmode));
!   *class = H8OP_REGISTER;
!   return 0;
  }
  
  /* Return the length of the instruction described by TABLE given that
*************** h8300_unary_length (rtx op)
*** 2246,2252 ****
        return operand_length + 6;
  
      default:
!       abort ();
      }
  }
  
--- 2248,2254 ----
        return operand_length + 6;
  
      default:
!       gcc_unreachable ();
      }
  }
  
*************** h8300_short_immediate_length (rtx op)
*** 2272,2278 ****
        return 4 + operand_length;
  
      default:
!       abort ();
      }
  }
  
--- 2274,2280 ----
        return 4 + operand_length;
  
      default:
!       gcc_unreachable ();
      }
  }
  
*************** h8300_bitfield_length (rtx op, rtx op2)
*** 2286,2293 ****
  
    if (GET_CODE (op) == REG)
      op = op2;
!   if (GET_CODE (op) == REG)
!     abort ();
    
    size = GET_MODE_SIZE (GET_MODE (op));
    operand_length = h8300_classify_operand (op, size, &class);
--- 2288,2294 ----
  
    if (GET_CODE (op) == REG)
      op = op2;
!   gcc_assert (GET_CODE (op) != REG);
    
    size = GET_MODE_SIZE (GET_MODE (op));
    operand_length = h8300_classify_operand (op, size, &class);
*************** h8300_bitfield_length (rtx op, rtx op2)
*** 2300,2306 ****
        return 4 + operand_length;
  
      default:
!       abort ();
      }
  }
  
--- 2301,2307 ----
        return 4 + operand_length;
  
      default:
!       gcc_unreachable ();
      }
  }
  
*************** h8300_binary_length (rtx insn, const h83
*** 2312,2329 ****
    rtx set;
  
    set = single_set (insn);
!   if (set == 0)
!     abort ();
  
    if (BINARY_P (SET_SRC (set)))
      return h8300_length_from_table (XEXP (SET_SRC (set), 0),
  				    XEXP (SET_SRC (set), 1), table);
-   else if (GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == RTX_TERNARY)
-     return h8300_length_from_table (XEXP (XEXP (SET_SRC (set), 1), 0),
- 				    XEXP (XEXP (SET_SRC (set), 1), 1),
- 				    table);
    else
!     abort ();
  }
  
  /* Subroutine of h8300_move_length.  Return true if OP is 1- or 2-byte
--- 2313,2330 ----
    rtx set;
  
    set = single_set (insn);
!   gcc_assert (set);
  
    if (BINARY_P (SET_SRC (set)))
      return h8300_length_from_table (XEXP (SET_SRC (set), 0),
  				    XEXP (SET_SRC (set), 1), table);
    else
!     {
!       gcc_assert (GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == RTX_TERNARY);
!       return h8300_length_from_table (XEXP (XEXP (SET_SRC (set), 1), 0),
! 				      XEXP (XEXP (SET_SRC (set), 1), 1),
! 				      table);
!     }
  }
  
  /* Subroutine of h8300_move_length.  Return true if OP is 1- or 2-byte
*************** h8300_insn_length_from_table (rtx insn, 
*** 2401,2407 ****
    switch (get_attr_length_table (insn))
      {
      case LENGTH_TABLE_NONE:
!       abort ();
  
      case LENGTH_TABLE_ADDB:
        return h8300_binary_length (insn, &addb_length_table);
--- 2402,2408 ----
    switch (get_attr_length_table (insn))
      {
      case LENGTH_TABLE_NONE:
!       gcc_unreachable ();
  
      case LENGTH_TABLE_ADDB:
        return h8300_binary_length (insn, &addb_length_table);
*************** h8300_insn_length_from_table (rtx insn, 
*** 2444,2452 ****
        
      case LENGTH_TABLE_BITBRANCH:
        return h8300_bitfield_length (operands[1], operands[2]) - 2;
!       
      }
-   abort ();
  }
  
  /* Return true if LHS and RHS are memory references that can be mapped
--- 2445,2454 ----
        
      case LENGTH_TABLE_BITBRANCH:
        return h8300_bitfield_length (operands[1], operands[2]) - 2;
! 
!     default:
!       gcc_unreachable ();
      }
  }
  
  /* Return true if LHS and RHS are memory references that can be mapped
*************** compute_mov_length (rtx *operands)
*** 2711,2717 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        /* Adjust the length based on the addressing mode used.
--- 2713,2719 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Adjust the length based on the addressing mode used.
*************** compute_mov_length (rtx *operands)
*** 2831,2837 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        /* Adjust the length based on the addressing mode used.
--- 2833,2839 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Adjust the length based on the addressing mode used.
*************** output_plussi (rtx *operands)
*** 2875,2882 ****
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   if (mode != SImode)
!     abort ();
  
    if (TARGET_H8300)
      {
--- 2877,2883 ----
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   gcc_assert (mode == SImode);
  
    if (TARGET_H8300)
      {
*************** compute_plussi_length (rtx *operands)
*** 2960,2967 ****
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   if (mode != SImode)
!     abort ();
  
    if (TARGET_H8300)
      {
--- 2961,2967 ----
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   gcc_assert (mode == SImode);
  
    if (TARGET_H8300)
      {
*************** compute_plussi_cc (rtx *operands)
*** 3040,3047 ****
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   if (mode != SImode)
!     abort ();
  
    if (TARGET_H8300)
      {
--- 3040,3046 ----
  {
    enum machine_mode mode = GET_MODE (operands[0]);
  
!   gcc_assert (mode == SImode);
  
    if (TARGET_H8300)
      {
*************** output_logical_op (enum machine_mode mod
*** 3135,3141 ****
        opname = "xor";
        break;
      default:
!       abort ();
      }
  
    switch (mode)
--- 3134,3140 ----
        opname = "xor";
        break;
      default:
!       gcc_unreachable ();
      }
  
    switch (mode)
*************** output_logical_op (enum machine_mode mod
*** 3267,3273 ****
  	}
        break;
      default:
!       abort ();
      }
    return "";
  }
--- 3266,3272 ----
  	}
        break;
      default:
!       gcc_unreachable ();
      }
    return "";
  }
*************** compute_logical_op_length (enum machine_
*** 3413,3419 ****
  	}
        break;
      default:
!       abort ();
      }
    return length;
  }
--- 3412,3418 ----
  	}
        break;
      default:
!       gcc_unreachable ();
      }
    return length;
  }
*************** compute_logical_op_cc (enum machine_mode
*** 3495,3501 ****
  	}
        break;
      default:
!       abort ();
      }
    return cc;
  }
--- 3494,3500 ----
  	}
        break;
      default:
!       gcc_unreachable ();
      }
    return cc;
  }
*************** output_h8sx_shift (rtx *operands, int su
*** 3633,3639 ****
        break;
  
      default:
!       abort ();
      }
    if (operands[2] == const1_rtx)
      sprintf (buffer, "%s.%c\t%%%c0", stem, suffix, optype);
--- 3632,3638 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
    if (operands[2] == const1_rtx)
      sprintf (buffer, "%s.%c\t%%%c0", stem, suffix, optype);
*************** get_shift_alg (enum shift_type shift_typ
*** 3914,3920 ****
        break;
  
      default:
!       abort ();
      }
  
    /* Fill in INFO.  Return unless we have SHIFT_SPECIAL.  */
--- 3913,3919 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
  
    /* Fill in INFO.  Return unless we have SHIFT_SPECIAL.  */
*************** get_shift_alg (enum shift_type shift_typ
*** 3953,3964 ****
      case QIshift:
        /* For ASHIFTRT by 7 bits, the sign bit is simply replicated
  	 through the entire value.  */
!       if (shift_type == SHIFT_ASHIFTRT && count == 7)
! 	{
! 	  info->special = "shll\t%X0\n\tsubx\t%X0,%X0";
! 	  goto end;
! 	}
!       abort ();
  
      case HIshift:
        if (count == 7)
--- 3952,3960 ----
      case QIshift:
        /* For ASHIFTRT by 7 bits, the sign bit is simply replicated
  	 through the entire value.  */
!       gcc_assert (shift_type == SHIFT_ASHIFTRT && count == 7);
!       info->special = "shll\t%X0\n\tsubx\t%X0,%X0";
!       goto end;
  
      case HIshift:
        if (count == 7)
*************** get_shift_alg (enum shift_type shift_typ
*** 4040,4046 ****
  		  info->cc_special = CC_SET_ZNV;
  		}
  	      else /* TARGET_H8300S */
! 		abort ();
  	      goto end;
  	    }
  	}
--- 4036,4042 ----
  		  info->cc_special = CC_SET_ZNV;
  		}
  	      else /* TARGET_H8300S */
! 		gcc_unreachable ();
  	      goto end;
  	    }
  	}
*************** get_shift_alg (enum shift_type shift_typ
*** 4059,4065 ****
  	      goto end;
  	    }
  	}
!       abort ();
  
      case SIshift:
        if (TARGET_H8300 && 8 <= count && count <= 9)
--- 4055,4061 ----
  	      goto end;
  	    }
  	}
!       gcc_unreachable ();
  
      case SIshift:
        if (TARGET_H8300 && 8 <= count && count <= 9)
*************** get_shift_alg (enum shift_type shift_typ
*** 4100,4106 ****
  	  switch (shift_type)
  	    {
  	    case SHIFT_ASHIFT:
! 	      abort ();
  	    case SHIFT_LSHIFTRT:
  	      info->special = "bld\t#7,%z0\n\tmov.w\t%e0,%f0\n\txor\t%y0,%y0\n\txor\t%z0,%z0\n\trotxl\t%w0\n\trotxl\t%x0\n\trotxl\t%y0";
  	      goto end;
--- 4096,4102 ----
  	  switch (shift_type)
  	    {
  	    case SHIFT_ASHIFT:
! 	      gcc_unreachable ();
  	    case SHIFT_LSHIFTRT:
  	      info->special = "bld\t#7,%z0\n\tmov.w\t%e0,%f0\n\txor\t%y0,%y0\n\txor\t%z0,%z0\n\trotxl\t%w0\n\trotxl\t%x0\n\trotxl\t%y0";
  	      goto end;
*************** get_shift_alg (enum shift_type shift_typ
*** 4122,4128 ****
  	      info->cc_special = CC_SET_ZNV;
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      abort ();
  	    }
  	}
        else if ((TARGET_H8300 && 16 <= count && count <= 20)
--- 4118,4124 ----
  	      info->cc_special = CC_SET_ZNV;
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      gcc_unreachable ();
  	    }
  	}
        else if ((TARGET_H8300 && 16 <= count && count <= 20)
*************** get_shift_alg (enum shift_type shift_typ
*** 4227,4233 ****
  		info->special = "sub.w\t%f0,%f0\n\trotl.l\t#2,%S0\n\trotl.l\t#2,%S0\n\textu.l\t%S0";
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      abort ();
  	    }
  	}
        else if (!TARGET_H8300 && count == 29)
--- 4223,4229 ----
  		info->special = "sub.w\t%f0,%f0\n\trotl.l\t#2,%S0\n\trotl.l\t#2,%S0\n\textu.l\t%S0";
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      gcc_unreachable ();
  	    }
  	}
        else if (!TARGET_H8300 && count == 29)
*************** get_shift_alg (enum shift_type shift_typ
*** 4253,4259 ****
  		}
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      abort ();
  	    }
  	}
        else if (!TARGET_H8300 && count == 30)
--- 4249,4255 ----
  		}
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      gcc_unreachable ();
  	    }
  	}
        else if (!TARGET_H8300 && count == 30)
*************** get_shift_alg (enum shift_type shift_typ
*** 4273,4279 ****
  		info->special = "sub.w\t%f0,%f0\n\trotl.l\t#2,%S0\n\textu.l\t%S0";
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      abort ();
  	    }
  	}
        else if (count == 31)
--- 4269,4275 ----
  		info->special = "sub.w\t%f0,%f0\n\trotl.l\t#2,%S0\n\textu.l\t%S0";
  	      goto end;
  	    case SHIFT_ASHIFTRT:
! 	      gcc_unreachable ();
  	    }
  	}
        else if (count == 31)
*************** get_shift_alg (enum shift_type shift_typ
*** 4312,4321 ****
  		}
  	    }
  	}
!       abort ();
  
      default:
!       abort ();
      }
  
   end:
--- 4308,4317 ----
  		}
  	    }
  	}
!       gcc_unreachable ();
  
      default:
!       gcc_unreachable ();
      }
  
   end:
*************** h8300_shift_needs_scratch_p (int count, 
*** 4365,4371 ****
        break;
  
      default:
!       abort ();
      }
  
    /* On H8/300H, count == 8 uses a scratch register.  */
--- 4361,4367 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
  
    /* On H8/300H, count == 8 uses a scratch register.  */
*************** output_a_shift (rtx *operands)
*** 4385,4390 ****
--- 4381,4387 ----
    enum shift_type shift_type;
    enum shift_mode shift_mode;
    struct shift_info info;
+   int n;
  
    loopend_lab++;
  
*************** output_a_shift (rtx *operands)
*** 4400,4406 ****
        shift_mode = SIshift;
        break;
      default:
!       abort ();
      }
  
    switch (code)
--- 4397,4403 ----
        shift_mode = SIshift;
        break;
      default:
!       gcc_unreachable ();
      }
  
    switch (code)
*************** output_a_shift (rtx *operands)
*** 4415,4529 ****
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       abort ();
!     }
! 
!   if (GET_CODE (operands[2]) != CONST_INT)
!     {
!       /* This case must be taken care of by one of the two splitters
! 	 that convert a variable shift into a loop.  */
!       abort ();
      }
-   else
-     {
-       int n = INTVAL (operands[2]);
- 
-       /* If the count is negative, make it 0.  */
-       if (n < 0)
- 	n = 0;
-       /* If the count is too big, truncate it.
-          ANSI says shifts of GET_MODE_BITSIZE are undefined - we choose to
- 	 do the intuitive thing.  */
-       else if ((unsigned int) n > GET_MODE_BITSIZE (mode))
- 	n = GET_MODE_BITSIZE (mode);
  
!       get_shift_alg (shift_type, shift_mode, n, &info);
  
!       switch (info.alg)
! 	{
! 	case SHIFT_SPECIAL:
! 	  output_asm_insn (info.special, operands);
! 	  /* Fall through.  */
  
! 	case SHIFT_INLINE:
! 	  n = info.remainder;
  
! 	  /* Emit two bit shifts first.  */
! 	  if (info.shift2 != NULL)
! 	    {
! 	      for (; n > 1; n -= 2)
! 		output_asm_insn (info.shift2, operands);
! 	    }
  
! 	  /* Now emit one bit shifts for any residual.  */
! 	  for (; n > 0; n--)
! 	    output_asm_insn (info.shift1, operands);
! 	  return "";
  
! 	case SHIFT_ROT_AND:
  	  {
! 	    int m = GET_MODE_BITSIZE (mode) - n;
! 	    const int mask = (shift_type == SHIFT_ASHIFT
! 			      ? ((1 << m) - 1) << n
! 			      : (1 << m) - 1);
! 	    char insn_buf[200];
! 
! 	    /* Not all possibilities of rotate are supported.  They shouldn't
! 	       be generated, but let's watch for 'em.  */
! 	    if (info.shift1 == 0)
! 	      abort ();
! 
! 	    /* Emit two bit rotates first.  */
! 	    if (info.shift2 != NULL)
! 	      {
! 		for (; m > 1; m -= 2)
! 		  output_asm_insn (info.shift2, operands);
! 	      }
! 
! 	    /* Now single bit rotates for any residual.  */
! 	    for (; m > 0; m--)
! 	      output_asm_insn (info.shift1, operands);
  
! 	    /* Now mask off the high bits.  */
! 	    if (mode == QImode)
! 	      sprintf (insn_buf, "and\t#%d,%%X0", mask);
! 	    else if (mode == HImode && (TARGET_H8300H || TARGET_H8300S))
! 	      sprintf (insn_buf, "and.w\t#%d,%%T0", mask);
! 	    else
! 	      abort ();
  
! 	    output_asm_insn (insn_buf, operands);
! 	    return "";
  	  }
  
! 	case SHIFT_LOOP:
! 	  /* A loop to shift by a "large" constant value.
! 	     If we have shift-by-2 insns, use them.  */
! 	  if (info.shift2 != NULL)
! 	    {
! 	      fprintf (asm_out_file, "\tmov.b	#%d,%sl\n", n / 2,
! 		       names_big[REGNO (operands[4])]);
! 	      fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
! 	      output_asm_insn (info.shift2, operands);
! 	      output_asm_insn ("add	#0xff,%X4", operands);
! 	      fprintf (asm_out_file, "\tbne	.Llt%d\n", loopend_lab);
! 	      if (n % 2)
! 		output_asm_insn (info.shift1, operands);
! 	    }
! 	  else
! 	    {
! 	      fprintf (asm_out_file, "\tmov.b	#%d,%sl\n", n,
! 		       names_big[REGNO (operands[4])]);
! 	      fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
! 	      output_asm_insn (info.shift1, operands);
! 	      output_asm_insn ("add	#0xff,%X4", operands);
! 	      fprintf (asm_out_file, "\tbne	.Llt%d\n", loopend_lab);
! 	    }
! 	  return "";
  
! 	default:
! 	  abort ();
  	}
      }
  }
  
--- 4412,4528 ----
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       gcc_unreachable ();
      }
  
!   /* This case must be taken care of by one of the two splitters
!      that convert a variable shift into a loop.  */
!   gcc_assert (GET_CODE (operands[2]) == CONST_INT);
!   
!   n = INTVAL (operands[2]);
  
!   /* If the count is negative, make it 0.  */
!   if (n < 0)
!     n = 0;
!   /* If the count is too big, truncate it.
!      ANSI says shifts of GET_MODE_BITSIZE are undefined - we choose to
!      do the intuitive thing.  */
!   else if ((unsigned int) n > GET_MODE_BITSIZE (mode))
!     n = GET_MODE_BITSIZE (mode);
  
!   get_shift_alg (shift_type, shift_mode, n, &info);
!   
!   switch (info.alg)
!     {
!     case SHIFT_SPECIAL:
!       output_asm_insn (info.special, operands);
!       /* Fall through.  */
  
!     case SHIFT_INLINE:
!       n = info.remainder;
  
!       /* Emit two bit shifts first.  */
!       if (info.shift2 != NULL)
! 	{
! 	  for (; n > 1; n -= 2)
! 	    output_asm_insn (info.shift2, operands);
! 	}
  
!       /* Now emit one bit shifts for any residual.  */
!       for (; n > 0; n--)
! 	output_asm_insn (info.shift1, operands);
!       return "";
!       
!     case SHIFT_ROT_AND:
!       {
! 	int m = GET_MODE_BITSIZE (mode) - n;
! 	const int mask = (shift_type == SHIFT_ASHIFT
! 			  ? ((1 << m) - 1) << n
! 			  : (1 << m) - 1);
! 	char insn_buf[200];
! 
! 	/* Not all possibilities of rotate are supported.  They shouldn't
! 	   be generated, but let's watch for 'em.  */
! 	gcc_assert (info.shift1);
! 	
! 	/* Emit two bit rotates first.  */
! 	if (info.shift2 != NULL)
  	  {
! 	    for (; m > 1; m -= 2)
! 	      output_asm_insn (info.shift2, operands);
! 	  }
! 	
! 	/* Now single bit rotates for any residual.  */
! 	for (; m > 0; m--)
! 	  output_asm_insn (info.shift1, operands);
! 	
! 	/* Now mask off the high bits.  */
! 	switch (mode)
! 	  {
! 	  case QImode:
! 	    sprintf (insn_buf, "and\t#%d,%%X0", mask);
! 	    break;
  
! 	  case HImode:
! 	    gcc_assert (TARGET_H8300H || TARGET_H8300S);
! 	    sprintf (insn_buf, "and.w\t#%d,%%T0", mask);
! 	    break;
  
! 	  default:
! 	    gcc_unreachable ();
  	  }
  
! 	output_asm_insn (insn_buf, operands);
! 	return "";
!       }
  
!     case SHIFT_LOOP:
!       /* A loop to shift by a "large" constant value.
! 	 If we have shift-by-2 insns, use them.  */
!       if (info.shift2 != NULL)
! 	{
! 	  fprintf (asm_out_file, "\tmov.b	#%d,%sl\n", n / 2,
! 		   names_big[REGNO (operands[4])]);
! 	  fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
! 	  output_asm_insn (info.shift2, operands);
! 	  output_asm_insn ("add	#0xff,%X4", operands);
! 	  fprintf (asm_out_file, "\tbne	.Llt%d\n", loopend_lab);
! 	  if (n % 2)
! 	    output_asm_insn (info.shift1, operands);
! 	}
!       else
! 	{
! 	  fprintf (asm_out_file, "\tmov.b	#%d,%sl\n", n,
! 		   names_big[REGNO (operands[4])]);
! 	  fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
! 	  output_asm_insn (info.shift1, operands);
! 	  output_asm_insn ("add	#0xff,%X4", operands);
! 	  fprintf (asm_out_file, "\tbne	.Llt%d\n", loopend_lab);
  	}
+       return "";
+       
+     default:
+       gcc_unreachable ();
      }
  }
  
*************** compute_a_shift_length (rtx insn ATTRIBU
*** 4566,4572 ****
        shift_mode = SIshift;
        break;
      default:
!       abort ();
      }
  
    switch (code)
--- 4565,4571 ----
        shift_mode = SIshift;
        break;
      default:
!       gcc_unreachable ();
      }
  
    switch (code)
*************** compute_a_shift_length (rtx insn ATTRIBU
*** 4581,4587 ****
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       abort ();
      }
  
    if (GET_CODE (operands[2]) != CONST_INT)
--- 4580,4586 ----
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       gcc_unreachable ();
      }
  
    if (GET_CODE (operands[2]) != CONST_INT)
*************** compute_a_shift_length (rtx insn ATTRIBU
*** 4639,4646 ****
  
  	    /* Not all possibilities of rotate are supported.  They shouldn't
  	       be generated, but let's watch for 'em.  */
! 	    if (info.shift1 == 0)
! 	      abort ();
  
  	    if (info.shift2 != NULL)
  	      {
--- 4638,4644 ----
  
  	    /* Not all possibilities of rotate are supported.  They shouldn't
  	       be generated, but let's watch for 'em.  */
! 	    gcc_assert (info.shift1);
  
  	    if (info.shift2 != NULL)
  	      {
*************** compute_a_shift_length (rtx insn ATTRIBU
*** 4660,4671 ****
  		wlength += 2;
  		break;
  	      case SImode:
! 		if (TARGET_H8300)
! 		  abort ();
  		wlength += 3;
  		break;
  	      default:
! 		abort ();
  	      }
  	    return 2 * wlength;
  	  }
--- 4658,4668 ----
  		wlength += 2;
  		break;
  	      case SImode:
! 		gcc_assert (!TARGET_H8300);
  		wlength += 3;
  		break;
  	      default:
! 		gcc_unreachable ();
  	      }
  	    return 2 * wlength;
  	  }
*************** compute_a_shift_length (rtx insn ATTRIBU
*** 4686,4692 ****
  	  return 2 * wlength;
  
  	default:
! 	  abort ();
  	}
      }
  }
--- 4683,4689 ----
  	  return 2 * wlength;
  
  	default:
! 	  gcc_unreachable ();
  	}
      }
  }
*************** compute_a_shift_cc (rtx insn ATTRIBUTE_U
*** 4702,4708 ****
    enum shift_type shift_type;
    enum shift_mode shift_mode;
    struct shift_info info;
! 
    switch (mode)
      {
      case QImode:
--- 4699,4706 ----
    enum shift_type shift_type;
    enum shift_mode shift_mode;
    struct shift_info info;
!   int n;
!   
    switch (mode)
      {
      case QImode:
*************** compute_a_shift_cc (rtx insn ATTRIBUTE_U
*** 4715,4721 ****
        shift_mode = SIshift;
        break;
      default:
!       abort ();
      }
  
    switch (code)
--- 4713,4719 ----
        shift_mode = SIshift;
        break;
      default:
!       gcc_unreachable ();
      }
  
    switch (code)
*************** compute_a_shift_cc (rtx insn ATTRIBUTE_U
*** 4730,4787 ****
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       abort ();
      }
  
!   if (GET_CODE (operands[2]) != CONST_INT)
!     {
!       /* This case must be taken care of by one of the two splitters
! 	 that convert a variable shift into a loop.  */
!       abort ();
!     }
!   else
!     {
!       int n = INTVAL (operands[2]);
  
!       /* If the count is negative, make it 0.  */
!       if (n < 0)
! 	n = 0;
!       /* If the count is too big, truncate it.
!          ANSI says shifts of GET_MODE_BITSIZE are undefined - we choose to
! 	 do the intuitive thing.  */
!       else if ((unsigned int) n > GET_MODE_BITSIZE (mode))
! 	n = GET_MODE_BITSIZE (mode);
  
!       get_shift_alg (shift_type, shift_mode, n, &info);
  
!       switch (info.alg)
  	{
! 	case SHIFT_SPECIAL:
! 	  if (info.remainder == 0)
! 	    return info.cc_special;
! 
! 	  /* Fall through.  */
! 
! 	case SHIFT_INLINE:
! 	  return info.cc_inline;
! 
! 	case SHIFT_ROT_AND:
! 	  /* This case always ends with an and instruction.  */
! 	  return CC_SET_ZNV;
! 
! 	case SHIFT_LOOP:
! 	  /* A loop to shift by a "large" constant value.
! 	     If we have shift-by-2 insns, use them.  */
! 	  if (info.shift2 != NULL)
! 	    {
! 	      if (n % 2)
! 		return info.cc_inline;
! 	    }
! 	  return CC_CLOBBER;
! 
! 	default:
! 	  abort ();
  	}
      }
  }
  
--- 4728,4780 ----
        shift_type = SHIFT_ASHIFT;
        break;
      default:
!       gcc_unreachable ();
      }
  
!   /* This case must be taken care of by one of the two splitters
!      that convert a variable shift into a loop.  */
!   gcc_assert (GET_CODE (operands[2]) == CONST_INT);
!   
!   n = INTVAL (operands[2]);
  
!   /* If the count is negative, make it 0.  */
!   if (n < 0)
!     n = 0;
!   /* If the count is too big, truncate it.
!      ANSI says shifts of GET_MODE_BITSIZE are undefined - we choose to
!      do the intuitive thing.  */
!   else if ((unsigned int) n > GET_MODE_BITSIZE (mode))
!     n = GET_MODE_BITSIZE (mode);
!   
!   get_shift_alg (shift_type, shift_mode, n, &info);
!   
!   switch (info.alg)
!     {
!     case SHIFT_SPECIAL:
!       if (info.remainder == 0)
! 	return info.cc_special;
  
!       /* Fall through.  */
  
!     case SHIFT_INLINE:
!       return info.cc_inline;
!       
!     case SHIFT_ROT_AND:
!       /* This case always ends with an and instruction.  */
!       return CC_SET_ZNV;
!       
!     case SHIFT_LOOP:
!       /* A loop to shift by a "large" constant value.
! 	 If we have shift-by-2 insns, use them.  */
!       if (info.shift2 != NULL)
  	{
! 	  if (n % 2)
! 	    return info.cc_inline;
  	}
+       return CC_CLOBBER;
+       
+     default:
+       gcc_unreachable ();
      }
  }
  
*************** expand_a_rotate (rtx operands[])
*** 4833,4839 ****
  	  emit_insn (gen_rotlsi3_1 (dst, dst, const1_rtx));
  	  break;
  	default:
! 	  abort ();
  	}
  
        /* Decrement the counter by 1.  */
--- 4826,4832 ----
  	  emit_insn (gen_rotlsi3_1 (dst, dst, const1_rtx));
  	  break;
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Decrement the counter by 1.  */
*************** expand_a_rotate (rtx operands[])
*** 4861,4867 ****
  	  emit_insn (gen_rotlsi3_1 (dst, dst, rotate_amount));
  	  break;
  	default:
! 	  abort ();
  	}
      }
  
--- 4854,4860 ----
  	  emit_insn (gen_rotlsi3_1 (dst, dst, rotate_amount));
  	  break;
  	default:
! 	  gcc_unreachable ();
  	}
      }
  
*************** output_a_rotate (enum rtx_code code, rtx
*** 4882,4889 ****
    int amount;
    enum machine_mode mode = GET_MODE (dst);
  
!   if (GET_CODE (rotate_amount) != CONST_INT)
!     abort ();
  
    switch (mode)
      {
--- 4875,4881 ----
    int amount;
    enum machine_mode mode = GET_MODE (dst);
  
!   gcc_assert (GET_CODE (rotate_amount) == CONST_INT);
  
    switch (mode)
      {
*************** output_a_rotate (enum rtx_code code, rtx
*** 4897,4903 ****
        rotate_mode = SIshift;
        break;
      default:
!       abort ();
      }
  
    switch (code)
--- 4889,4895 ----
        rotate_mode = SIshift;
        break;
      default:
!       gcc_unreachable ();
      }
  
    switch (code)
*************** output_a_rotate (enum rtx_code code, rtx
*** 4909,4915 ****
        rotate_type = SHIFT_LSHIFTRT;
        break;
      default:
!       abort ();
      }
  
    amount = INTVAL (rotate_amount);
--- 4901,4907 ----
        rotate_type = SHIFT_LSHIFTRT;
        break;
      default:
!       gcc_unreachable ();
      }
  
    amount = INTVAL (rotate_amount);
*************** output_a_rotate (enum rtx_code code, rtx
*** 4953,4959 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        /* Adjust AMOUNT and flip the direction.  */
--- 4945,4951 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Adjust AMOUNT and flip the direction.  */
*************** compute_a_rotate_length (rtx *operands)
*** 4988,4995 ****
    int amount;
    unsigned int length = 0;
  
!   if (GET_CODE (amount_rtx) != CONST_INT)
!     abort ();
  
    amount = INTVAL (amount_rtx);
  
--- 4980,4986 ----
    int amount;
    unsigned int length = 0;
  
!   gcc_assert (GET_CODE (amount_rtx) == CONST_INT);
  
    amount = INTVAL (amount_rtx);
  
*************** fix_bit_operand (rtx *operands, enum rtx
*** 5083,5089 ****
  	emit_insn (gen_xorqi3_1 (res, operands[1], operands[2]));
  	break;
        default:
! 	abort ();
        }
      emit_insn (gen_movqi (operands[0], res));
    }
--- 5074,5080 ----
  	emit_insn (gen_xorqi3_1 (res, operands[1], operands[2]));
  	break;
        default:
! 	gcc_unreachable ();
        }
      emit_insn (gen_movqi (operands[0], res));
    }
*************** h8300_regs_ok_for_stm (int n, rtx operan
*** 5598,5606 ****
  	      && REGNO (operands[1]) == 1
  	      && REGNO (operands[2]) == 2
  	      && REGNO (operands[3]) == 3);
      }
- 
-   abort ();
  }
  
  /* Return nonzero if register OLD_REG can be renamed to register NEW_REG.  */
--- 5589,5597 ----
  	      && REGNO (operands[1]) == 1
  	      && REGNO (operands[2]) == 2
  	      && REGNO (operands[3]) == 3);
+     default:
+       gcc_unreachable ();
      }
  }
  
  /* Return nonzero if register OLD_REG can be renamed to register NEW_REG.  */
Index: config/h8300/h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.290
diff -c -3 -p -r1.290 h8300.md
*** config/h8300/h8300.md	18 Apr 2005 11:31:50 -0000	1.290
--- config/h8300/h8300.md	29 Apr 2005 14:11:05 -0000
***************
*** 423,429 ****
      case 5:
        return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";
      default:
!       abort ();
      }
  }"
    [(set (attr "length")
--- 423,429 ----
      case 5:
        return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";
      default:
!       gcc_unreachable ();
      }
  }"
    [(set (attr "length")
***************
*** 844,850 ****
      case 5:
        return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";
      default:
!       abort ();
      }
  }"
    [(set (attr "length")
--- 844,850 ----
      case 5:
        return \"mov.w	%T1,%e0\;mov.w	%T1,%f0\";
      default:
!       gcc_unreachable ();
      }
  }"
    [(set (attr "length")
***************
*** 2604,2610 ****
      return \"mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr\";
    else if (TARGET_H8300S)
      return \"stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
!     abort ();
  }"
    [(set_attr "length" "20")])
  
--- 2604,2610 ----
      return \"mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr\";
    else if (TARGET_H8300S)
      return \"stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
!   gcc_unreachable ();
  }"
    [(set_attr "length" "20")])
  

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