diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc index e34c3116e6..50c42c350d 100644 --- a/src/arm/simulator-arm.cc +++ b/src/arm/simulator-arm.cc @@ -3069,7 +3069,7 @@ void Simulator::DecodeTypeVFP(Instruction* instr) { } else if (((instr->Opc2Value() == 0x1)) && (instr->Opc3Value() == 0x3)) { // vsqrt double dm_value = get_double_from_d_register(vm); - double dd_value = std::sqrt(dm_value); + double dd_value = fast_sqrt(dm_value); dd_value = canonicalizeNaN(dd_value); set_d_register_from_double(vd, dd_value); } else if (instr->Opc3Value() == 0x0) { diff --git a/src/arm64/simulator-arm64.cc b/src/arm64/simulator-arm64.cc index bc524af72c..819a89765d 100644 --- a/src/arm64/simulator-arm64.cc +++ b/src/arm64/simulator-arm64.cc @@ -12,6 +12,7 @@ #include "src/arm64/decoder-arm64-inl.h" #include "src/arm64/simulator-arm64.h" #include "src/assembler.h" +#include "src/codegen.h" #include "src/disasm.h" #include "src/macro-assembler.h" #include "src/ostreams.h" @@ -3100,7 +3101,7 @@ T Simulator::FPSqrt(T op) { } else if (op < 0.0) { return FPDefaultNaN(); } else { - return std::sqrt(op); + return fast_sqrt(op); } } diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc index fabca67062..79f337d3df 100644 --- a/src/mips/simulator-mips.cc +++ b/src/mips/simulator-mips.cc @@ -13,6 +13,7 @@ #include "src/assembler.h" #include "src/base/bits.h" +#include "src/codegen.h" #include "src/disasm.h" #include "src/mips/constants-mips.h" #include "src/mips/simulator-mips.h" @@ -2244,7 +2245,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { set_fpu_register_double(fd_reg, -fs); break; case SQRT_D: - set_fpu_register_double(fd_reg, sqrt(fs)); + set_fpu_register_double(fd_reg, fast_sqrt(fs)); break; case C_UN_D: set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft)); diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc index 9899d47a0e..883991768c 100644 --- a/src/mips64/simulator-mips64.cc +++ b/src/mips64/simulator-mips64.cc @@ -13,6 +13,7 @@ #include "src/assembler.h" #include "src/base/bits.h" +#include "src/codegen.h" #include "src/disasm.h" #include "src/mips64/constants-mips64.h" #include "src/mips64/simulator-mips64.h" @@ -2391,7 +2392,7 @@ void Simulator::DecodeTypeRegister(Instruction* instr) { set_fpu_register_double(fd_reg, -fs); break; case SQRT_D: - set_fpu_register_double(fd_reg, sqrt(fs)); + set_fpu_register_double(fd_reg, fast_sqrt(fs)); break; case C_UN_D: set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft)); diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc index 0d10153790..34c35d613e 100644 --- a/src/ppc/simulator-ppc.cc +++ b/src/ppc/simulator-ppc.cc @@ -2613,7 +2613,7 @@ void Simulator::ExecuteExt4(Instruction* instr) { int frt = instr->RTValue(); int frb = instr->RBValue(); double frb_val = get_double_from_d_register(frb); - double frt_val = std::sqrt(frb_val); + double frt_val = fast_sqrt(frb_val); set_d_register_from_double(frt, frt_val); return; }