Patchwork [RX] Minor patches

login
register
mail settings
Submitter DJ Delorie
Date Aug. 25, 2010, 2:31 a.m.
Message ID <201008250231.o7P2VmpU006677@greed.delorie.com>
Download mbox | patch
Permalink /patch/62649/
State New
Headers show

Comments

DJ Delorie - Aug. 25, 2010, 2:31 a.m.
A few minor patches to fix a few code problems...  Ok?

	* config/rx/rx.c (rx_print_operand): If __builtin_rx_setpsw() is
	passed an invalid value, print an error instead of ICEing.
	(rx_expand_prologue): Don't adjust the frame size when we push the
	accumulator.
	(rx_expand_builtin_mvtipl): Pass an integer to IN_RANGE, not an
	RTX.
Richard Henderson - Aug. 25, 2010, 4:45 p.m.
On 08/24/2010 07:31 PM, DJ Delorie wrote:
> @@ -440,13 +440,14 @@ rx_print_operand (FILE * file, rtx op, i
>  	case 1:	case 'z': case 'Z': fprintf (file, "Z"); break;
>  	case 2: case 's': case 'S': fprintf (file, "S"); break;
>  	case 3: case 'o': case 'O': fprintf (file, "O"); break;
>  	case 8: case 'i': case 'I': fprintf (file, "I"); break;
>  	case 9: case 'u': case 'U': fprintf (file, "U"); break;
>  	default:
> -	  gcc_unreachable ();
> +	  error ("__builtin_rx_setpsw takes 'C', 'Z', 'S', 'O', 'I', or 'U'");
> +	  return;

output_operand_lossage here.


r~
DJ Delorie - Aug. 27, 2010, 12:30 a.m.
> output_operand_lossage here.

This is reporting a user error.  output_operand_lossage() causes an ICE.
Richard Henderson - Aug. 27, 2010, 3:18 p.m.
On 08/26/2010 05:30 PM, DJ Delorie wrote:
>> output_operand_lossage here.
> 
> This is reporting a user error.  output_operand_lossage() causes an ICE.

Well, output_operand_lossage reports user errors in asms, and
ICEs for normal insns.  If this is a normal insn, then you 
should have diagnosed the user error earlier.


r~
DJ Delorie - Aug. 27, 2010, 6:45 p.m.
> Well, output_operand_lossage reports user errors in asms, and
> ICEs for normal insns.  If this is a normal insn, then you 
> should have diagnosed the user error earlier.

It's a builtin : __builtin_rx_mvtipl() but the %F is only used for
that one opcode.

Should the user-level error() be moved to rx_expand_builtin_mvtipl()
instead?
Richard Henderson - Aug. 27, 2010, 7:49 p.m.
On 08/27/2010 11:45 AM, DJ Delorie wrote:
> Should the user-level error() be moved to rx_expand_builtin_mvtipl()
> instead?

Yes please.


r~

Patch

Index: config/rx/rx.c
===================================================================
--- config/rx/rx.c	(revision 163536)
+++ config/rx/rx.c	(working copy)
@@ -440,13 +440,14 @@  rx_print_operand (FILE * file, rtx op, i
 	case 1:	case 'z': case 'Z': fprintf (file, "Z"); break;
 	case 2: case 's': case 'S': fprintf (file, "S"); break;
 	case 3: case 'o': case 'O': fprintf (file, "O"); break;
 	case 8: case 'i': case 'I': fprintf (file, "I"); break;
 	case 9: case 'u': case 'U': fprintf (file, "U"); break;
 	default:
-	  gcc_unreachable ();
+	  error ("__builtin_rx_setpsw takes 'C', 'Z', 'S', 'O', 'I', or 'U'");
+	  return;
 	}
       break;
 
     case 'H':
       switch (GET_CODE (op))
 	{
@@ -1297,14 +1298,12 @@  rx_expand_prologue (void)
 
 	  emit_insn (gen_mvfacmi (gen_rtx_REG (SImode, acc_low)));
 	  emit_insn (gen_mvfachi (gen_rtx_REG (SImode, acc_high)));
 	  emit_insn (gen_stack_pushm (GEN_INT (2 * UNITS_PER_WORD),
 				      gen_rx_store_vector (acc_low, acc_high)));
 	}
-
-      frame_size += 2 * UNITS_PER_WORD;
     }
 
   /* If needed, set up the frame pointer.  */
   if (frame_pointer_needed)
     {
       if (frame_size)
@@ -1893,13 +1892,13 @@  static rtx
 rx_expand_builtin_mvtipl (rtx arg)
 {
   /* The RX610 does not support the MVTIPL instruction.  */
   if (rx_cpu_type == RX610)
     return NULL_RTX;
 
-  if (! CONST_INT_P (arg) || ! IN_RANGE (arg, 0, (1 << 4) - 1))
+  if (! CONST_INT_P (arg) || ! IN_RANGE (INTVAL (arg), 0, (1 << 4) - 1))
     return NULL_RTX;
 
   emit_insn (gen_mvtipl (arg));
 
   return NULL_RTX;
 }