From: Gabe Black Date: Fri, 14 Jul 2017 21:25:14 +0000 (-0700) Subject: riscv: Disambiguate between the C and C++ versions of isnan and isinf. X-Git-Tag: v19.0.0.0~2681 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dbeeb9693c8ab364fca7cf01817c9628252af652;p=gem5.git riscv: Disambiguate between the C and C++ versions of isnan and isinf. When both the C and C++ versions are visible, the compiler will complain that it doesn't know which one to use. By specifying the std namespace, it will know to use the C++ version. Change-Id: Ie1bbe1d95eadbad9644b4915c21f924d7d5c0b22 Reviewed-on: https://gem5-review.googlesource.com/4060 Reviewed-by: Alec Roelke Maintainer: Alec Roelke --- diff --git a/src/arch/riscv/isa/decoder.isa b/src/arch/riscv/isa/decoder.isa index 0e5567ac3..a6f881633 100644 --- a/src/arch/riscv/isa/decoder.isa +++ b/src/arch/riscv/isa/decoder.isa @@ -784,19 +784,20 @@ decode QUADRANT default Unknown::unknown() { float fs3 = reinterpret_cast(temp = Fs3_bits); float fd; - if (isnan(fs1) || isnan(fs2) || isnan(fs3)) { + if (std::isnan(fs1) || std::isnan(fs2) || + std::isnan(fs3)) { if (issignalingnan(fs1) || issignalingnan(fs2) || issignalingnan(fs3)) { FFLAGS |= FloatInvalid; } fd = numeric_limits::quiet_NaN(); - } else if (isinf(fs1) || isinf(fs2) || - isinf(fs3)) { + } else if (std::isinf(fs1) || std::isinf(fs2) || + std::isinf(fs3)) { if (signbit(fs1) == signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = numeric_limits::infinity(); } else if (signbit(fs1) != signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = -numeric_limits::infinity(); } else { // Fs3_sf is infinity fd = fs3; @@ -807,19 +808,20 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatMultOp); 0x1: fmadd_d({{ - if (isnan(Fs1) || isnan(Fs2) || isnan(Fs3)) { + if (std::isnan(Fs1) || std::isnan(Fs2) || + std::isnan(Fs3)) { if (issignalingnan(Fs1) || issignalingnan(Fs2) || issignalingnan(Fs3)) { FFLAGS |= FloatInvalid; } Fd = numeric_limits::quiet_NaN(); - } else if (isinf(Fs1) || isinf(Fs2) || - isinf(Fs3)) { + } else if (std::isinf(Fs1) || std::isinf(Fs2) || + std::isinf(Fs3)) { if (signbit(Fs1) == signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = numeric_limits::infinity(); } else if (signbit(Fs1) != signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = -numeric_limits::infinity(); } else { Fd = Fs3; @@ -837,19 +839,20 @@ decode QUADRANT default Unknown::unknown() { float fs3 = reinterpret_cast(temp = Fs3_bits); float fd; - if (isnan(fs1) || isnan(fs2) || isnan(fs3)) { + if (std::isnan(fs1) || std::isnan(fs2) || + std::isnan(fs3)) { if (issignalingnan(fs1) || issignalingnan(fs2) || issignalingnan(fs3)) { FFLAGS |= FloatInvalid; } fd = numeric_limits::quiet_NaN(); - } else if (isinf(fs1) || isinf(fs2) || - isinf(fs3)) { + } else if (std::isinf(fs1) || std::isinf(fs2) || + std::isinf(fs3)) { if (signbit(fs1) == signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = numeric_limits::infinity(); } else if (signbit(fs1) != signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = -numeric_limits::infinity(); } else { // Fs3_sf is infinity fd = -fs3; @@ -860,19 +863,20 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatMultOp); 0x1: fmsub_d({{ - if (isnan(Fs1) || isnan(Fs2) || isnan(Fs3)) { + if (std::isnan(Fs1) || std::isnan(Fs2) || + std::isnan(Fs3)) { if (issignalingnan(Fs1) || issignalingnan(Fs2) || issignalingnan(Fs3)) { FFLAGS |= FloatInvalid; } Fd = numeric_limits::quiet_NaN(); - } else if (isinf(Fs1) || isinf(Fs2) || - isinf(Fs3)) { + } else if (std::isinf(Fs1) || std::isinf(Fs2) || + std::isinf(Fs3)) { if (signbit(Fs1) == signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = numeric_limits::infinity(); } else if (signbit(Fs1) != signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = -numeric_limits::infinity(); } else { Fd = -Fs3; @@ -890,19 +894,20 @@ decode QUADRANT default Unknown::unknown() { float fs3 = reinterpret_cast(temp = Fs3_bits); float fd; - if (isnan(fs1) || isnan(fs2) || isnan(fs3)) { + if (std::isnan(fs1) || std::isnan(fs2) || + std::isnan(fs3)) { if (issignalingnan(fs1) || issignalingnan(fs2) || issignalingnan(fs3)) { FFLAGS |= FloatInvalid; } fd = numeric_limits::quiet_NaN(); - } else if (isinf(fs1) || isinf(fs2) || - isinf(fs3)) { + } else if (std::isinf(fs1) || std::isinf(fs2) || + std::isinf(fs3)) { if (signbit(fs1) == signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = -numeric_limits::infinity(); } else if (signbit(fs1) != signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = numeric_limits::infinity(); } else { // Fs3_sf is infinity fd = fs3; @@ -913,19 +918,20 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatMultOp); 0x1: fnmsub_d({{ - if (isnan(Fs1) || isnan(Fs2) || isnan(Fs3)) { + if (std::isnan(Fs1) || std::isnan(Fs2) || + std::isnan(Fs3)) { if (issignalingnan(Fs1) || issignalingnan(Fs2) || issignalingnan(Fs3)) { FFLAGS |= FloatInvalid; } Fd = numeric_limits::quiet_NaN(); - } else if (isinf(Fs1) || isinf(Fs2) - || isinf(Fs3)) { + } else if (std::isinf(Fs1) || std::isinf(Fs2) + || std::isinf(Fs3)) { if (signbit(Fs1) == signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = -numeric_limits::infinity(); } else if (signbit(Fs1) != signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = numeric_limits::infinity(); } else { Fd = Fs3; @@ -943,19 +949,20 @@ decode QUADRANT default Unknown::unknown() { float fs3 = reinterpret_cast(temp = Fs3_bits); float fd; - if (isnan(fs1) || isnan(fs2) || isnan(fs3)) { + if (std::isnan(fs1) || std::isnan(fs2) || + std::isnan(fs3)) { if (issignalingnan(fs1) || issignalingnan(fs2) || issignalingnan(fs3)) { FFLAGS |= FloatInvalid; } fd = numeric_limits::quiet_NaN(); - } else if (isinf(fs1) || isinf(fs2) || - isinf(fs3)) { + } else if (std::isinf(fs1) || std::isinf(fs2) || + std::isinf(fs3)) { if (signbit(fs1) == signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = -numeric_limits::infinity(); } else if (signbit(fs1) != signbit(fs2) - && !isinf(fs3)) { + && !std::isinf(fs3)) { fd = numeric_limits::infinity(); } else { // Fs3_sf is infinity fd = -fs3; @@ -966,19 +973,20 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatMultOp); 0x1: fnmadd_d({{ - if (isnan(Fs1) || isnan(Fs2) || isnan(Fs3)) { + if (std::isnan(Fs1) || std::isnan(Fs2) || + std::isnan(Fs3)) { if (issignalingnan(Fs1) || issignalingnan(Fs2) || issignalingnan(Fs3)) { FFLAGS |= FloatInvalid; } Fd = numeric_limits::quiet_NaN(); - } else if (isinf(Fs1) || isinf(Fs2) || - isinf(Fs3)) { + } else if (std::isinf(Fs1) || std::isinf(Fs2) || + std::isinf(Fs3)) { if (signbit(Fs1) == signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = -numeric_limits::infinity(); } else if (signbit(Fs1) != signbit(Fs2) - && !isinf(Fs3)) { + && !std::isinf(Fs3)) { Fd = numeric_limits::infinity(); } else { Fd = -Fs3; @@ -995,7 +1003,7 @@ decode QUADRANT default Unknown::unknown() { float fs2 = reinterpret_cast(temp = Fs2_bits); float fd; - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { if (issignalingnan(fs1) || issignalingnan(fs2)) { FFLAGS |= FloatInvalid; } @@ -1006,7 +1014,7 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatAddOp); 0x1: fadd_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { if (issignalingnan(Fs1) || issignalingnan(Fs2)) { FFLAGS |= FloatInvalid; } @@ -1021,7 +1029,7 @@ decode QUADRANT default Unknown::unknown() { float fs2 = reinterpret_cast(temp = Fs2_bits); float fd; - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { if (issignalingnan(fs1) || issignalingnan(fs2)) { FFLAGS |= FloatInvalid; } @@ -1032,7 +1040,7 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatAddOp); 0x5: fsub_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { if (issignalingnan(Fs1) || issignalingnan(Fs2)) { FFLAGS |= FloatInvalid; } @@ -1047,7 +1055,7 @@ decode QUADRANT default Unknown::unknown() { float fs2 = reinterpret_cast(temp = Fs2_bits); float fd; - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { if (issignalingnan(fs1) || issignalingnan(fs2)) { FFLAGS |= FloatInvalid; } @@ -1058,7 +1066,7 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatMultOp); 0x9: fmul_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { if (issignalingnan(Fs1) || issignalingnan(Fs2)) { FFLAGS |= FloatInvalid; } @@ -1073,7 +1081,7 @@ decode QUADRANT default Unknown::unknown() { float fs2 = reinterpret_cast(temp = Fs2_bits); float fd; - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { if (issignalingnan(fs1) || issignalingnan(fs2)) { FFLAGS |= FloatInvalid; } @@ -1084,7 +1092,7 @@ decode QUADRANT default Unknown::unknown() { Fd_bits = (uint64_t)reinterpret_cast(fd); }}, FloatDivOp); 0xd: fdiv_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { if (issignalingnan(Fs1) || issignalingnan(Fs2)) { FFLAGS |= FloatInvalid; } @@ -1268,7 +1276,7 @@ decode QUADRANT default Unknown::unknown() { float fs1 = reinterpret_cast(temp = Fs1_bits); float fs2 = reinterpret_cast(temp = Fs2_bits); - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { FFLAGS |= FloatInvalid; Rd = 0; } else { @@ -1280,7 +1288,7 @@ decode QUADRANT default Unknown::unknown() { float fs1 = reinterpret_cast(temp = Fs1_bits); float fs2 = reinterpret_cast(temp = Fs2_bits); - if (isnan(fs1) || isnan(fs2)) { + if (std::isnan(fs1) || std::isnan(fs2)) { FFLAGS |= FloatInvalid; Rd = 0; } else { @@ -1300,7 +1308,7 @@ decode QUADRANT default Unknown::unknown() { } 0x51: decode ROUND_MODE { 0x0: fle_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { FFLAGS |= FloatInvalid; Rd = 0; } else { @@ -1308,7 +1316,7 @@ decode QUADRANT default Unknown::unknown() { } }}, FloatCmpOp); 0x1: flt_d({{ - if (isnan(Fs1) || isnan(Fs2)) { + if (std::isnan(Fs1) || std::isnan(Fs2)) { FFLAGS |= FloatInvalid; Rd = 0; } else { @@ -1327,7 +1335,7 @@ decode QUADRANT default Unknown::unknown() { uint32_t temp; float fs1 = reinterpret_cast(temp = Fs1_bits); - if (isnan(fs1)) { + if (std::isnan(fs1)) { Rd_sd = numeric_limits::max(); FFLAGS |= FloatInvalid; } else { @@ -1361,7 +1369,7 @@ decode QUADRANT default Unknown::unknown() { uint32_t temp; float fs1 = reinterpret_cast(temp = Fs1_bits); - if (isnan(fs1)) { + if (std::isnan(fs1)) { Rd_sd = numeric_limits::max(); FFLAGS |= FloatInvalid; } else { @@ -1690,4 +1698,4 @@ decode QUADRANT default Unknown::unknown() { } } } -} \ No newline at end of file +}