[patch] Remove an unnecessary expander in the h8300 port

Kazu Hirata kazu@hxi.com
Tue Oct 17 18:15:00 GMT 2000


Hi Jeff,

> You might also look at the sign_extend expander since I believe it does
> basically the same thing.

I did the same for sign extention.  The same things happened.

Either the same number of insns with different temporary registers

-       mov.w        #.L59,r1
-       add.w  r2,r1
-       mov.w   r1,r2
+       mov.w        #.L59,r0
+       add.w  r2,r0
+       mov.w   r0,r2

or simply better without reg-to-reg move at the end.

-       mov.w   r2,r1
-       bld     #7,r1h
-       subx    r0l,r0l
-       subx    r0h,r0h
-       mov.w   r1,r3
-       mov.w   r0,r2
+       mov.w   r2,r3
+       bld     #7,r3h
+       subx    r2l,r2l
+       subx    r2h,r2h

Again, I replaced a space(s) with a tab after assembly insns.  I think
I fixed most of them, if not all.

OK to apply?

Thanks,

Kazu Hirata

===File ~/gnu/gcc/ChangeLog=================================
2000-10-17  Kazu Hirata  <kazu@hxi.com>

	* config/h8300/h8300.md: Remove an unnecessary sign_extend
	expander that is used when not optimizing.  Output a tab after
	each assembly insns.

============================================================

===File ~/gnu/gcc/h8300sext.patch===========================
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/h8300/h8300.md,v
retrieving revision 1.22
diff -u -r1.22 h8300.md
--- h8300.md	2000/10/17 20:17:35	1.22
+++ h8300.md	2000/10/18 01:06:09
@@ -623,7 +623,7 @@
    subs	%G2,%A0
    add.b	%s2,%s0\;addx	%t2,%t0
    add.w	%T2,%T0
-   mov.w        %T1,%T0\;add.w  %T2,%T0"
+   mov.w	%T1,%T0\;add.w	%T2,%T0"
   [(set_attr "length" "2,2,4,2,6")
    (set_attr "cc" "none_0hit,none_0hit,clobber,set_zn,set_zn")])
 
@@ -980,7 +980,7 @@
       return \"\";
     }
   if (TARGET_H8300H || TARGET_H8300S)
-    return \"and.w %T2,%T0\";
+    return \"and.w	%T2,%T0\";
   return \"and	%s2,%s0\;and	%t2,%t0;\";
 }"
   [(set_attr "length" "4")
@@ -1625,8 +1625,8 @@
 	(zero_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]
   "TARGET_H8300"
   "@
-  mov.b	#0,%x0\;sub.w %e0,%e0
-  mov.b	%R1,%w0\;mov.b	#0,%x0\;sub.w %e0,%e0"
+  mov.b	#0,%x0\;sub.w	%e0,%e0
+  mov.b	%R1,%w0\;mov.b	#0,%x0\;sub.w	%e0,%e0"
   [(set_attr "length" "4,6")
    (set_attr "cc" "clobber,clobber")])
 
@@ -1688,7 +1688,7 @@
   "TARGET_H8300"
   "@
   bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0
-  mov.b %R1,%w0\;bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0"
+  mov.b	%R1,%w0\;bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0"
   [(set_attr "length" "8,10")
    (set_attr "cc" "clobber,clobber")])
 
@@ -1696,24 +1696,6 @@
   [(set (match_operand:SI 0 "register_operand" "")
 	(sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
   ""
-  "
-{
-  if (TARGET_H8300
-      && GET_CODE (operands[1]) != CONST_INT
-      && !optimize)
-    {
-      emit_insn (gen_extendhisi2_h8300 (operands[0], operands[1]));
-      DONE;
-    }
-}")
-
-;; This is used when not optimizing.  It avoids severe code explosion
-;; due to poor register allocation.
-(define_expand "extendhisi2_h8300"
-  [(set (reg:HI 1) (match_operand:HI 1 "general_operand" ""))
-   (set (reg:SI 0) (sign_extend:SI (reg:HI 1)))
-   (set (match_operand:SI 0 "general_operand" "") (reg:SI 0))]
-  "TARGET_H8300"
   "")
 
 (define_insn ""
============================================================



More information about the Gcc-patches mailing list