fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / sys / sparc64 / ieee.c
blob28289761d3a339e2791a0db82fead50b2abb55e9
2 #include <ieeefp.h>
5 fp_rnd
6 _DEFUN_VOID(fpgetround)
8 char *out;
9 ieee_flags("get", "direction","", &out);
10 if (strcmp(out,"nearest") == 0) return FP_RN;
11 if (strcmp(out,"negative") == 0) return FP_RM;
12 if (strcmp(out,"positive") == 0) return FP_RP;
13 if (strcmp(out,"tozero") == 0) return FP_RZ;
14 abort();
18 fp_rnd
19 _DEFUN(fpsetround,(new),
20 fp_rnd new)
22 fp_rnd old = fpgetround();
23 char *dummy;
25 switch (new)
27 case FP_RN:
28 ieee_flags("set", "direction", "nearest", &dummy);
29 break;
30 case FP_RM:
31 ieee_flags("set", "direction", "negative", &dummy);
32 break;
33 case FP_RP:
34 ieee_flags("set", "direction", "positive", &dummy);
35 break;
36 case FP_RZ:
37 ieee_flags("set", "direction", "tozero", &dummy);
38 break;
39 default:
40 break;
42 return old;
46 fp_except
47 _DEFUN_VOID(fpgetmask)
49 char *out;
50 int r = 0;
52 int i = ieee_flags("get","exception","",&out);
53 if (i & 1) r |= FP_X_IMP;
54 if (i & 2) r |= FP_X_DX;
55 if (i & 4) r |= FP_X_UFL;
56 if (i & 8) r |= FP_X_OFL;
57 if (i & 16) r |= FP_X_INV;
58 return r;
62 fp_except
63 _DEFUN(fpsetmask,(mask),
64 fp_except mask)
66 fp_except old = fpgetmask();
68 char *out;
69 ieee_flags("clear","exception", "all", &out);
72 if (mask & FP_X_IMP)
73 ieee_flags("set","exception","inexact", &out);
74 if (mask & FP_X_DX)
75 ieee_flags("set","exception","division", &out);
76 if (mask & FP_X_UFL)
77 ieee_flags("set","exception","underflow", &out);
78 if (mask & FP_X_OFL)
79 ieee_flags("set","exception","overflow", &out);
80 if (mask & FP_X_INV)
81 ieee_flags("set","exception","invalid", &out);
83 return old;
87 fp_except
88 _DEFUN(fpsetsticky,(mask),
89 fp_except mask)
91 return fpsetmask(mask);
94 fp_except
95 _DEFUN_VOID(fpgetsticky)
97 return fpgetmask();
101 _DEFUN(fpsetroundtoi,(rdi_mode),
102 fp_rdi rdi_mode)
105 return 0;
109 int
110 _DEFUN_VOID(fpgetroundtoi)
113 return 0;