(root)/
glibc-2.38/
sysdeps/
s390/
fpu/
math_private.h
       1  /* Configure optimized libm functions.  S390 version.
       2     Copyright (C) 2019-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       5     The GNU C Library is free software; you can redistribute it and/or
       6     modify it under the terms of the GNU Lesser General Public
       7     License as published by the Free Software Foundation; either
       8     version 2.1 of the License, or (at your option) any later version.
       9  
      10     The GNU C Library is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13     Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public
      16     License along with the GNU C Library; if not, see
      17     <https://www.gnu.org/licenses/>.  */
      18  
      19  #ifndef S390_MATH_PRIVATE_H
      20  #define S390_MATH_PRIVATE_H 1
      21  
      22  #include <stdint.h>
      23  #include <math.h>
      24  
      25  #ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
      26  # define TOINT_INTRINSICS 1
      27  
      28  static inline double_t
      29  roundtoint (double_t x)
      30  {
      31    double_t y;
      32    /* The z196 zarch "load fp integer" (fidbra) instruction is rounding
      33       x to the nearest integer with ties away from zero (M3-field: 1)
      34       where inexact exceptions are suppressed (M4-field: 4).  */
      35    __asm__ ("fidbra %0,1,%1,4" : "=f" (y) : "f" (x));
      36    return y;
      37  }
      38  
      39  static inline int32_t
      40  converttoint (double_t x)
      41  {
      42    int32_t y;
      43    /* The z196 zarch "convert to fixed" (cfdbra) instruction is rounding
      44       x to the nearest integer with ties away from zero (M3-field: 1)
      45       where inexact exceptions are suppressed (M4-field: 4).  */
      46    __asm__ ("cfdbra %0,1,%1,4" : "=d" (y) : "f" (x) : "cc");
      47    return y;
      48  }
      49  #endif
      50  
      51  #include_next <math_private.h>
      52  
      53  #endif