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]

expand_mult for partial_int modes?


Any reason why we don't use the shift/add optimization for partial_int
modes?  I can't think of a reason why we'd allow multiply without also
allowing shift and add, and I'd expect shift/add to be implemented
more often than a hardware multiply.

Only three ports use partial_int at the moment, and none of those
define anything other than "move" for them, so this can't be tested
but shouldn't be able to break anything either.  I've been using this
patch with an internal port and it works fine for me.

	* expmed.c (expand_mult): Convert partial_int multiplies to
	shift/add combinations too.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.228
diff -p -U3 -r1.228 expmed.c
--- expmed.c	27 Apr 2005 16:02:33 -0000	1.228
+++ expmed.c	28 May 2005 01:54:03 -0000
@@ -3030,7 +3030,8 @@ expand_mult (enum machine_mode mode, rtx
 
   /* These are the operations that are potentially turned into a sequence
      of shifts and additions.  */
-  if (GET_MODE_CLASS (mode) == MODE_INT
+  if ((GET_MODE_CLASS (mode) == MODE_INT
+       || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
       && (unsignedp || !flag_trapv))
     {
       HOST_WIDE_INT coeff = 0;


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