add mips n32 port (ILP32 ABI for mips64)
[musl] / src / fenv / mipsn32 / fenv.S
1 #ifndef __mips_soft_float
2
3 .set    noreorder
4 .global feclearexcept
5 .type   feclearexcept,@function
6 feclearexcept:
7         and     $4, $4, 0x7c
8         cfc1    $5, $31
9         or      $5, $5, $4
10         xor     $5, $5, $4
11         ctc1    $5, $31
12         jr      $ra
13         li      $2, 0
14
15 .global feraiseexcept
16 .type  feraiseexcept,@function
17 feraiseexcept:
18         and     $4, $4, 0x7c
19         cfc1    $5, $31
20         or      $5, $5, $4
21         ctc1    $5, $31
22         jr      $ra
23         li      $2, 0
24
25 .global fetestexcept
26 .type  fetestexcept,@function
27 fetestexcept:
28         and     $4, $4, 0x7c
29         cfc1    $2, $31
30         jr      $ra
31         and     $2, $2, $4
32
33 .global fegetround
34 .type  fegetround,@function
35 fegetround:
36         cfc1    $2, $31
37         jr      $ra
38         andi    $2, $2, 3
39
40 .global __fesetround
41 .type __fesetround,@function
42 __fesetround:
43         cfc1    $5, $31
44         li      $6, -4
45         and     $5, $5, $6
46         or      $5, $5, $4
47         ctc1    $5, $31
48         jr      $ra
49         li      $2, 0
50
51 .global fegetenv
52 .type  fegetenv,@function
53 fegetenv:
54         cfc1    $5, $31
55         sw      $5, 0($4)
56         jr      $ra
57         li      $2, 0
58
59 .global fesetenv
60 .type  fesetenv,@function
61 fesetenv:
62         addiu   $5, $4, 1
63         beq     $5, $0, 1f
64         nop
65         lw      $5, 0($4)
66 1:      ctc1    $5, $31
67         jr      $ra
68         li      $2, 0
69
70 #endif