/* Copyright (C) 2011-2017 Free Software Foundation, Inc. Contributed by Embecosm on behalf of Adapteva, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. 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; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ #include "../epiphany-asm.h" .section _fast_div_text,"a",@progbits; .balign 8; _fast_div_table: .word 0x007fffff// mantissa mask .word 0x40257ebb// hold constant a = 2.58586 .word 0x3f000000// hold constant 126 shifted to bits [30:23] .word 0xc0ba2e88// hold constant b = -5.81818 .word 0x4087c1e8// hold constant c = 4.24242 .word 0x40000000// to hold constant 2 for Newton-Raphson iterations .global SYM(__fast_recipsf2) FUNC(__fast_recipsf2) SYM(__fast_recipsf2): //################### //# input operands: //################### // Divisor //R0 // Function address (used with negative offsets to read _fast_div_table) //R1 /* Scratch registers: two single (TMP0/TMP5) and two pairs. */ #define P0L TMP1 #define P0H TMP2 #define P1L TMP3 #define P1H TMP4 //######################################### //# Constants to be used in the algorithm //######################################### ldrd P0L , [ R1 , -3 ] ldrd P1L , [ R1 , -2 ] //############################################################################# //# The Algorithm //# //# Operation: C=A/B //# stage 1 - find the reciprocal 1/B according to the following scheme: //# B = (2^E)*m (1