addsf3.c (229135) | addsf3.c (239138) |
---|---|
1//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements single-precision soft-float addition with the IEEE-754 11// default rounding (to nearest, ties to even). 12// 13//===----------------------------------------------------------------------===// 14 15#define SINGLE_PRECISION 16#include "fp_lib.h" 17 | 1//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements single-precision soft-float addition with the IEEE-754 11// default rounding (to nearest, ties to even). 12// 13//===----------------------------------------------------------------------===// 14 15#define SINGLE_PRECISION 16#include "fp_lib.h" 17 |
18ARM_EABI_FNALIAS(fadd, addsf3); | 18ARM_EABI_FNALIAS(fadd, addsf3) |
19 20fp_t __addsf3(fp_t a, fp_t b) { 21 22 rep_t aRep = toRep(a); 23 rep_t bRep = toRep(b); 24 const rep_t aAbs = aRep & absMask; 25 const rep_t bAbs = bRep & absMask; 26 --- 52 unchanged lines hidden (view full) --- 79 // implicit significand bit. (If we fell through from the denormal path it 80 // was already set by normalize( ), but setting it twice won't hurt 81 // anything.) 82 aSignificand = (aSignificand | implicitBit) << 3; 83 bSignificand = (bSignificand | implicitBit) << 3; 84 85 // Shift the significand of b by the difference in exponents, with a sticky 86 // bottom bit to get rounding correct. | 19 20fp_t __addsf3(fp_t a, fp_t b) { 21 22 rep_t aRep = toRep(a); 23 rep_t bRep = toRep(b); 24 const rep_t aAbs = aRep & absMask; 25 const rep_t bAbs = bRep & absMask; 26 --- 52 unchanged lines hidden (view full) --- 79 // implicit significand bit. (If we fell through from the denormal path it 80 // was already set by normalize( ), but setting it twice won't hurt 81 // anything.) 82 aSignificand = (aSignificand | implicitBit) << 3; 83 bSignificand = (bSignificand | implicitBit) << 3; 84 85 // Shift the significand of b by the difference in exponents, with a sticky 86 // bottom bit to get rounding correct. |
87 const int align = aExponent - bExponent; | 87 const unsigned int align = aExponent - bExponent; |
88 if (align) { 89 if (align < typeWidth) { 90 const bool sticky = bSignificand << (typeWidth - align); 91 bSignificand = bSignificand >> align | sticky; 92 } else { 93 bSignificand = 1; // sticky; b is known to be non-zero. 94 } 95 } --- 56 unchanged lines hidden --- | 88 if (align) { 89 if (align < typeWidth) { 90 const bool sticky = bSignificand << (typeWidth - align); 91 bSignificand = bSignificand >> align | sticky; 92 } else { 93 bSignificand = 1; // sticky; b is known to be non-zero. 94 } 95 } --- 56 unchanged lines hidden --- |