//===-- fp_div_impl.inc - Floating point division -----------------*- C -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements soft-float division with the IEEE-754 default // rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// #include "fp_lib.h" // The __divXf3__ function implements Newton-Raphson floating point division. // It uses 3 iterations for float32, 4 for float64 and 5 for float128, // respectively. Due to number of significant bits being roughly doubled // every iteration, the two modes are supported: N full-width iterations (as // it is done for float32 by default) and (N-1) half-width iteration plus one // final full-width iteration. It is expected that half-width integer // operations (w.r.t rep_t size) can be performed faster for some hardware but // they require error estimations to be computed separately due to larger // computational errors caused by truncating intermediate results. // Half the bit-size of rep_t #define HW … // rep_t-sized bitmask with lower half of bits set to ones #define loMask … #if NUMBER_OF_FULL_ITERATIONS < 1 #error At least one full iteration is required #endif static __inline fp_t __divXf3__(fp_t a, fp_t b) { … }