URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [frv/] [lib1funcs.asm] - Rev 282
Compare with Previous | Blame | View Log
/* Library functions.Copyright (C) 2000, 2003, 2008, 2009 Free Software Foundation, Inc.Contributed by Red Hat, Inc.This file is part of GCC.GCC is free software ; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 3, or (at your option)any later version.GCC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY ; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.Under Section 7 of GPL version 3, you are granted additionalpermissions described in the GCC Runtime Library Exception, version3.1, as published by the Free Software Foundation.You should have received a copy of the GNU General Public License anda copy of the GCC Runtime Library Exception along with this program;see the files COPYING3 and COPYING.RUNTIME respectively. If not, see<http://www.gnu.org/licenses/>. */#include <frv-asm.h>#ifdef L_cmpll/* icc0 = __cmpll (long long a, long long b) */.globl EXT(__cmpll).type EXT(__cmpll),@function.text.p2align 4EXT(__cmpll):cmp gr8, gr10, icc0ckeq icc0, cc4P(ccmp) gr9, gr11, cc4, 1ret.Lend:.size EXT(__cmpll),.Lend-EXT(__cmpll)#endif /* L_cmpll */#ifdef L_cmpf/* icc0 = __cmpf (float a, float b) *//* Note, because this function returns the result in ICC0, it means it can'thandle NaNs. */.globl EXT(__cmpf).type EXT(__cmpf),@function.text.p2align 4EXT(__cmpf):#ifdef __FRV_HARD_FLOAT__ /* floating point instructions available */movgf gr8, fr0P(movgf) gr9, fr1setlos #1, gr8fcmps fr0, fr1, fcc0P(fcklt) fcc0, cc0fckeq fcc0, cc1csub gr0, gr8, gr8, cc0, 1cmov gr0, gr8, cc1, 1cmpi gr8, 0, icc0ret#else /* no floating point instructions available */movsg lr, gr4addi sp, #-16, spsti gr4, @(sp, 8)st fp, @(sp, gr0)mov sp, fpcall EXT(__cmpsf2)cmpi gr8, #0, icc0ldi @(sp, 8), gr4movgs gr4, lrld @(sp,gr0), fpaddi sp, #16, spret#endif.Lend:.size EXT(__cmpf),.Lend-EXT(__cmpf)#endif#ifdef L_cmpd/* icc0 = __cmpd (double a, double b) *//* Note, because this function returns the result in ICC0, it means it can'thandle NaNs. */.globl EXT(__cmpd).type EXT(__cmpd),@function.text.p2align 4EXT(__cmpd):movsg lr, gr4addi sp, #-16, spsti gr4, @(sp, 8)st fp, @(sp, gr0)mov sp, fpcall EXT(__cmpdf2)cmpi gr8, #0, icc0ldi @(sp, 8), gr4movgs gr4, lrld @(sp,gr0), fpaddi sp, #16, spret.Lend:.size EXT(__cmpd),.Lend-EXT(__cmpd)#endif#ifdef L_addll/* gr8,gr9 = __addll (long long a, long long b) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__addll).type EXT(__addll),@function.text.p2alignEXT(__addll):addcc gr9, gr11, gr9, icc0addx gr8, gr10, gr8, icc0ret.Lend:.size EXT(__addll),.Lend-EXT(__addll)#endif#ifdef L_subll/* gr8,gr9 = __subll (long long a, long long b) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__subll).type EXT(__subll),@function.text.p2align 4EXT(__subll):subcc gr9, gr11, gr9, icc0subx gr8, gr10, gr8, icc0ret.Lend:.size EXT(__subll),.Lend-EXT(__subll)#endif#ifdef L_andll/* gr8,gr9 = __andll (long long a, long long b) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__andll).type EXT(__andll),@function.text.p2align 4EXT(__andll):P(and) gr9, gr11, gr9P2(and) gr8, gr10, gr8ret.Lend:.size EXT(__andll),.Lend-EXT(__andll)#endif#ifdef L_orll/* gr8,gr9 = __orll (long long a, long long b) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__orll).type EXT(__orll),@function.text.p2align 4EXT(__orll):P(or) gr9, gr11, gr9P2(or) gr8, gr10, gr8ret.Lend:.size EXT(__orll),.Lend-EXT(__orll)#endif#ifdef L_xorll/* gr8,gr9 = __xorll (long long a, long long b) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__xorll).type EXT(__xorll),@function.text.p2align 4EXT(__xorll):P(xor) gr9, gr11, gr9P2(xor) gr8, gr10, gr8ret.Lend:.size EXT(__xorll),.Lend-EXT(__xorll)#endif#ifdef L_notll/* gr8,gr9 = __notll (long long a) *//* Note, gcc will never call this function, but it is present in case anABI program calls it. */.globl EXT(__notll).type EXT(__notll),@function.text.p2align 4EXT(__notll):P(not) gr9, gr9P2(not) gr8, gr8ret.Lend:.size EXT(__notll),.Lend-EXT(__notll)#endif#ifdef L_cmov/* (void) __cmov (char *dest, const char *src, size_t len) *//** void __cmov (char *dest, const char *src, size_t len)* {* size_t i;** if (dest < src || dest > src+len)* {* for (i = 0; i < len; i++)* dest[i] = src[i];* }* else* {* while (len-- > 0)* dest[len] = src[len];* }* }*/.globl EXT(__cmov).type EXT(__cmov),@function.text.p2align 4EXT(__cmov):P(cmp) gr8, gr9, icc0add gr9, gr10, gr4P(cmp) gr8, gr4, icc1bc icc0, 0, .Lfwdbls icc1, 0, .Lback.Lfwd:/* move bytes in a forward direction */P(setlos) #0, gr5cmp gr0, gr10, icc0P(subi) gr9, #1, gr9P2(subi) gr8, #1, gr8bnc icc0, 0, .Lret.Lfloop:/* forward byte move loop */addi gr5, #1, gr5P(ldsb) @(gr9, gr5), gr4cmp gr5, gr10, icc0P(stb) gr4, @(gr8, gr5)bc icc0, 0, .Lfloopret.Lbloop:/* backward byte move loop body */ldsb @(gr9,gr10),gr4stb gr4,@(gr8,gr10).Lback:P(cmpi) gr10, #0, icc0addi gr10, #-1, gr10bne icc0, 0, .Lbloop.Lret:ret.Lend:.size EXT(__cmov),.Lend-EXT(__cmov)#endif
