Cygwin: access: Fix X_OK behaviour for backup operators and admins
[newlib-cygwin.git] / newlib / libm / machine / amdgcn / v64df_asinh.c
blobadd4a486a658f7999de6edcda902ea3e81c84544
1 /*
2 * Copyright 2023 Siemens
4 * The authors hereby grant permission to use, copy, modify, distribute,
5 * and license this software and its documentation for any purpose, provided
6 * that existing copyright notices are retained in all copies and that this
7 * notice is included verbatim in any distributions. No written agreement,
8 * license, or royalty fee is required for any of the authorized uses.
9 * Modifications to this software may be copyrighted by their authors
10 * and need not follow the licensing terms described here, provided that
11 * the new terms are clearly indicated on the first page of each file where
12 * they apply.
16 * ====================================================
17 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
19 * Developed at SunPro, a Sun Microsystems, Inc. business.
20 * Permission to use, copy, modify, and distribute this
21 * software is freely granted, provided that this notice
22 * is preserved.
23 * ====================================================
26 /* Based on newlib/libm/mathfp/s_asinh.c in Newlib. */
28 #include "amdgcnmach.h"
30 v64df v64df_log_aux (v64df, v64di);
31 v64df v64df_log1p_aux (v64df, v64di);
32 v64df v64df_sqrt_aux (v64df, v64di);
34 #if defined (__has_builtin) && __has_builtin (__builtin_gcn_fabsv)
36 DEF_VD_MATH_FUNC (v64df, asinh, v64df x)
38 static const double one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
39 static const double ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
40 static const double huge = 1.00000000000000000000e+300;
42 FUNCTION_INIT (v64df);
44 v64df w;
45 v64si hx;
46 GET_HIGH_WORD (hx, x, NO_COND);
47 v64si ix = hx & 0x7fffffff;
49 VECTOR_IF (ix >=0x7ff00000, cond) /* x is inf or NaN */
50 VECTOR_RETURN (x + x, cond);
51 VECTOR_ENDIF
52 VECTOR_IF (ix < 0x3e300000, cond) /* |x|<2**-28 */
53 VECTOR_IF2 (__builtin_convertvector(huge+x > one, v64si), cond2, cond) /* return x inexact except 0 */
54 VECTOR_RETURN (x, cond);
55 VECTOR_ENDIF
56 VECTOR_ENDIF
57 VECTOR_IF (ix > 0x41b00000, cond) /* x > 2**28 */
58 VECTOR_COND_MOVE (w, v64df_log_aux (__builtin_gcn_fabsv (x), __mask) + ln2,
59 cond);
60 VECTOR_ELSEIF (ix > 0x40000000, cond) /* 2**28 > |x| > 2.0 */
61 v64df t = __builtin_gcn_fabsv (x);
62 VECTOR_COND_MOVE (w, v64df_log_aux (2.0 * t + one / (v64df_sqrt_aux (x*x + one, __mask) + t), __mask),
63 cond);
64 VECTOR_ELSE (cond) /* 2.0 > |x| > 2**-28 */
65 v64df t = x * x;
66 VECTOR_COND_MOVE (w, v64df_log1p_aux (__builtin_gcn_fabsv (x) + t / (one + v64df_sqrt_aux (one + t, __mask)), __mask),
67 cond);
68 VECTOR_ENDIF
70 VECTOR_IF (hx > 0, cond)
71 VECTOR_RETURN (w, cond);
72 VECTOR_ELSE (cond)
73 VECTOR_RETURN (-w, cond);
74 VECTOR_ENDIF
76 FUNCTION_RETURN;
79 DEF_VARIANTS (asinh, df, df)
81 #endif