Hi,
while looking on profiles of firefox linktime I noticed that HWI abs functions
are implemented offline that slows down the normalize function.
Those are always win when implemented inline.

Bootstrapped/regtested x86_64-linux, comitted as obvious.

        * hwint.c (abs_hwi, absu_hwi): Move to ...
        * hwint.h (abs_hwi, absu_hwi): ... here; make inline.
Index: hwint.c
===================================================================
--- hwint.c     (revision 218730)
+++ hwint.c     (working copy)
@@ -124,22 +124,6 @@ popcount_hwi (unsigned HOST_WIDE_INT x)
 
 #endif /* GCC_VERSION < 3004 */
 
-/* Compute the absolute value of X.  */
-
-HOST_WIDE_INT
-abs_hwi (HOST_WIDE_INT x)
-{
-  gcc_checking_assert (x != HOST_WIDE_INT_MIN);
-  return x >= 0 ? x : -x;
-}
-
-/* Compute the absolute value of X as an unsigned type.  */
-
-unsigned HOST_WIDE_INT
-absu_hwi (HOST_WIDE_INT x)
-{
-  return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
-}
 
 /* Compute the greatest common divisor of two numbers A and B using
    Euclid's algorithm.  */
Index: hwint.h
===================================================================
--- hwint.h     (revision 218730)
+++ hwint.h     (working copy)
@@ -264,4 +264,21 @@ zext_hwi (unsigned HOST_WIDE_INT src, un
     }
 }
 
+/* Compute the absolute value of X.  */
+
+inline HOST_WIDE_INT
+abs_hwi (HOST_WIDE_INT x)
+{
+  gcc_checking_assert (x != HOST_WIDE_INT_MIN);
+  return x >= 0 ? x : -x;
+}
+
+/* Compute the absolute value of X as an unsigned type.  */
+
+inline unsigned HOST_WIDE_INT
+absu_hwi (HOST_WIDE_INT x)
+{
+  return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
+}
+
 #endif /* ! GCC_HWINT_H */

Reply via email to