src/arch/arm/insts/vfp.cc
// This function is only intended for use in Neon instructions because
// it ignores certain bits in the FPSCR.
This function is only intended for use in Neon instructions because
it ignores certain bits in the FPSCR.
This function is only intended for use in Neon instructions because it ignores certain bits in the FPSCR .
float
fpRecipEstimate(FPSCR &fpscr, float op)
{
    const uint32_t qnan = 0x7fc00000;
    float junk = 0.0;
    int fpClass = std::fpclassify(op);
    if (fpClass == FP_NAN) {
        if ((fpToBits(op) & qnan) != qnan)
            fpscr.ioc = 1;
        return bitsToFp(qnan, junk);
    } else if (fpClass == FP_INFINITE) {
        return bitsToFp(std::signbit(op) << 31, junk);
    } else if (fpClass == FP_ZERO) {
        fpscr.dzc = 1;
        return bitsToFp((std::signbit(op) << 31) |
                       (0xFF << 23) | (0 << 0), junk);
    } else if (fabs(op) >= pow(2.0, 126)) {
        fpscr.ufc = 1;
        return bitsToFp(std::signbit(op) << 31, junk);
    } else {
        uint64_t opBits = fpToBits(op);
        double scaled;
        scaled = bitsToFp((0 << 0) | (bits(opBits, 22, 0) << 29) |
                          (0x3feULL << 52) | (0ULL << 63),
                          (double)0.0);
        uint64_t resultExp = 253 - bits(opBits, 30, 23);
        uint64_t estimate = fpToBits(recipEstimate(scaled));
        return bitsToFp((bits(opBits, 31) << 31) |
                        (bits(resultExp, 7, 0) << 23) |
                        (bits(estimate, 51, 29) << 0), junk);
    }
}
float fpRecipEstimate ( FPSCR & fpscr , float op ) { const uint32_t qnan = 0x7fc00000 ; float junk = 0.0 ; int fpClass = std :: fpclassify ( op ) ; if ( fpClass == FP_NAN ) { if ( ( fpToBits ( op ) & qnan ) != qnan ) fpscr . ioc = 1 ; return bitsToFp ( qnan , junk ) ; } else if ( fpClass == FP_INFINITE ) { return bitsToFp ( std :: signbit ( op ) << 31 , junk ) ; } else if ( fpClass == FP_ZERO ) { fpscr . dzc = 1 ; return bitsToFp ( ( std :: signbit ( op ) << 31 ) | ( 0xFF << 23 ) | ( 0 << 0 ) , junk ) ; } else if ( fabs ( op ) >= pow ( 2.0 , 126 ) ) { fpscr . ufc = 1 ; return bitsToFp ( std :: signbit ( op ) << 31 , junk ) ; } else { uint64_t opBits = fpToBits ( op ) ; double scaled ; scaled = bitsToFp ( ( 0 << 0 ) | ( bits ( opBits , 22 , 0 ) << 29 ) | ( 0x3feULL << 52 ) | ( 0ULL << 63 ) , ( double ) 0.0 ) ; uint64_t resultExp = 253 - bits ( opBits , 30 , 23 ) ; uint64_t estimate = fpToBits ( recipEstimate ( scaled ) ) ; return bitsToFp ( ( bits ( opBits , 31 ) << 31 ) | ( bits ( resultExp , 7 , 0 ) << 23 ) | ( bits ( estimate , 51 , 29 ) << 0 ) , junk ) ; } }
This function is only intended for use in Neon instructions because
it ignores certain bits in the FPSCR.
This function is only intended for use in Neon instructions because it ignores certain bits in the FPSCR .
// Return infinity with the same sign as the operand.