int to float conversions

Andrey Petrov petrov@netbsd.org
Fri Feb 7 00:13:00 GMT 2003


While looking on how integers are converted to floats I noticed
that expand_float searches for insn starting with wider float-modes
first (inner loop) and then wider integer modes (outer loop).
It seems to me that it would be better to use reverse search.

Here is  a patch for 3.2 branch which I tried on sparcv9.
I havn't done full bootstrap or regression test yet, but would
like to hear opinions.

--
	Andrey Petrov

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.124.2.2.4.4
diff -u -p -r1.124.2.2.4.4 optabs.c
--- optabs.c    10 Jan 2003 13:36:19 -0000      1.124.2.2.4.4
+++ optabs.c    6 Feb 2003 23:53:38 -0000
@@ -4115,10 +4115,10 @@ expand_float (to, from, unsignedp)
      wider mode.  If the integer mode is wider than the mode of FROM,
      we can do the conversion signed even if the input is unsigned.  */
 
-  for (imode = GET_MODE (from); imode != VOIDmode;
-       imode = GET_MODE_WIDER_MODE (imode))
-    for (fmode = GET_MODE (to); fmode != VOIDmode;
-        fmode = GET_MODE_WIDER_MODE (fmode))
+  for (fmode = GET_MODE (to); fmode != VOIDmode;
+       fmode = GET_MODE_WIDER_MODE (fmode))
+    for (imode = GET_MODE (from); imode != VOIDmode;
+        imode = GET_MODE_WIDER_MODE (imode))
       {
        int doing_unsigned = unsignedp;
 



More information about the Gcc-patches mailing list