Patchwork [RX] Minor patches

login
register
mail settings
Submitter DJ Delorie
Date Sept. 17, 2010, 5:54 p.m.
Message ID <201009171754.o8HHs0oK019915@greed.delorie.com>
Download mbox | patch
Permalink /patch/65097/
State New
Headers show

Comments

DJ Delorie - Sept. 17, 2010, 5:54 p.m.
Committed.  Test case patch attached...

	* gcc.target/rx/setpsw.c: New.
	* gcc.target/rx/builtins.c (exchange): Remove
	(set_psw): New.
	(clear_psw): New.

Patch

Index: gcc.target/rx/setpsw.c
===================================================================
--- gcc.target/rx/setpsw.c	(revision 0)
+++ gcc.target/rx/setpsw.c	(revision 0)
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-options "-fno-ipa-cp-clone" } */
+
+set_psw_bad (int i)
+{
+  /* Thse are all invalid */
+  __builtin_rx_setpsw('X');	/* { dg-error "setpsw takes" "" } */
+				/* { dg-error "use __builtin" "" "target rx-*-elf" 0 } */
+  __builtin_rx_setpsw(-1);	/* { dg-error "setpsw takes" "" } */
+  __builtin_rx_setpsw(i);	/* { dg-error "setpsw takes" "" } */
+}
+
Index: gcc.target/rx/builtins.c
===================================================================
--- gcc.target/rx/builtins.c	(revision 164374)
+++ gcc.target/rx/builtins.c	(working copy)
@@ -29,19 +29,12 @@  int
 saturate_add (int arg1, int arg2)
 {
   arg1 += arg2;
   return __builtin_rx_sat (arg1);
 }
 
-int
-exchange (int arg1, int arg2)
-{
-  arg1 = __builtin_rx_xchg (arg2);
-  return arg1;
-}
-
 long
 multiply_and_accumulate (long arg1, long arg2, long arg3)
 {
   __builtin_rx_mvtaclo (0);
   __builtin_rx_mvtachi (0);
 
@@ -164,8 +157,56 @@  rmpa (int * multiplicand, int * multipli
   __builtin_rx_rmpa ();
 }
 
 void
 set_interrupts (void)
 {
-  __builtin_mvtipl (3);
+  __builtin_rx_mvtipl (3);
+}
+
+set_psw (int i)
+{
+  /* Thse are all valid */
+  __builtin_rx_setpsw('C');
+  __builtin_rx_setpsw('Z');
+  __builtin_rx_setpsw('S');
+  __builtin_rx_setpsw('O');
+  __builtin_rx_setpsw('I');
+  __builtin_rx_setpsw('U');
+  __builtin_rx_setpsw('c');
+  __builtin_rx_setpsw('z');
+  __builtin_rx_setpsw('s');
+  __builtin_rx_setpsw('o');
+  __builtin_rx_setpsw('i');
+  __builtin_rx_setpsw('u');
+  __builtin_rx_setpsw(0);
+  __builtin_rx_setpsw(1);
+  __builtin_rx_setpsw(2);
+  __builtin_rx_setpsw(3);
+  __builtin_rx_setpsw(8);
+  __builtin_rx_setpsw(9);
+  __builtin_rx_mvtc (0, i);
+}
+
+clear_psw (int i)
+{
+  /* Thse are all valid */
+  __builtin_rx_clrpsw('C');
+  __builtin_rx_clrpsw('Z');
+  __builtin_rx_clrpsw('S');
+  __builtin_rx_clrpsw('O');
+  __builtin_rx_clrpsw('I');
+  __builtin_rx_clrpsw('U');
+  __builtin_rx_clrpsw('c');
+  __builtin_rx_clrpsw('z');
+  __builtin_rx_clrpsw('s');
+  __builtin_rx_clrpsw('o');
+  __builtin_rx_clrpsw('i');
+  __builtin_rx_clrpsw('u');
+  __builtin_rx_clrpsw(0);
+  __builtin_rx_clrpsw(1);
+  __builtin_rx_clrpsw(2);
+  __builtin_rx_clrpsw(3);
+  __builtin_rx_clrpsw(8);
+  __builtin_rx_clrpsw(9);
+  __builtin_rx_mvtc (0, i);
 }