1 .global fegetround
2 .type fegetround,%function
3 fegetround:
4 	mrs x0, fpcr
5 	and w0, w0, #0xc00000
6 	ret
7 
8 .global __fesetround
9 .hidden __fesetround
10 .type __fesetround,%function
11 __fesetround:
12 	mrs x1, fpcr
13 	bic w1, w1, #0xc00000
14 	orr w1, w1, w0
15 	msr fpcr, x1
16 	mov w0, #0
17 	ret
18 
19 .global fetestexcept
20 .type fetestexcept,%function
21 fetestexcept:
22 	and w0, w0, #0x1f
23 	mrs x1, fpsr
24 	and w0, w0, w1
25 	ret
26 
27 .global feclearexcept
28 .type feclearexcept,%function
29 feclearexcept:
30 	and w0, w0, #0x1f
31 	mrs x1, fpsr
32 	bic w1, w1, w0
33 	msr fpsr, x1
34 	mov w0, #0
35 	ret
36 
37 .global feraiseexcept
38 .type feraiseexcept,%function
39 feraiseexcept:
40 	and w0, w0, #0x1f
41 	mrs x1, fpsr
42 	orr w1, w1, w0
43 	msr fpsr, x1
44 	mov w0, #0
45 	ret
46 
47 .global fegetenv
48 .type fegetenv,%function
49 fegetenv:
50 	mrs x1, fpcr
51 	mrs x2, fpsr
52 	stp w1, w2, [x0]
53 	mov w0, #0
54 	ret
55 
56 // TODO preserve some bits
57 .global fesetenv
58 .type fesetenv,%function
59 fesetenv:
60 	mov x1, #0
61 	mov x2, #0
62 	cmn x0, #1
63 	b.eq 1f
64 	ldp w1, w2, [x0]
65 1:	msr fpcr, x1
66 	msr fpsr, x2
67 	mov w0, #0
68 	ret
69