don't set errno or return an error when getspnam[_r] finds no entry
[musl] / src / fenv / sh / fenv.S
1 #if __SH_FPU_ANY__ || __SH4__
2
3 .global fegetround
4 .type   fegetround, @function
5 fegetround:
6         sts fpscr, r0
7         rts
8          and #3, r0
9
10 .global __fesetround
11 .hidden __fesetround
12 .type   __fesetround, @function
13 __fesetround:
14         sts fpscr, r0
15         or  r4, r0
16         lds r0, fpscr
17         rts
18          mov #0, r0
19
20 .global fetestexcept
21 .type   fetestexcept, @function
22 fetestexcept:
23         sts fpscr, r0
24         and r4, r0
25         rts
26          and #0x7c, r0
27
28 .global feclearexcept
29 .type   feclearexcept, @function
30 feclearexcept:
31         mov r4, r0
32         and #0x7c, r0
33         not r0, r4
34         sts fpscr, r0
35         and r4, r0
36         lds r0, fpscr
37         rts
38          mov #0, r0
39
40 .global feraiseexcept
41 .type   feraiseexcept, @function
42 feraiseexcept:
43         mov r4, r0
44         and #0x7c, r0
45         sts fpscr, r4
46         or  r4, r0
47         lds r0, fpscr
48         rts
49          mov #0, r0
50
51 .global fegetenv
52 .type   fegetenv, @function
53 fegetenv:
54         sts fpscr, r0
55         mov.l r0, @r4
56         rts
57          mov #0, r0
58
59 .global fesetenv
60 .type   fesetenv, @function
61 fesetenv:
62         mov r4, r0
63         cmp/eq #-1, r0
64         bf 1f
65
66         ! the default environment is complicated by the fact that we need to
67         ! preserve the current precision bit, which we do not know a priori
68         sts fpscr, r0
69         mov #8, r1
70         swap.w r1, r1
71         bra 2f
72          and r1, r0
73
74 1:      mov.l @r4, r0      ! non-default environment
75 2:      lds r0, fpscr
76         rts
77          mov #0, r0
78
79 #endif