URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [epiphany/] [divsi3-float.S] - Rev 734
Compare with Previous | Blame | View Log
/* Signed 32 bit division optimized for Epiphany.Copyright (C) 2009, 2011 Free Software Foundation, Inc.Contributed by Embecosm on behalf of Adapteva, Inc.This file is part of GCC.This file is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 3, or (at your option) anylater version.This file is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral 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 "epiphany-asm.h"FSTAB (__divsi3,T_UINT).global SYM(__divsi3).balign 4HIDDEN_FUNC(__divsi3)SYM(__divsi3):float TMP2,r0mov TMP4,0float TMP1,r1sub TMP0,TMP4,r0beq .Lret_r0movgt r0,TMP0sub TMP0,TMP4,r1movgt r1,TMP0mov TMP0,1sub TMP2,TMP2,TMP1asr TMP3,TMP2,31 ; save signlsl TMP2,TMP2,1blt .Lret0sub TMP1,TMP2,1 ; rounding compensation, avoid overflowmovgte TMP2,TMP1lsr TMP2,TMP2,24lsl r1,r1,TMP2lsl TMP0,TMP0,TMP2sub TMP1,r0,r1movgteu r0,TMP1movgteu TMP4,TMP0lsl TMP5,TMP0,1sub TMP1,r0,r1movgteu r0,TMP1movgteu TMP4,TMP5sub TMP1,r1,1mov r1,%low(.L0step)movt r1,%high(.L0step)lsl TMP2,TMP2,3sub r1,r1,TMP2jr r1.rep 30lsl r0,r0,1sub.l r1,r0,TMP1movgteu r0,r1.endr.L0step:sub r1,TMP0,1 ; mask result bits from steps ...and r0,r0,r1orr r0,r0,TMP4 ; ... and combine with first bit.eor r0,r0,TMP3 ; restore signsub r0,r0,TMP3.Lret_r0:rts.Lret0: mov r0,0rtsENDFUNC(__divsi3)
