OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [config/] [frv/] [lib1funcs.asm] - Diff between revs 282 and 338

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

Rev 282 Rev 338
/* Library functions.
/* Library functions.
   Copyright (C) 2000, 2003, 2008, 2009 Free Software Foundation, Inc.
   Copyright (C) 2000, 2003, 2008, 2009 Free Software Foundation, Inc.
   Contributed by Red Hat, Inc.
   Contributed by Red Hat, Inc.
   This file is part of GCC.
   This file is part of GCC.
   GCC is free software ; you can redistribute it and/or modify
   GCC is free software ; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   the Free Software Foundation; either version 3, or (at your option)
   any later version.
   any later version.
   GCC is distributed in the hope that it will be useful,
   GCC is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY ; without even the implied warranty of
   but WITHOUT ANY WARRANTY ; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
   Under Section 7 of GPL version 3, you are granted additional
   Under Section 7 of GPL version 3, you are granted additional
   permissions described in the GCC Runtime Library Exception, version
   permissions described in the GCC Runtime Library Exception, version
   3.1, as published by the Free Software Foundation.
   3.1, as published by the Free Software Foundation.
   You should have received a copy of the GNU General Public License and
   You should have received a copy of the GNU General Public License and
   a copy of the GCC Runtime Library Exception along with this program;
   a copy of the GCC Runtime Library Exception along with this program;
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   .  */
   .  */
#include 
#include 


#ifdef L_cmpll
#ifdef L_cmpll
/* icc0 = __cmpll (long long a, long long b)  */
/* icc0 = __cmpll (long long a, long long b)  */
        .globl  EXT(__cmpll)
        .globl  EXT(__cmpll)
        .type   EXT(__cmpll),@function
        .type   EXT(__cmpll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__cmpll):
EXT(__cmpll):
        cmp     gr8, gr10, icc0
        cmp     gr8, gr10, icc0
        ckeq    icc0, cc4
        ckeq    icc0, cc4
        P(ccmp) gr9, gr11, cc4, 1
        P(ccmp) gr9, gr11, cc4, 1
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__cmpll),.Lend-EXT(__cmpll)
        .size   EXT(__cmpll),.Lend-EXT(__cmpll)
#endif /* L_cmpll */
#endif /* L_cmpll */


#ifdef L_cmpf
#ifdef L_cmpf
/* icc0 = __cmpf (float a, float b) */
/* icc0 = __cmpf (float a, float b) */
/* Note, because this function returns the result in ICC0, it means it can't
/* Note, because this function returns the result in ICC0, it means it can't
   handle NaNs.  */
   handle NaNs.  */
        .globl  EXT(__cmpf)
        .globl  EXT(__cmpf)
        .type   EXT(__cmpf),@function
        .type   EXT(__cmpf),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__cmpf):
EXT(__cmpf):
#ifdef __FRV_HARD_FLOAT__       /* floating point instructions available */
#ifdef __FRV_HARD_FLOAT__       /* floating point instructions available */
        movgf   gr8, fr0
        movgf   gr8, fr0
        P(movgf) gr9, fr1
        P(movgf) gr9, fr1
        setlos  #1, gr8
        setlos  #1, gr8
        fcmps   fr0, fr1, fcc0
        fcmps   fr0, fr1, fcc0
        P(fcklt) fcc0, cc0
        P(fcklt) fcc0, cc0
        fckeq   fcc0, cc1
        fckeq   fcc0, cc1
        csub    gr0, gr8, gr8, cc0, 1
        csub    gr0, gr8, gr8, cc0, 1
        cmov    gr0, gr8, cc1, 1
        cmov    gr0, gr8, cc1, 1
        cmpi    gr8, 0, icc0
        cmpi    gr8, 0, icc0
        ret
        ret
#else                           /* no floating point instructions available */
#else                           /* no floating point instructions available */
        movsg   lr, gr4
        movsg   lr, gr4
        addi    sp, #-16, sp
        addi    sp, #-16, sp
        sti     gr4, @(sp, 8)
        sti     gr4, @(sp, 8)
        st      fp, @(sp, gr0)
        st      fp, @(sp, gr0)
        mov     sp, fp
        mov     sp, fp
        call    EXT(__cmpsf2)
        call    EXT(__cmpsf2)
        cmpi    gr8, #0, icc0
        cmpi    gr8, #0, icc0
        ldi     @(sp, 8), gr4
        ldi     @(sp, 8), gr4
        movgs   gr4, lr
        movgs   gr4, lr
        ld      @(sp,gr0), fp
        ld      @(sp,gr0), fp
        addi    sp, #16, sp
        addi    sp, #16, sp
        ret
        ret
#endif
#endif
.Lend:
.Lend:
        .size   EXT(__cmpf),.Lend-EXT(__cmpf)
        .size   EXT(__cmpf),.Lend-EXT(__cmpf)
#endif
#endif


#ifdef L_cmpd
#ifdef L_cmpd
/* icc0 = __cmpd (double a, double b) */
/* icc0 = __cmpd (double a, double b) */
/* Note, because this function returns the result in ICC0, it means it can't
/* Note, because this function returns the result in ICC0, it means it can't
   handle NaNs.  */
   handle NaNs.  */
        .globl  EXT(__cmpd)
        .globl  EXT(__cmpd)
        .type   EXT(__cmpd),@function
        .type   EXT(__cmpd),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__cmpd):
EXT(__cmpd):
        movsg   lr, gr4
        movsg   lr, gr4
        addi    sp, #-16, sp
        addi    sp, #-16, sp
        sti     gr4, @(sp, 8)
        sti     gr4, @(sp, 8)
        st      fp, @(sp, gr0)
        st      fp, @(sp, gr0)
        mov     sp, fp
        mov     sp, fp
        call    EXT(__cmpdf2)
        call    EXT(__cmpdf2)
        cmpi    gr8, #0, icc0
        cmpi    gr8, #0, icc0
        ldi     @(sp, 8), gr4
        ldi     @(sp, 8), gr4
        movgs   gr4, lr
        movgs   gr4, lr
        ld      @(sp,gr0), fp
        ld      @(sp,gr0), fp
        addi    sp, #16, sp
        addi    sp, #16, sp
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__cmpd),.Lend-EXT(__cmpd)
        .size   EXT(__cmpd),.Lend-EXT(__cmpd)
#endif
#endif


#ifdef L_addll
#ifdef L_addll
/* gr8,gr9 = __addll (long long a, long long b) */
/* gr8,gr9 = __addll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__addll)
        .globl  EXT(__addll)
        .type   EXT(__addll),@function
        .type   EXT(__addll),@function
        .text
        .text
        .p2align
        .p2align
EXT(__addll):
EXT(__addll):
        addcc   gr9, gr11, gr9, icc0
        addcc   gr9, gr11, gr9, icc0
        addx    gr8, gr10, gr8, icc0
        addx    gr8, gr10, gr8, icc0
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__addll),.Lend-EXT(__addll)
        .size   EXT(__addll),.Lend-EXT(__addll)
#endif
#endif


#ifdef L_subll
#ifdef L_subll
/* gr8,gr9 = __subll (long long a, long long b) */
/* gr8,gr9 = __subll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__subll)
        .globl  EXT(__subll)
        .type   EXT(__subll),@function
        .type   EXT(__subll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__subll):
EXT(__subll):
        subcc   gr9, gr11, gr9, icc0
        subcc   gr9, gr11, gr9, icc0
        subx    gr8, gr10, gr8, icc0
        subx    gr8, gr10, gr8, icc0
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__subll),.Lend-EXT(__subll)
        .size   EXT(__subll),.Lend-EXT(__subll)
#endif
#endif


#ifdef L_andll
#ifdef L_andll
/* gr8,gr9 = __andll (long long a, long long b) */
/* gr8,gr9 = __andll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__andll)
        .globl  EXT(__andll)
        .type   EXT(__andll),@function
        .type   EXT(__andll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__andll):
EXT(__andll):
        P(and)  gr9, gr11, gr9
        P(and)  gr9, gr11, gr9
        P2(and) gr8, gr10, gr8
        P2(and) gr8, gr10, gr8
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__andll),.Lend-EXT(__andll)
        .size   EXT(__andll),.Lend-EXT(__andll)
#endif
#endif


#ifdef L_orll
#ifdef L_orll
/* gr8,gr9 = __orll (long long a, long long b) */
/* gr8,gr9 = __orll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__orll)
        .globl  EXT(__orll)
        .type   EXT(__orll),@function
        .type   EXT(__orll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__orll):
EXT(__orll):
        P(or)   gr9, gr11, gr9
        P(or)   gr9, gr11, gr9
        P2(or)  gr8, gr10, gr8
        P2(or)  gr8, gr10, gr8
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__orll),.Lend-EXT(__orll)
        .size   EXT(__orll),.Lend-EXT(__orll)
#endif
#endif


#ifdef L_xorll
#ifdef L_xorll
/* gr8,gr9 = __xorll (long long a, long long b) */
/* gr8,gr9 = __xorll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__xorll)
        .globl  EXT(__xorll)
        .type   EXT(__xorll),@function
        .type   EXT(__xorll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__xorll):
EXT(__xorll):
        P(xor)  gr9, gr11, gr9
        P(xor)  gr9, gr11, gr9
        P2(xor) gr8, gr10, gr8
        P2(xor) gr8, gr10, gr8
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__xorll),.Lend-EXT(__xorll)
        .size   EXT(__xorll),.Lend-EXT(__xorll)
#endif
#endif


#ifdef L_notll
#ifdef L_notll
/* gr8,gr9 = __notll (long long a) */
/* gr8,gr9 = __notll (long long a) */
/* Note, gcc will never call this function, but it is present in case an
/* Note, gcc will never call this function, but it is present in case an
   ABI program calls it.  */
   ABI program calls it.  */
        .globl  EXT(__notll)
        .globl  EXT(__notll)
        .type   EXT(__notll),@function
        .type   EXT(__notll),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__notll):
EXT(__notll):
        P(not)  gr9, gr9
        P(not)  gr9, gr9
        P2(not) gr8, gr8
        P2(not) gr8, gr8
        ret
        ret
.Lend:
.Lend:
        .size   EXT(__notll),.Lend-EXT(__notll)
        .size   EXT(__notll),.Lend-EXT(__notll)
#endif
#endif


#ifdef L_cmov
#ifdef L_cmov
/* (void) __cmov (char *dest, const char *src, size_t len) */
/* (void) __cmov (char *dest, const char *src, size_t len) */
/*
/*
 * void __cmov (char *dest, const char *src, size_t len)
 * void __cmov (char *dest, const char *src, size_t len)
 * {
 * {
 *   size_t i;
 *   size_t i;
 *
 *
 *   if (dest < src || dest > src+len)
 *   if (dest < src || dest > src+len)
 *     {
 *     {
 *       for (i = 0; i < len; i++)
 *       for (i = 0; i < len; i++)
 *       dest[i] = src[i];
 *       dest[i] = src[i];
 *     }
 *     }
 *   else
 *   else
 *     {
 *     {
 *       while (len-- > 0)
 *       while (len-- > 0)
 *       dest[len] = src[len];
 *       dest[len] = src[len];
 *     }
 *     }
 * }
 * }
 */
 */
        .globl  EXT(__cmov)
        .globl  EXT(__cmov)
        .type   EXT(__cmov),@function
        .type   EXT(__cmov),@function
        .text
        .text
        .p2align 4
        .p2align 4
EXT(__cmov):
EXT(__cmov):
        P(cmp)  gr8, gr9, icc0
        P(cmp)  gr8, gr9, icc0
        add     gr9, gr10, gr4
        add     gr9, gr10, gr4
        P(cmp)  gr8, gr4, icc1
        P(cmp)  gr8, gr4, icc1
        bc      icc0, 0, .Lfwd
        bc      icc0, 0, .Lfwd
        bls     icc1, 0, .Lback
        bls     icc1, 0, .Lback
.Lfwd:
.Lfwd:
        /* move bytes in a forward direction */
        /* move bytes in a forward direction */
        P(setlos) #0, gr5
        P(setlos) #0, gr5
        cmp     gr0, gr10, icc0
        cmp     gr0, gr10, icc0
        P(subi) gr9, #1, gr9
        P(subi) gr9, #1, gr9
        P2(subi) gr8, #1, gr8
        P2(subi) gr8, #1, gr8
        bnc     icc0, 0, .Lret
        bnc     icc0, 0, .Lret
.Lfloop:
.Lfloop:
        /* forward byte move loop */
        /* forward byte move loop */
        addi    gr5, #1, gr5
        addi    gr5, #1, gr5
        P(ldsb) @(gr9, gr5), gr4
        P(ldsb) @(gr9, gr5), gr4
        cmp     gr5, gr10, icc0
        cmp     gr5, gr10, icc0
        P(stb)  gr4, @(gr8, gr5)
        P(stb)  gr4, @(gr8, gr5)
        bc      icc0, 0, .Lfloop
        bc      icc0, 0, .Lfloop
        ret
        ret
.Lbloop:
.Lbloop:
        /* backward byte move loop body */
        /* backward byte move loop body */
        ldsb    @(gr9,gr10),gr4
        ldsb    @(gr9,gr10),gr4
        stb     gr4,@(gr8,gr10)
        stb     gr4,@(gr8,gr10)
.Lback:
.Lback:
        P(cmpi) gr10, #0, icc0
        P(cmpi) gr10, #0, icc0
        addi    gr10, #-1, gr10
        addi    gr10, #-1, gr10
        bne     icc0, 0, .Lbloop
        bne     icc0, 0, .Lbloop
.Lret:
.Lret:
        ret
        ret
.Lend:
.Lend:
        .size    EXT(__cmov),.Lend-EXT(__cmov)
        .size    EXT(__cmov),.Lend-EXT(__cmov)
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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