Blame sysdeps/s390/fpu/s_llroundf.c

Packit Service 730d83
/* llroundf() - S390 version.
Packit Service 730d83
   Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service 730d83
Packit Service 730d83
   This file is part of the GNU C Library.
Packit Service 730d83
Packit Service 730d83
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 730d83
   modify it under the terms of the GNU Lesser General Public License as
Packit Service 730d83
   published by the Free Software Foundation; either version 2.1 of the
Packit Service 730d83
   License, or (at your option) any later version.
Packit Service 730d83
Packit Service 730d83
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 730d83
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 730d83
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 730d83
   Lesser General Public License for more details.
Packit Service 730d83
Packit Service 730d83
   You should have received a copy of the GNU Lesser General Public
Packit Service 730d83
   License along with the GNU C Library; if not, see
Packit Service 730d83
   <https://www.gnu.org/licenses/>.  */
Packit Service 730d83
Packit Service 730d83
#if defined __s390x__ && defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
Packit Service 730d83
/* We only support s390x as on s390 a long long int refers to a register pair
Packit Service 730d83
   of two 4byte registers instead of a 8byte register which is produced by the
Packit Service 730d83
   instruction.
Packit Service 730d83
   Note: On s390 this instruction would only be used if build with -mzarch.  */
Packit Service 730d83
# include <math.h>
Packit Service 730d83
# include <libm-alias-float.h>
Packit Service 730d83
Packit Service 730d83
long long int
Packit Service 730d83
__llroundf (float x)
Packit Service 730d83
{
Packit Service 730d83
  long long int y;
Packit Service 730d83
  /* The z196 zarch "convert to fixed" (cgebra) instruction is rounding
Packit Service 730d83
     x to the nearest integer with "ties away from 0" rounding mode
Packit Service 730d83
     (M3-field: 1) where inexact exceptions are suppressed (M4-field: 4).  */
Packit Service 730d83
  __asm__ ("cgebra %0,1,%1,4" : "=d" (y) : "f" (x) : "cc");
Packit Service 730d83
  return y;
Packit Service 730d83
}
Packit Service 730d83
libm_alias_float (__llround, llround)
Packit Service 730d83
Packit Service 730d83
#else
Packit Service 730d83
# include <sysdeps/ieee754/flt-32/s_llroundf.c>
Packit Service 730d83
#endif