Blame sysdeps/s390/fpu/s_roundeven.c

Packit Service 39c6bd
/* roundeven() - S390 version.
Packit Service 39c6bd
   Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service 39c6bd
Packit Service 39c6bd
   This file is part of the GNU C Library.
Packit Service 39c6bd
Packit Service 39c6bd
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 39c6bd
   modify it under the terms of the GNU Lesser General Public License as
Packit Service 39c6bd
   published by the Free Software Foundation; either version 2.1 of the
Packit Service 39c6bd
   License, or (at your option) any later version.
Packit Service 39c6bd
Packit Service 39c6bd
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 39c6bd
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 39c6bd
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 39c6bd
   Lesser General Public License for more details.
Packit Service 39c6bd
Packit Service 39c6bd
   You should have received a copy of the GNU Lesser General Public
Packit Service 39c6bd
   License along with the GNU C Library; if not, see
Packit Service 39c6bd
   <https://www.gnu.org/licenses/>.  */
Packit Service 39c6bd
Packit Service 39c6bd
#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
Packit Service 39c6bd
# include <math.h>
Packit Service 39c6bd
# include <libm-alias-double.h>
Packit Service 39c6bd
Packit Service 39c6bd
double
Packit Service 39c6bd
__roundeven (double x)
Packit Service 39c6bd
{
Packit Service 39c6bd
  double y;
Packit Service 39c6bd
  /* The z196 zarch "load fp integer" (fidbra) instruction is rounding
Packit Service 39c6bd
     x to the nearest integer with "ties to even" rounding mode
Packit Service 39c6bd
     (M3-field: 4) where inexact exceptions are suppressed (M4-field: 4).  */
Packit Service 39c6bd
  __asm__ ("fidbra %0,4,%1,4" : "=f" (y) : "f" (x));
Packit Service 39c6bd
  return y;
Packit Service 39c6bd
}
Packit Service 39c6bd
hidden_def (__roundeven)
Packit Service 39c6bd
libm_alias_double (__roundeven, roundeven)
Packit Service 39c6bd
Packit Service 39c6bd
#else
Packit Service 39c6bd
# include <sysdeps/ieee754/dbl-64/s_roundeven.c>
Packit Service 39c6bd
#endif