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]

Re: PATCH RFA: Use clz for MIPS ffs


Richard Henderson <rth@redhat.com> writes:

> On Tue, Jul 12, 2005 at 06:39:18PM -0700, Ian Lance Taylor wrote:
> > +  emit_insn (gen_clz<mode>2 (r3, r2));
> > +  emit_move_insn (r4, GEN_INT (GET_MODE_BITSIZE (<MODE>mode)));
> > +  emit_insn (gen_sub<mode>3 (operands[0], r4, r3));
> 
> The mips port needs to define CLZ_DEFINED_VALUE_AT_ZERO before
> you won't get into trouble with this.

Right.  Well, until we get the other stuff sorted out, I tested this
patch with a MIPS simulator using -mips32.  OK for mainline?

Ian


2005-07-13  Ian Lance Taylor  <ian@airs.com>

	* config/mips/mips.h (CLZ_DEFINED_VALUE_AT_ZERO): Define.


Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.398
diff -p -u -r1.398 mips.h
--- config/mips/mips.h	25 Jun 2005 01:21:46 -0000	1.398
+++ config/mips/mips.h	13 Jul 2005 23:48:51 -0000
@@ -1130,6 +1130,11 @@ extern const struct mips_rtx_cost_data *
 
 /* Define if loading short immediate values into registers sign extends.  */
 #define SHORT_IMMEDIATES_SIGN_EXTEND
+
+/* The [d]clz instructions have the natural values at 0.  */
+
+#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
+  ((VALUE) = GET_MODE_BITSIZE (MODE), true)
 
 /* Standard register usage.  */
 


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