remove obsolete and unused gethostbyaddr implementation
[musl] / src / fenv / powerpc / fenv.S
1 #ifndef _SOFT_FLOAT
2 .global feclearexcept
3 .type feclearexcept,@function
4 feclearexcept:
5         andis. 3,3,0x3e00
6         /* if (r3 & FE_INVALID) r3 |= all_invalid_flags */
7         andis. 0,3,0x2000
8         stwu 1,-16(1)
9         beq- 0,1f
10         oris 3,3,0x01f8
11         ori  3,3,0x0700
12 1:
13         /*
14          * note: fpscr contains various fpu status and control
15          * flags and we dont check if r3 may alter other flags
16          * than the exception related ones
17          * ufpscr &= ~r3
18          */
19         mffs 0
20         stfd 0,8(1)
21         lwz 9,12(1)
22         andc 9,9,3
23         stw 9,12(1)
24         lfd 0,8(1)
25         mtfsf 255,0
26
27         /* return 0 */
28         li 3,0
29         addi 1,1,16
30         blr
31
32 .global feraiseexcept
33 .type feraiseexcept,@function
34 feraiseexcept:
35         andis. 3,3,0x3e00
36         /* if (r3 & FE_INVALID) r3 |= software_invalid_flag */
37         andis. 0,3,0x2000
38         stwu 1,-16(1)
39         beq- 0,1f
40         ori 3,3,0x0400
41 1:
42         /* fpscr |= r3 */
43         mffs 0
44         stfd 0,8(1)
45         lwz 9,12(1)
46         or 9,9,3
47         stw 9,12(1)
48         lfd 0,8(1)
49         mtfsf 255,0
50
51         /* return 0 */
52         li 3,0
53         addi 1,1,16
54         blr
55
56 .global fetestexcept
57 .type fetestexcept,@function
58 fetestexcept:
59         andis. 3,3,0x3e00
60         /* return r3 & fpscr */
61         stwu 1,-16(1)
62         mffs 0
63         stfd 0,8(1)
64         lwz 9,12(1)
65         addi 1,1,16
66         and 3,3,9
67         blr
68
69 .global fegetround
70 .type fegetround,@function
71 fegetround:
72         /* return fpscr & 3 */
73         stwu 1,-16(1)
74         mffs 0
75         stfd 0,8(1)
76         lwz 3,12(1)
77         addi 1,1,16
78         clrlwi 3,3,30
79         blr
80
81 .global __fesetround
82 .type __fesetround,@function
83 __fesetround:
84         /*
85          * note: invalid input is not checked, r3 < 4 must hold
86          * fpscr = (fpscr & -4U) | r3
87          */
88         stwu 1,-16(1)
89         mffs 0
90         stfd 0,8(1)
91         lwz 9,12(1)
92         clrrwi 9,9,2
93         or 9,9,3
94         stw 9,12(1)
95         lfd 0,8(1)
96         mtfsf 255,0
97
98         /* return 0 */
99         li 3,0
100         addi 1,1,16
101         blr
102
103 .global fegetenv
104 .type fegetenv,@function
105 fegetenv:
106         /* *r3 = fpscr */
107         mffs 0
108         stfd 0,0(3)
109         /* return 0 */
110         li 3,0
111         blr
112
113 .global fesetenv
114 .type fesetenv,@function
115 fesetenv:
116         cmpwi 3, -1
117         bne 1f
118         mflr 4
119         bl 2f
120         .zero 8
121 2:      mflr 3
122         mtlr 4
123 1:      /* fpscr = *r3 */
124         lfd 0,0(3)
125         mtfsf 255,0
126         /* return 0 */
127         li 3,0
128         blr
129 #endif