Changeset 9b2729c in mainline


Ignore:
Timestamp:
2006-02-07T20:22:17Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b3eebb
Parents:
47c83bc
Message:

Fix number of steps in softint division.
Make ia64 port compile with softint.

Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • arch/ia64/Makefile.inc

    r47c83bc r9b2729c  
    5454CONFIG_ASID_FIFO = y
    5555
     56
     57## Compile with support for software integer division.
     58#
     59
     60CONFIG_SOFTINT = y
     61
    5662ARCH_SOURCES = \
    5763        arch/$(ARCH)/src/start.S \
  • genarch/Makefile.inc

    r47c83bc r9b2729c  
    5656                genarch/src/mm/asid_fifo.c
    5757endif
     58ifeq ($(CONFIG_SOFTINT),y)
     59        GENARCH_SOURCES += \
     60                genarch/src/softint/division.c
     61endif
  • genarch/include/softint/division.h

    r47c83bc r9b2729c  
    2727 */
    2828
    29 #ifndef __SOFTINT_H__
    30 #define __SOFTINT_H__
     29#ifndef __SOFTINT_DIVISION_H__
     30#define __SOFTINT_DIVISION_H__
    3131
    3232
  • genarch/src/softint/division.c

    r47c83bc r9b2729c  
    2727 */
    2828
    29 #include <softint/softint.h>
     29#include <genarch/softint/division.h>
    3030
    3131#define ABSVAL(x) ( (x) > 0 ? (x) : -(x))
     
    3535{
    3636        unsigned int result;
    37         int steps = sizeof(unsigned int);
     37        int steps = sizeof(unsigned int) * 8;
    3838       
    3939        *remainder = 0;
     
    5252        for ( ; steps > 0; steps--) {
    5353                /* shift one bit to remainder */
    54                 *remainder = ( (*remainder) << 1) | (( divident >> 31) & 0x1);
     54                *remainder = ( (*remainder) << 1) | (( a >> 31) & 0x1);
    5555                result <<= 1;
    5656               
     
    5959                                result |= 0x1;
    6060                }
    61                 divident <<= 1;
     61                a <<= 1;
    6262        }
    6363
     
    6969{
    7070        unsigned long result;
    71         int steps = sizeof(unsigned long);
     71        int steps = sizeof(unsigned long) * 8;
    7272       
    7373        *remainder = 0;
     
    8686        for ( ; steps > 0; steps--) {
    8787                /* shift one bit to remainder */
    88                 *remainder = ( (*remainder) << 1) | (( divident >> 63) & 0x1);
     88                *remainder = ( (*remainder) << 1) | ((a >> 63) & 0x1);
    8989                result <<= 1;
    9090               
     
    9393                                result |= 0x1;
    9494                }
    95                 divident <<= 1;
     95                a <<= 1;
    9696        }
    9797
     
    143143        divandmod32(a, b, &rem);
    144144       
    145         /* if divident is negative, remainder must be too*/
     145        /* if divident is negative, remainder must be too */
    146146        if (!(SGN(a))) {
    147147                return -((int)rem);
     
    157157        divandmod64(a, b, &rem);
    158158       
    159         /* if divident is negative, remainder must be too*/
     159        /* if divident is negative, remainder must be too */
    160160        if (!(SGN(a))) {
    161161                return -((long)rem);
Note: See TracChangeset for help on using the changeset viewer.