diff --git a/mach/sparc/libem/LIST b/mach/sparc/libem/LIST index 114e753a3..f956f612e 100644 --- a/mach/sparc/libem/LIST +++ b/mach/sparc/libem/LIST @@ -4,6 +4,8 @@ csb.s dvu.s lar.s muldiv.s +fif.s +fef.s nop.s shp.s trp.s diff --git a/mach/sparc/libem/fef.s b/mach/sparc/libem/fef.s new file mode 100644 index 000000000..382b5379f --- /dev/null +++ b/mach/sparc/libem/fef.s @@ -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 diff --git a/mach/sparc/libem/fif.s b/mach/sparc/libem/fif.s new file mode 100644 index 000000000..cdc6791ee --- /dev/null +++ b/mach/sparc/libem/fif.s @@ -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 diff --git a/mach/sparc/libem/trp.s b/mach/sparc/libem/trp.s index 87fb48cd7..3953d4d99 100644 --- a/mach/sparc/libem/trp.s +++ b/mach/sparc/libem/trp.s @@ -10,11 +10,12 @@ trp: retl nop 2: - set trppc, %o1 - ld [%o1], %o1 + set trppc, %o2 + ld [%o2], %o1 tst %o1 bz 1f nop + st %g0,[%o2] dec 4, %l0 st %o0, [%l0] jmp %o1