Chromium Code Reviews| Index: runtime/vm/simulator_mips.cc |
| diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc |
| index 074fc8c7eb08767fc0c15e7e28f2cb713887b23d..4f00cad57d3678287147a9839dcbcd3e5636f876 100644 |
| --- a/runtime/vm/simulator_mips.cc |
| +++ b/runtime/vm/simulator_mips.cc |
| @@ -1888,24 +1888,18 @@ void Simulator::DecodeCop1(Instr* instr) { |
| (fs_val <= ft_val) || isnan(fs_val) || isnan(ft_val)); |
| break; |
| } |
| - case COP1_CVT_D: { |
| + case COP1_TRUNC_W: { |
| switch (instr->FormatField()) { |
| - case FMT_W: { |
| - int32_t fs_int = get_fregister(instr->FsField()); |
| - double fs_dbl = static_cast<double>(fs_int); |
| - set_fregister_double(instr->FdField(), fs_dbl); |
| - break; |
| - } |
| - case FMT_S: { |
| - float fs_flt = get_fregister_float(instr->FsField()); |
| - double fs_dbl = static_cast<double>(fs_flt); |
| - set_fregister_double(instr->FdField(), fs_dbl); |
| - break; |
| - } |
| - case FMT_L: { |
| - int64_t fs_int = get_fregister_long(instr->FsField()); |
| - double fs_dbl = static_cast<double>(fs_int); |
| - set_fregister_double(instr->FdField(), fs_dbl); |
| + case FMT_D: { |
| + double fs_dbl = get_fregister_double(instr->FsField()); |
| + int32_t fs_int; |
| + if (isnan(fs_dbl) || isinf(fs_dbl) || (fs_dbl > INT_MAX) || |
|
rmacnak
2016/03/03 22:12:03
INT_MAX isn't necessarily kInt32Max (although ILP6
regis
2016/03/03 23:14:48
OK, changed to kMaxInt32 and kMinInt32. But note t
|
| + (fs_dbl < INT_MIN)) { |
| + fs_int = INT_MIN; |
|
rmacnak
2016/03/03 22:12:02
kMaxInt32
"Otherwise, the default result, 2^31–1,
regis
2016/03/03 23:14:48
Good catch. Fixed. I had simply recycled the exist
|
| + } else { |
| + fs_int = static_cast<int32_t>(fs_dbl); |
| + } |
| + set_fregister(instr->FdField(), fs_int); |
| break; |
| } |
| default: { |
| @@ -1916,18 +1910,18 @@ void Simulator::DecodeCop1(Instr* instr) { |
| } |
| break; |
| } |
| - case COP1_CVT_W: { |
| + case COP1_CVT_D: { |
| switch (instr->FormatField()) { |
| - case FMT_D: { |
| - double fs_dbl = get_fregister_double(instr->FsField()); |
| - int32_t fs_int; |
| - if (isnan(fs_dbl) || isinf(fs_dbl) || (fs_dbl > INT_MAX) || |
| - (fs_dbl < INT_MIN)) { |
| - fs_int = INT_MIN; |
| - } else { |
| - fs_int = static_cast<int32_t>(fs_dbl); |
| - } |
| - set_fregister(instr->FdField(), fs_int); |
| + case FMT_W: { |
| + int32_t fs_int = get_fregister(instr->FsField()); |
| + double fs_dbl = static_cast<double>(fs_int); |
| + set_fregister_double(instr->FdField(), fs_dbl); |
| + break; |
| + } |
| + case FMT_S: { |
| + float fs_flt = get_fregister_float(instr->FsField()); |
| + double fs_dbl = static_cast<double>(fs_flt); |
| + set_fregister_double(instr->FdField(), fs_dbl); |
| break; |
| } |
| default: { |