Skip to content

Commit a15e7f2

Browse files
committed
Added f32/f64 auto tests and fixed ldexpl and others in libc
1 parent 32a6bbd commit a15e7f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+21826
-169
lines changed

src/crt/float64_runtime.src

Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -151,133 +151,133 @@ __ulltod:
151151

152152
else
153153

154-
; wraps C functions
155-
156-
;-------------------------------------------------------------------------------
157-
158-
section .text
159-
public __dadd
160-
161-
__dadd:
162-
; f64_f64*_ret_f64
163-
push af, iy
164-
ld iy, 9
165-
add iy, sp
166-
push iy, bc, de, hl
167-
call __dadd_c
168-
pop af, af, af, af, iy, af
169-
ret
154+
; ; wraps C functions
155+
156+
; ;-------------------------------------------------------------------------------
157+
158+
; section .text
159+
; public __dadd
160+
161+
; __dadd:
162+
; ; f64_f64*_ret_f64
163+
; push af, iy
164+
; ld iy, 9
165+
; add iy, sp
166+
; push iy, bc, de, hl
167+
; call __dadd_c
168+
; pop af, af, af, af, iy, af
169+
; ret
170170

171-
extern __dadd_c
172-
173-
;-------------------------------------------------------------------------------
174-
175-
section .text
176-
public __dsub
177-
178-
__dsub:
179-
; f64_f64*_ret_f64
180-
push af, iy
181-
ld iy, 9
182-
add iy, sp
183-
push iy, bc, de, hl
184-
call __dsub_c
185-
pop af, af, af, af, iy, af
186-
ret
171+
; extern __dadd_c
172+
173+
; ;-------------------------------------------------------------------------------
174+
175+
; section .text
176+
; public __dsub
177+
178+
; __dsub:
179+
; ; f64_f64*_ret_f64
180+
; push af, iy
181+
; ld iy, 9
182+
; add iy, sp
183+
; push iy, bc, de, hl
184+
; call __dsub_c
185+
; pop af, af, af, af, iy, af
186+
; ret
187187

188-
extern __dsub_c
189-
190-
;-------------------------------------------------------------------------------
191-
192-
section .text
193-
public __dmul
194-
195-
__dmul:
196-
; f64_f64*_ret_f64
197-
push af, iy
198-
ld iy, 9
199-
add iy, sp
200-
push iy, bc, de, hl
201-
call __dmul_c
202-
pop af, af, af, af, iy, af
203-
ret
188+
; extern __dsub_c
189+
190+
; ;-------------------------------------------------------------------------------
191+
192+
; section .text
193+
; public __dmul
194+
195+
; __dmul:
196+
; ; f64_f64*_ret_f64
197+
; push af, iy
198+
; ld iy, 9
199+
; add iy, sp
200+
; push iy, bc, de, hl
201+
; call __dmul_c
202+
; pop af, af, af, af, iy, af
203+
; ret
204204

205-
extern __dmul_c
206-
207-
;-------------------------------------------------------------------------------
208-
209-
section .text
210-
public __ddiv
211-
212-
__ddiv:
213-
; f64_f64*_ret_f64
214-
push af, iy
215-
ld iy, 9
216-
add iy, sp
217-
push iy, bc, de, hl
218-
call __ddiv_c
219-
pop af, af, af, af, iy, af
220-
ret
205+
; extern __dmul_c
206+
207+
; ;-------------------------------------------------------------------------------
208+
209+
; section .text
210+
; public __ddiv
211+
212+
; __ddiv:
213+
; ; f64_f64*_ret_f64
214+
; push af, iy
215+
; ld iy, 9
216+
; add iy, sp
217+
; push iy, bc, de, hl
218+
; call __ddiv_c
219+
; pop af, af, af, af, iy, af
220+
; ret
221221

222-
extern __ddiv_c
222+
; extern __ddiv_c
223223

224-
;-------------------------------------------------------------------------------
224+
; ;-------------------------------------------------------------------------------
225225

226-
section .text
227-
public __drem
226+
; section .text
227+
; public __drem
228228

229-
__drem:
230-
; f64_f64*_ret_f64
231-
push af, iy
232-
ld iy, 9
233-
add iy, sp
234-
push iy, bc, de, hl
235-
call __drem_c
236-
pop af, af, af, af, iy, af
237-
ret
229+
; __drem:
230+
; ; f64_f64*_ret_f64
231+
; push af, iy
232+
; ld iy, 9
233+
; add iy, sp
234+
; push iy, bc, de, hl
235+
; call __drem_c
236+
; pop af, af, af, af, iy, af
237+
; ret
238238

239-
extern __drem_c
239+
; extern __drem_c
240240

241-
;-------------------------------------------------------------------------------
241+
; ;-------------------------------------------------------------------------------
242242

243-
section .text
244-
public __dtof
243+
; section .text
244+
; public __dtof
245245

246-
__dtof:
247-
; f64_ret_f32
248-
push af, iy, bc, de, hl
249-
call __dtof_c
250-
pop af, af, af, iy, af
251-
ret
246+
; __dtof:
247+
; ; f64_ret_f32
248+
; push af, iy, bc, de, hl
249+
; call __dtof_c
250+
; pop af, af, af, iy, af
251+
; ret
252252

253-
extern __dtof_c,
253+
; extern __dtof_c,
254254

255-
;-------------------------------------------------------------------------------
255+
; ;-------------------------------------------------------------------------------
256256

257-
section .text
258-
public __lltod
257+
; section .text
258+
; public __lltod
259259

260-
__lltod:
261-
; i64_ret_f64
262-
push af, iy, bc, de, hl
263-
call __lltod_c
264-
pop af, af, af, iy, af
265-
ret
260+
; __lltod:
261+
; ; i64_ret_f64
262+
; push af, iy, bc, de, hl
263+
; call __lltod_c
264+
; pop af, af, af, iy, af
265+
; ret
266266

267-
extern __lltod_c
267+
; extern __lltod_c
268268

269-
;-------------------------------------------------------------------------------
269+
; ;-------------------------------------------------------------------------------
270270

271-
section .text
272-
public __ulltod
271+
; section .text
272+
; public __ulltod
273273

274-
__ulltod:
275-
; u64_ret_f64
276-
push af, iy, bc, de, hl
277-
call __ulltod_c
278-
pop af, af, af, iy, af
279-
ret
274+
; __ulltod:
275+
; ; u64_ret_f64
276+
; push af, iy, bc, de, hl
277+
; call __ulltod_c
278+
; pop af, af, af, iy, af
279+
; ret
280280

281-
extern __ulltod_c
281+
; extern __ulltod_c
282282

283283
end if

src/libc/frexpl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,7 @@ long double _frexpl_c(long double x, int *expon) {
7878
#endif
7979
return val.flt;
8080
}
81+
82+
long double frexpl(long double x, int *expon) {
83+
return copysignl(_frexpl_c(fabsl(x), expon), x);
84+
}

src/libc/frexpl.src

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/libc/ldexpl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,7 @@ long double _ldexpl_c(long double x, int expon) {
120120
val.reg.BC += expon << (Float64_mantissa_bits - uint48_bits);
121121
return val.flt;
122122
}
123+
124+
long double ldexpl(long double x, int expon) {
125+
return copysignl(_ldexpl_c(fabsl(x), expon), x);
126+
}

src/libc/ldexpl.src

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/libc/modfl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ long double modfl(long double x, long double *integral_part) {
88
*integral_part = x;
99
return x;
1010
}
11-
case FP_INFINITY: {
11+
case FP_INFINITE: {
1212
*integral_part = x;
1313
return copysignl(0.0L, x);
1414
}
1515
case FP_SUBNORMAL:
1616
case FP_NORMAL:
17+
break;
1718
}
1819
long double trunc_x = truncl(x);
1920
*integral_part = trunc_x;

src/libc/truncl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef union F64_pun {
1717
#define uint48_bits 48
1818

1919
/** @note x is assumed to be positive */
20-
long double _truncl_c(long double x) {
20+
static long double _truncl_c(long double x) {
2121
F64_pun val;
2222
val.flt = x;
2323
unsigned int expon = (unsigned int)(val.reg.BC >> (Float64_mantissa_bits - uint48_bits));
@@ -34,3 +34,7 @@ long double _truncl_c(long double x) {
3434
val.bin &= mask;
3535
return val.flt;
3636
}
37+
38+
long double truncl(long double x) {
39+
return copysignl(_truncl_c(fabsl(x)), x);
40+
}

src/libc/truncl.src

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/softfloat/f64_mulAdd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434
3535
=============================================================================*/
3636

37+
#if 0
38+
3739
#include <stdint.h>
3840
#include "platform.h"
3941
#include "internals.h"
@@ -58,3 +60,4 @@ float64_t f64_mulAdd( float64_t a, float64_t b, float64_t c )
5860

5961
}
6062

63+
#endif

0 commit comments

Comments
 (0)