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]

Re: SH: cmpeqdi splitter messes up the CFG


On Aug 29, 2000, Jeffrey A Law <law@cygnus.com> wrote:

> I'd recommend against using gas specific extensions like the
> forward/backward labels.  Just cons up a label in the output
> pattern.  I believe there's predefined output modifiers to do this.

Here's a revised patch that uses an even simpler strategy to skip an
instruction, that avoids the need to construct a label.  Ok to
install?

Maybe there should also be define_splits for these insns, that would
actually create a conditional jump and a code label, for optimizing
builds?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/sh/sh.md (cmpeqsi_ior_t, cmpeqsi_and_t): New insns.
	(cmpeqdi_t splitter): Use cmpeqsi_and_t instead of emitting jumps
	and labels.

Index: gcc/config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.md,v
retrieving revision 1.40
diff -u -p -r1.40 sh.md
--- gcc/config/sh/sh.md	2000/08/22 19:39:56	1.40
+++ gcc/config/sh/sh.md	2000/08/30 18:32:58
@@ -558,6 +558,30 @@
 	cmp/eq	%1,%0
 	cmp/eq	%1,%0")
 
+(define_insn "cmpeqsi_ior_t"
+  [(set (reg:SI 18)
+	(ior:SI (reg:SI 18)
+		(eq:SI (match_operand:SI 0 "arith_reg_operand" "r,z,r")
+		       (match_operand:SI 1 "arith_operand" "N,rI,r"))))]
+  ""
+  "@
+	bt .+4\;tst	%0,%0
+	bt .+4\;cmp/eq	%1,%0
+	bt .+4\;cmp/eq	%1,%0"
+  [(set_attr "length" "4")])
+
+(define_insn "cmpeqsi_and_t"
+  [(set (reg:SI 18)
+	(and:SI (reg:SI 18)
+		(eq:SI (match_operand:SI 0 "arith_reg_operand" "r,z,r")
+		       (match_operand:SI 1 "arith_operand" "N,rI,r"))))]
+  ""
+  "@
+	bf .+4\;tst	%0,%0
+	bf .+4\;cmp/eq	%1,%0
+	bf .+4\;cmp/eq	%1,%0"
+  [(set_attr "length" "4")])
+
 (define_insn "cmpgtsi_t"
   [(set (reg:SI 18) (gt:SI (match_operand:SI 0 "arith_reg_operand" "r,r")
 			   (match_operand:SI 1 "arith_reg_or_0_operand" "r,N")))]
@@ -636,11 +660,9 @@
 			   (match_operand:DI 1 "arith_reg_or_0_operand" "N,r")))]
   "reload_completed"
   [(set (reg:SI 18) (eq:SI (match_dup 2) (match_dup 3)))
-   (set (pc) (if_then_else (eq (reg:SI 18) (const_int 0))
-			   (label_ref (match_dup 6))
-			   (pc)))
-   (set (reg:SI 18) (eq:SI (match_dup 4) (match_dup 5)))
-   (match_dup 6)]
+   (set (reg:SI 18)
+	(and:SI (reg:SI 18)
+		(eq:SI (match_dup 4) (match_dup 5))))]
   "
 {
   operands[2]
@@ -654,7 +676,6 @@
 		      + (TARGET_LITTLE_ENDIAN ? 1 : 0)));
   operands[4] = gen_lowpart (SImode, operands[0]);
   operands[5] = gen_lowpart (SImode, operands[1]);
-  operands[6] = gen_label_rtx ();
 }")
 
 (define_insn "cmpgtdi_t"

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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