Go to the documentation of this file.
9 #ifndef __DC_FMATH_BASE_H
10 #define __DC_FMATH_BASE_H
12 #include <sys/cdefs.h>
23 #define F_PI 3.1415926f
27 ({ float __value, __arg = (x), __scale = 10430.37835; \
28 __asm__("fmul %2,%1\n\t" \
32 : "=f" (__value), "+&f" (__scale) \
34 : "fpul", "fr0", "fr1"); \
38 ({ float __value, __arg = (x), __scale = 10430.37835; \
39 __asm__("fmul %2,%1\n\t" \
43 : "=f" (__value), "+&f" (__scale) \
45 : "fpul", "fr0", "fr1"); \
49 ({ float __value, __arg = (x), __scale = 10430.37835; \
50 __asm__("fmul %2,%1\n\t" \
55 : "=f" (__value), "+&f" (__scale) \
57 : "fpul", "fr0", "fr1"); \
62 ({ float __value, __arg = (x); \
63 __asm__("lds %1,fpul\n\t" \
68 : "fpul", "fr0", "fr1"); \
72 ({ float __value, __arg = (x); \
73 __asm__("lds %1,fpul\n\t" \
78 : "fpul", "fr0", "fr1"); \
82 ({ float __value, __arg = (x); \
83 __asm__("lds %1,fpul\n\t" \
89 : "fpul", "fr0", "fr1"); \
92 #define __fsincos(r, s, c) \
93 ({ register float __r __asm__("fr10") = r; \
94 register float __a __asm__("fr11") = 182.04444443; \
95 __asm__("fmul fr11, fr10\n\t" \
96 "ftrc fr10, fpul\n\t" \
97 "fsca fpul, dr10\n\t" \
98 : "+f" (__r), "+f" (__a) \
99 : "0" (__r), "1" (__a) \
103 #define __fsincosr(r, s, c) \
104 ({ register float __r __asm__("fr10") = r; \
105 register float __a __asm__("fr11") = 10430.37835; \
106 __asm__("fmul fr11, fr10\n\t" \
107 "ftrc fr10, fpul\n\t" \
108 "fsca fpul, dr10\n\t" \
109 : "+f" (__r), "+f" (__a) \
110 : "0" (__r), "1" (__a) \
115 ({ float __arg = (x); \
116 __asm__("fsqrt %0\n\t" \
117 : "=f" (__arg) : "0" (__arg)); \
120 #define __frsqrt(x) \
121 ({ float __arg = (x); \
122 __asm__("fsrra %0\n\t" \
123 : "=f" (__arg) : "0" (__arg)); \
127 #define __fipr(x, y, z, w, a, b, c, d) ({ \
128 register float __x __asm__("fr0") = (x); \
129 register float __y __asm__("fr1") = (y); \
130 register float __z __asm__("fr2") = (z); \
131 register float __w __asm__("fr3") = (w); \
132 register float __a __asm__("fr4") = (a); \
133 register float __b __asm__("fr5") = (b); \
134 register float __c __asm__("fr6") = (c); \
135 register float __d __asm__("fr7") = (d); \
136 __asm__ __volatile__( \
139 : "f" (__x), "f" (__y), "f" (__z), "f" (__w), \
140 "f" (__a), "f" (__b), "f" (__c), "f" (__d) \
145 #define __fipr_magnitude_sqr(x, y, z, w) ({ \
146 register float __x __asm__("fr4") = (x); \
147 register float __y __asm__("fr5") = (y); \
148 register float __z __asm__("fr6") = (z); \
149 register float __w __asm__("fr7") = (w); \
150 __asm__ __volatile__( \
153 : "f" (__x), "f" (__y), "f" (__z), "f" (__w) \