changeset 18392:8f2f9412df5a

intprops: tune INT_NEGATE_OVERFLOW for GCC 5 and 6 * lib/intprops.h (INT_NEGATE_OVERFLOW): Tune for platforms like GCC 5 and 6 that have __builtin_sub_overflow but not __builtin_sub_overflow_p. With the recent changes, these platforms are a tiny bit faster with the INT_NEGATE_RANGE_OVERFLOW implementation than with INT_SUBTRACT_OVERFLOW implementation, since the former needs just one runtime comparison whereas the latter needs two.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 30 Aug 2016 12:29:21 -0700
parents e33d68885d8a
children 73762a329243
files ChangeLog lib/intprops.h
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 30 08:23:44 2016 -0700
+++ b/ChangeLog	Tue Aug 30 12:29:21 2016 -0700
@@ -1,5 +1,14 @@
 2016-08-30  Paul Eggert  <eggert@cs.ucla.edu>
 
+	intprops: tune INT_NEGATE_OVERFLOW for GCC 5 and 6
+	* lib/intprops.h (INT_NEGATE_OVERFLOW): Tune for platforms like
+	GCC 5 and 6 that have __builtin_sub_overflow but not
+	__builtin_sub_overflow_p.  With the recent changes, these
+	platforms are a tiny bit faster with the INT_NEGATE_RANGE_OVERFLOW
+	implementation than with INT_SUBTRACT_OVERFLOW implementation,
+	since the former needs just one runtime comparison whereas the
+	latter needs two.
+
 	strverscmp: sync with glibc
 	Although this doesn't exactly synchronize with glibc
 	byte-for-byte, it makes the code behave the same as glibc.
--- a/lib/intprops.h	Tue Aug 30 08:23:44 2016 -0700
+++ b/lib/intprops.h	Tue Aug 30 12:29:21 2016 -0700
@@ -330,7 +330,7 @@
   _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
 #define INT_SUBTRACT_OVERFLOW(a, b) \
   _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#if _GL_HAS_BUILTIN_OVERFLOW || _GL_HAS_BUILTIN_OVERFLOW_P
+#if _GL_HAS_BUILTIN_OVERFLOW_P
 # define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
 #else
 # define INT_NEGATE_OVERFLOW(a) \