OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [i386/] [math-emu/] [round_Xsig.S] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
/*---------------------------------------------------------------------------+
/*---------------------------------------------------------------------------+
 |  round_Xsig.S                                                             |
 |  round_Xsig.S                                                             |
 |                                                                           |
 |                                                                           |
 | Copyright (C) 1992,1993,1994,1995                                         |
 | Copyright (C) 1992,1993,1994,1995                                         |
 |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
 |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
 |                       Australia.  E-mail billm@jacobi.maths.monash.edu.au |
 |                       Australia.  E-mail billm@jacobi.maths.monash.edu.au |
 |                                                                           |
 |                                                                           |
 | Normalize and round a 12 byte quantity.                                   |
 | Normalize and round a 12 byte quantity.                                   |
 | Call from C as:                                                           |
 | Call from C as:                                                           |
 |   int round_Xsig(Xsig *n)                                                 |
 |   int round_Xsig(Xsig *n)                                                 |
 |                                                                           |
 |                                                                           |
 | Normalize a 12 byte quantity.                                             |
 | Normalize a 12 byte quantity.                                             |
 | Call from C as:                                                           |
 | Call from C as:                                                           |
 |   int norm_Xsig(Xsig *n)                                                  |
 |   int norm_Xsig(Xsig *n)                                                  |
 |                                                                           |
 |                                                                           |
 | Each function returns the size of the shift (nr of bits).                 |
 | Each function returns the size of the shift (nr of bits).                 |
 |                                                                           |
 |                                                                           |
 +---------------------------------------------------------------------------*/
 +---------------------------------------------------------------------------*/
        .file   "round_Xsig.S"
        .file   "round_Xsig.S"
#include "fpu_emu.h"
#include "fpu_emu.h"
.text
.text
ENTRY(round_Xsig)
ENTRY(round_Xsig)
        pushl   %ebp
        pushl   %ebp
        movl    %esp,%ebp
        movl    %esp,%ebp
        pushl   %ebx            /* Reserve some space */
        pushl   %ebx            /* Reserve some space */
        pushl   %ebx
        pushl   %ebx
        pushl   %esi
        pushl   %esi
        movl    PARAM1,%esi
        movl    PARAM1,%esi
        movl    8(%esi),%edx
        movl    8(%esi),%edx
        movl    4(%esi),%ebx
        movl    4(%esi),%ebx
        movl    (%esi),%eax
        movl    (%esi),%eax
        movl    $0,-4(%ebp)
        movl    $0,-4(%ebp)
        orl     %edx,%edx       /* ms bits */
        orl     %edx,%edx       /* ms bits */
        js      L_round         /* Already normalized */
        js      L_round         /* Already normalized */
        jnz     L_shift_1       /* Shift left 1 - 31 bits */
        jnz     L_shift_1       /* Shift left 1 - 31 bits */
        movl    %ebx,%edx
        movl    %ebx,%edx
        movl    %eax,%ebx
        movl    %eax,%ebx
        xorl    %eax,%eax
        xorl    %eax,%eax
        movl    $-32,-4(%ebp)
        movl    $-32,-4(%ebp)
/* We need to shift left by 1 - 31 bits */
/* We need to shift left by 1 - 31 bits */
L_shift_1:
L_shift_1:
        bsrl    %edx,%ecx       /* get the required shift in %ecx */
        bsrl    %edx,%ecx       /* get the required shift in %ecx */
        subl    $31,%ecx
        subl    $31,%ecx
        negl    %ecx
        negl    %ecx
        subl    %ecx,-4(%ebp)
        subl    %ecx,-4(%ebp)
        shld    %cl,%ebx,%edx
        shld    %cl,%ebx,%edx
        shld    %cl,%eax,%ebx
        shld    %cl,%eax,%ebx
        shl     %cl,%eax
        shl     %cl,%eax
L_round:
L_round:
        testl   $0x80000000,%eax
        testl   $0x80000000,%eax
        jz      L_exit
        jz      L_exit
        addl    $1,%ebx
        addl    $1,%ebx
        adcl    $0,%edx
        adcl    $0,%edx
        jnz     L_exit
        jnz     L_exit
        movl    $0x80000000,%edx
        movl    $0x80000000,%edx
        incl    -4(%ebp)
        incl    -4(%ebp)
L_exit:
L_exit:
        movl    %edx,8(%esi)
        movl    %edx,8(%esi)
        movl    %ebx,4(%esi)
        movl    %ebx,4(%esi)
        movl    %eax,(%esi)
        movl    %eax,(%esi)
        movl    -4(%ebp),%eax
        movl    -4(%ebp),%eax
        popl    %esi
        popl    %esi
        popl    %ebx
        popl    %ebx
        leave
        leave
        ret
        ret
ENTRY(norm_Xsig)
ENTRY(norm_Xsig)
        pushl   %ebp
        pushl   %ebp
        movl    %esp,%ebp
        movl    %esp,%ebp
        pushl   %ebx            /* Reserve some space */
        pushl   %ebx            /* Reserve some space */
        pushl   %ebx
        pushl   %ebx
        pushl   %esi
        pushl   %esi
        movl    PARAM1,%esi
        movl    PARAM1,%esi
        movl    8(%esi),%edx
        movl    8(%esi),%edx
        movl    4(%esi),%ebx
        movl    4(%esi),%ebx
        movl    (%esi),%eax
        movl    (%esi),%eax
        movl    $0,-4(%ebp)
        movl    $0,-4(%ebp)
        orl     %edx,%edx       /* ms bits */
        orl     %edx,%edx       /* ms bits */
        js      L_n_exit                /* Already normalized */
        js      L_n_exit                /* Already normalized */
        jnz     L_n_shift_1     /* Shift left 1 - 31 bits */
        jnz     L_n_shift_1     /* Shift left 1 - 31 bits */
        movl    %ebx,%edx
        movl    %ebx,%edx
        movl    %eax,%ebx
        movl    %eax,%ebx
        xorl    %eax,%eax
        xorl    %eax,%eax
        movl    $-32,-4(%ebp)
        movl    $-32,-4(%ebp)
        orl     %edx,%edx       /* ms bits */
        orl     %edx,%edx       /* ms bits */
        js      L_n_exit        /* Normalized now */
        js      L_n_exit        /* Normalized now */
        jnz     L_n_shift_1     /* Shift left 1 - 31 bits */
        jnz     L_n_shift_1     /* Shift left 1 - 31 bits */
        movl    %ebx,%edx
        movl    %ebx,%edx
        movl    %eax,%ebx
        movl    %eax,%ebx
        xorl    %eax,%eax
        xorl    %eax,%eax
        addl    $-32,-4(%ebp)
        addl    $-32,-4(%ebp)
        jmp     L_n_exit        /* Might not be normalized,
        jmp     L_n_exit        /* Might not be normalized,
                                   but shift no more. */
                                   but shift no more. */
/* We need to shift left by 1 - 31 bits */
/* We need to shift left by 1 - 31 bits */
L_n_shift_1:
L_n_shift_1:
        bsrl    %edx,%ecx       /* get the required shift in %ecx */
        bsrl    %edx,%ecx       /* get the required shift in %ecx */
        subl    $31,%ecx
        subl    $31,%ecx
        negl    %ecx
        negl    %ecx
        subl    %ecx,-4(%ebp)
        subl    %ecx,-4(%ebp)
        shld    %cl,%ebx,%edx
        shld    %cl,%ebx,%edx
        shld    %cl,%eax,%ebx
        shld    %cl,%eax,%ebx
        shl     %cl,%eax
        shl     %cl,%eax
L_n_exit:
L_n_exit:
        movl    %edx,8(%esi)
        movl    %edx,8(%esi)
        movl    %ebx,4(%esi)
        movl    %ebx,4(%esi)
        movl    %eax,(%esi)
        movl    %eax,(%esi)
        movl    -4(%ebp),%eax
        movl    -4(%ebp),%eax
        popl    %esi
        popl    %esi
        popl    %ebx
        popl    %ebx
        leave
        leave
        ret
        ret
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.