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]

[3.3 patch] h8300 : Backport normal mode stuff.


Hi,

Attached is a patch to bring H8/300H's normal mode support in gcc-3.3
up to date.

First, the existing implementation cannot be tested on the simulator
because of the wrong architecture directive.

The patch also backports PR target/13122, which has already been
applied to 3.4.

Tested on h8300 port.  Committed.

Kazu Hirata

2003-12-15  Kazu Hirata  <kazu@cs.umass.edu>

	PR target/13122
	* config/h8300/h8300.md (pushqi1_h8300hs_normal): New.
	(pushqi1): Call gen_pushqi1_h8300hs_normal in normal mode.
	(pushhi1_h8300hs_normal): New.
	(pushhi1): Call gen_pushqi1_h8300hs_normal in normal mode.

	* config/h8300/h8300.h (LINK_SPEC): Support normal mode.
	* config/h8300/h8300.c (asm_file_start): Correctly output
	an architecture directive.
	* config/h8300/lib1funcs.asm: Correctly specify an
	architecture directive.

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.174.2.4
diff -u -p -r1.174.2.4 h8300.c
--- h8300.c	28 Mar 2003 15:21:01 -0000	1.174.2.4
+++ h8300.c	15 Dec 2003 20:12:10 -0000
@@ -757,9 +757,9 @@ asm_file_start (file)
   else if (optimize)
     fprintf (file, "; -O%d\n", optimize);
   if (TARGET_H8300H)
-    fprintf (file, "\n\t.h8300h\n");
+    fprintf (file, TARGET_NORMAL_MODE ? "\n\t.h8300hn\n" : "\n\t.h8300h\n");
   else if (TARGET_H8300S)
-    fprintf (file, "\n\t.h8300s\n");
+    fprintf (file, TARGET_NORMAL_MODE ? "\n\t.h8300sn\n" : "\n\t.h8300s\n");
   else
     fprintf (file, "\n\n");
   output_file_directive (file, main_input_filename);
Index: h8300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.h,v
retrieving revision 1.123.2.1
diff -u -p -r1.123.2.1 h8300.h
--- h8300.h	26 Dec 2002 21:00:15 -0000	1.123.2.1
+++ h8300.h	15 Dec 2003 20:12:11 -0000
@@ -70,7 +70,7 @@ extern const char * const *h8_reg_names;
     }							\
   while (0)
 
-#define LINK_SPEC "%{mh:-m h8300h} %{ms:-m h8300s}"
+#define LINK_SPEC "%{mh:%{mn:-m h8300hn}} %{mh:%{!mn:-m h8300h}} %{ms:%{mn:-m h8300sn}} %{ms:%{!mn:-m h8300s}}"
 
 #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
 
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.123.2.6
diff -u -p -r1.123.2.6 h8300.md
--- h8300.md	21 Aug 2003 13:08:48 -0000	1.123.2.6
+++ h8300.md	15 Dec 2003 20:12:12 -0000
@@ -134,6 +134,17 @@
   [(set_attr "length" "4")
    (set_attr "cc" "clobber")])
 
+(define_insn "pushqi1_h8300hs_normal"
+  [(parallel [(set (reg:HI SP_REG)
+		   (plus:HI (reg:HI SP_REG) (const_int -4)))
+	      (set (mem:QI (plus:HI (reg:HI SP_REG) (const_int -3)))
+		   (match_operand:QI 0 "register_operand" "r"))])]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && operands[0] != stack_pointer_rtx"
+  "mov.l\\t%S0,@-er7"
+  [(set_attr "length" "4")
+   (set_attr "cc" "clobber")])
+
 (define_expand "pushqi1"
   [(use (match_operand:QI 0 "register_operand" ""))]
   ""
@@ -141,8 +152,10 @@
 {
   if (TARGET_H8300)
     emit_insn (gen_pushqi1_h8300 (operands[0]));
-  else
+  else if (!TARGET_NORMAL_MODE)
     emit_insn (gen_pushqi1_h8300hs (operands[0]));
+  else
+    emit_insn (gen_pushqi1_h8300hs_normal (operands[0]));
   DONE;
 }")
 
@@ -226,6 +239,17 @@
   [(set_attr "length" "4")
    (set_attr "cc" "clobber")])
 
+(define_insn "pushhi1_h8300hs_normal"
+  [(parallel [(set (reg:HI SP_REG)
+		   (plus:HI (reg:HI SP_REG) (const_int -4)))
+	      (set (mem:HI (plus:HI (reg:HI SP_REG) (const_int -2)))
+		   (match_operand:HI 0 "register_operand" "r"))])]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && operands[0] != stack_pointer_rtx"
+  "mov.l\\t%S0,@-er7"
+  [(set_attr "length" "4")
+   (set_attr "cc" "clobber")])
+
 (define_expand "pushhi1"
   [(use (match_operand:HI 0 "register_operand" ""))]
   ""
@@ -233,8 +257,10 @@
 {
   if (TARGET_H8300)
     emit_insn (gen_pushhi1_h8300 (operands[0]));
-  else
+  else if (!TARGET_NORMAL_MODE)
     emit_insn (gen_pushhi1_h8300hs (operands[0]));
+  else
+    emit_insn (gen_pushhi1_h8300hs_normal (operands[0]));
   DONE;
 }")
 
Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/lib1funcs.asm,v
retrieving revision 1.16
diff -u -p -r1.16 lib1funcs.asm
--- lib1funcs.asm	2 Nov 2002 12:51:05 -0000	1.16
+++ lib1funcs.asm	15 Dec 2003 20:12:12 -0000
@@ -96,11 +96,19 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #ifdef __H8300H__
+#ifdef __NORMAL_MODE__
+	.h8300hn
+#else
 	.h8300h
 #endif
+#endif
 
 #ifdef __H8300S__
+#ifdef __NORMAL_MODE__
+	.h8300sn
+#else
 	.h8300s
+#endif
 #endif
 
 #ifdef L_cmpsi2


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