Added fef,fif and fixes

This commit is contained in:
ceriel 1991-09-25 09:17:14 +00:00
parent 7a725ce340
commit cb4e69cba9
4 changed files with 99 additions and 2 deletions

View file

@ -4,6 +4,8 @@ csb.s
dvu.s dvu.s
lar.s lar.s
muldiv.s muldiv.s
fif.s
fef.s
nop.s nop.s
shp.s shp.s
trp.s trp.s

27
mach/sparc/libem/fef.s Normal file
View file

@ -0,0 +1,27 @@
.global fef8, Fd0
fef8:
dec 4,%l0
ld [%l0+4], %f0
ld [%l0+8], %f1
set Fd0, %o0
ldd [%o0], %f8
fcmpd %f0, %f8
nop
fbne 1f
nop
st %g0,[%l0]
retl
nop
1: ld [%l0+4],%o0
srl %o0, 20, %o1
and %o1, 0x7ff, %o1
dec 0x3fe, %o1
st %o1,[%l0]
set 0x7ff00000, %o1
andn %o0, %o1, %o0
set 0x3fe00000, %o1
or %o0, %o1, %o0
st %o0,[%l0+4]
retl
nop

67
mach/sparc/libem/fif.s Normal file
View file

@ -0,0 +1,67 @@
.global fif8, Fd0, Fd1, Fd80000000, Fs80000000, Fs0
.align 8
Fd0:
.double 0r0
Fd1:
.double 0r1
FxE15:
.word 0x43300000, 0x0 ! magic const: (a.b + x) - x == a.0
Fd80000000:
.align 8
.double 0r4294967296
Fs80000000:
.single 0r2147483648
Fs0:
.single 0r0
fif8:
ld [%l0], %f0
ld [%l0+4], %f1
ld [%l0+8], %f2
ld [%l0+12], %f3
fmuld %f0, %f2, %f0
fmovs %f0, %f6
fmovs %f1, %f7
set Fd0, %o0
ldd [%o0], %f8
fcmpd %f0, %f8
nop
fbuge,a 1f
mov %g0, %o1
set 1, %o1
fnegs %f0, %f0
1:
set FxE15, %o0
ldd [%o0], %f10
fcmpd %f0, %f10
nop
fbuge 2f
nop
faddd %f0, %f10, %f4
fsubd %f4, %f10, %f4
fsubd %f0, %f4, %f2
set Fd1, %o0
ldd [%o0], %f12
4: fcmpd %f2, %f12
nop
fbge,a 4b
fsubd %f2, %f12, %f2
5: fcmpd %f2, %f8
nop
fbl,a 5b
faddd %f2, %f12, %f2
fsubd %f0, %f2, %f0
2:
tst %o1
bz 3f
nop
fnegs %f0, %f0
3:
fsubd %f6, %f0, %f2
st %f0, [%l0]
st %f1, [%l0+4]
st %f2, [%l0+8]
st %f3, [%l0+12]
retl
nop

View file

@ -10,11 +10,12 @@ trp:
retl retl
nop nop
2: 2:
set trppc, %o1 set trppc, %o2
ld [%o1], %o1 ld [%o2], %o1
tst %o1 tst %o1
bz 1f bz 1f
nop nop
st %g0,[%o2]
dec 4, %l0 dec 4, %l0
st %o0, [%l0] st %o0, [%l0]
jmp %o1 jmp %o1