Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1198)

Unified Diff: runtime/vm/simulator_mips.cc

Issue 1765623002: Use TRUNC.W instead of CVT.W on mips to convert from double to int as to not (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_mips.cc
diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc
index 074fc8c7eb08767fc0c15e7e28f2cb713887b23d..a828752d6f87918e65f116d65887a11ad867bedb 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 > kMaxInt32) ||
+ (fs_dbl < kMinInt32)) {
+ fs_int = kMaxInt32;
+ } 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: {
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698