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]

RFA: (partially) fix PR middle-end/29846


This patch makes can_compare_p acknowledge the existance of a cbranch<MODE>4 handler,
without being confused by a compare pattern. In principle, it would make sense to also
do a similar change for cmov_optab / cstore_optab, but we should first make sure that we
can actually do something useful with these optabs first.


I have tested this patch on i686-pc-linux-gnu with a native bootstrap, and also as
part of the patch for PR29845 on i686-pc-linux-gnu X sh-elf.


:ADDPATCH middle-end:
2006-11-15  J"orn Rennecke  <joern.rennecke@st.com>

	PR middle-end/29846
	* optabs.c (can_compare_p): Succeed if a cbranch handler exists,
	irrespective of the existance of a compare instruction.

Index: optabs.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L optabs.c	(revision 118652) -L optabs.c	(working copy) .svn/text-base/optabs.c.svn-base optabs.c
--- optabs.c	(revision 118652)
+++ optabs.c	(working copy)
@@ -3584,6 +3584,9 @@ can_compare_p (enum rtx_code code, enum 
 {
   do
     {
+      if (purpose == ccp_jump
+	  && cbranch_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
+	return 1;
       if (cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
 	{
 	  if (purpose == ccp_jump)
@@ -3594,9 +3597,6 @@ can_compare_p (enum rtx_code code, enum 
 	    /* There's only one cmov entry point, and it's allowed to fail.  */
 	    return 1;
 	}
-      if (purpose == ccp_jump
-	  && cbranch_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
-	return 1;
       if (purpose == ccp_cmov
 	  && cmov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
 	return 1;

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