X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=softfloat%2Ff32_add.c;h=5b5a09e7ca094dd6f81c7a4e2463aa5279139325;hb=2f346fd7e050c6e4f518f642fa69d742ebebaac4;hp=dc53d68d60088302c74d719e95e5de7e9d2135e0;hpb=ab928baadbfd3316988a3ad5b5d9b84693a8636f;p=riscv-isa-sim.git diff --git a/softfloat/f32_add.c b/softfloat/f32_add.c old mode 100755 new mode 100644 index dc53d68..5b5a09e --- a/softfloat/f32_add.c +++ b/softfloat/f32_add.c @@ -1,4 +1,39 @@ +/*============================================================================ + +This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic +Package, Release 3a, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + #include #include #include "platform.h" @@ -13,7 +48,9 @@ float32_t f32_add( float32_t a, float32_t b ) union ui32_f32 uB; uint_fast32_t uiB; bool signB; - float32_t ( *magsRoutine )( uint_fast32_t, uint_fast32_t, bool ); +#if ! defined INLINE_LEVEL || (INLINE_LEVEL < 1) + float32_t (*magsFuncPtr)( uint_fast32_t, uint_fast32_t, bool ); +#endif uA.f = a; uiA = uA.ui; @@ -21,9 +58,17 @@ float32_t f32_add( float32_t a, float32_t b ) uB.f = b; uiB = uB.ui; signB = signF32UI( uiB ); - magsRoutine = - ( signA == signB ) ? softfloat_addMagsF32 : softfloat_subMagsF32; - return magsRoutine( uiA, uiB, signA ); +#if defined INLINE_LEVEL && (1 <= INLINE_LEVEL) + if ( signA == signB ) { + return softfloat_addMagsF32( uiA, uiB, signA ); + } else { + return softfloat_subMagsF32( uiA, uiB, signA ); + } +#else + magsFuncPtr = + (signA == signB) ? softfloat_addMagsF32 : softfloat_subMagsF32; + return (*magsFuncPtr)( uiA, uiB, signA ); +#endif }