Index: src/mips/simulator-mips.cc |
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc |
index 2478539d1e96e185fb852fe5655609da71861622..b41e61d8ae0af0357fb52608fc5fc5b875e382b7 100644 |
--- a/src/mips/simulator-mips.cc |
+++ b/src/mips/simulator-mips.cc |
@@ -12,6 +12,7 @@ |
#if V8_TARGET_ARCH_MIPS |
#include "src/assembler.h" |
+#include "src/base/bits.h" |
#include "src/disasm.h" |
#include "src/globals.h" // Need the BitCast. |
#include "src/mips/constants-mips.h" |
@@ -1966,10 +1967,8 @@ void Simulator::ConfigureTypeRegister(Instruction* instr, |
} else { |
// MIPS spec: If no bits were set in GPR rs, the result written to |
// GPR rd is 32. |
- // GCC __builtin_clz: If input is 0, the result is undefined. |
DCHECK(instr->SaValue() == 1); |
- *alu_out = |
- rs_u == 0 ? 32 : CompilerIntrinsics::CountLeadingZeros(rs_u); |
+ *alu_out = base::bits::CountLeadingZeros32(rs_u); |
} |
break; |
case MFLO: |
@@ -2094,9 +2093,7 @@ void Simulator::ConfigureTypeRegister(Instruction* instr, |
case CLZ: |
// MIPS32 spec: If no bits were set in GPR rs, the result written to |
// GPR rd is 32. |
- // GCC __builtin_clz: If input is 0, the result is undefined. |
- *alu_out = |
- rs_u == 0 ? 32 : CompilerIntrinsics::CountLeadingZeros(rs_u); |
+ *alu_out = base::bits::CountLeadingZeros32(rs_u); |
break; |
default: |
UNREACHABLE(); |