about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/s_lrintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_lrintf.c')
-rw-r--r--sysdeps/ieee754/flt-32/s_lrintf.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c
index 7438b272b2..50d044dd8d 100644
--- a/sysdeps/ieee754/flt-32/s_lrintf.c
+++ b/sysdeps/ieee754/flt-32/s_lrintf.c
@@ -25,17 +25,22 @@
 #include <math_private.h>
 #include <libm-alias-float.h>
 #include <fix-fp-int-convert-overflow.h>
-
-static const float two23[2] =
-{
-  8.3886080000e+06, /* 0x4B000000 */
- -8.3886080000e+06, /* 0xCB000000 */
-};
+#include <math-use-builtins.h>
 
 
 long int
 __lrintf (float x)
 {
+#if USE_LRINTF_BUILTIN
+  return __builtin_lrintf (x);
+#else
+  /* Use generic implementation.  */
+  static const float two23[2] =
+  {
+    8.3886080000e+06, /* 0x4B000000 */
+   -8.3886080000e+06, /* 0xCB000000 */
+  };
+
   int32_t j0;
   uint32_t i0;
   float w;
@@ -82,6 +87,7 @@ __lrintf (float x)
     }
 
   return sx ? -result : result;
+#endif /* ! USE_LRINTF_BUILTIN  */
 }
 
 libm_alias_float (__lrint, lrint)