Cygwin: access: Fix X_OK behaviour for backup operators and admins
[newlib-cygwin.git] / newlib / libm / machine / amdgcn / v64sf_modf.c
blobd0d1dfe17622dfc7df0337f2e054f846df1d9951
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/common/sf_modf.c in Newlib. */
28 #include "amdgcnmach.h"
30 v64si v64sf_numtestf (v64sf);
32 DEF_VS_MATH_FUNC (v64sf, modff, v64sf x, v64sf *iptr)
34 FUNCTION_INIT (v64sf);
35 v64sf ret_i;
37 v64si i0;
38 GET_FLOAT_WORD (i0, x, NO_COND);
39 v64si j0 = ((i0 >> 23) & 0xff) - 0x7f; /* exponent of x */
40 v64sf zero;
41 SET_FLOAT_WORD (zero, i0 & 0x80000000,NO_COND);
43 VECTOR_IF (j0 < 23, cond) /* integer part in x*/
44 VECTOR_IF2 (j0 < 0, cond2, cond) /* |x|<1 */
45 VECTOR_COND_MOVE (ret_i, zero, cond2);
46 VECTOR_RETURN (x, cond2);
47 VECTOR_ELSE2 (cond2, cond)
48 v64si i = (0x007fffff) >> j0;
50 VECTOR_IF2 ((i0 & i) == 0, cond3, cond2) /* x is integral */
51 VECTOR_COND_MOVE (ret_i, x, cond3);
52 VECTOR_RETURN (zero, cond3);
53 VECTOR_ELSE2 (cond3, cond2)
54 SET_FLOAT_WORD (ret_i, i0 & ~i, cond3);
55 VECTOR_RETURN (x - ret_i, cond3);
56 VECTOR_ENDIF
57 VECTOR_ENDIF
58 VECTOR_ELSE (cond) /* no fraction part */
59 VECTOR_COND_MOVE (ret_i, x, cond);
60 VECTOR_IF2 (v64sf_numtestf (x) == NAN, cond2, cond)
61 VECTOR_COND_MOVE (ret_i, x + x, cond2);
62 VECTOR_RETURN (ret_i, cond2); /* x is NaN, return NaN */
63 VECTOR_ENDIF
64 VECTOR_RETURN (zero, cond); /* return +- 0 */
65 VECTOR_ENDIF
67 *iptr = ret_i;
68 FUNCTION_RETURN;