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

Unified Diff: src/s390/simulator-s390.cc

Issue 2761953002: s390: improve floating point and integer convertion (Closed)
Patch Set: Created 3 years, 9 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 | « src/s390/macro-assembler-s390.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/simulator-s390.cc
diff --git a/src/s390/simulator-s390.cc b/src/s390/simulator-s390.cc
index d387812bd7164097a9a57ad4669171967f60dab2..b669dcb20701c8bebd1fe3e7dfd5cda3574aa094 100644
--- a/src/s390/simulator-s390.cc
+++ b/src/s390/simulator-s390.cc
@@ -6265,10 +6265,21 @@ EVALUATE(CLFEBR) {
EVALUATE(CLFDBR) {
DCHECK_OPCODE(CLFDBR);
DECODE_RRE_INSTRUCTION(r1, r2);
- double r2_val = get_double_from_d_register(r2);
- uint32_t r1_val = static_cast<uint32_t>(r2_val);
+ double a = get_double_from_d_register(r2);
+ double n = std::round(a);
+ uint32_t r1_val = static_cast<uint32_t>(n);
set_low_register(r1, r1_val);
- SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX);
+ if (std::isfinite(a) && a < 0.0) {
+ DCHECK(n <= 0.0 && std::isfinite(n));
+ condition_reg_ = (n < 0.0) ? 0x1 : 0x4;
+ } else if (a == 0.0) {
+ condition_reg_ = 0x8;
+ } else if (std::isfinite(a) && a > 0.0) {
+ DCHECK(n >= 0.0 && std::isfinite(n));
+ condition_reg_ = (n <= static_cast<double>(UINT32_MAX)) ? 0x2 : 0x1;
+ } else {
+ condition_reg_ = 0x1;
+ }
return length;
}
« no previous file with comments | « src/s390/macro-assembler-s390.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698