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

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

Issue 1460093002: PPC: [turbofan] Implemented the TruncateFloat64ToUint64 TurboFan operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nit. Created 5 years, 1 month 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/ppc/macro-assembler-ppc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/simulator-ppc.cc
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc
index 2062bd26af8071bad6d1a3f22b3b37f1b7e5adcc..a39162e2502e938b7a1ce8d17bace4db852025df 100644
--- a/src/ppc/simulator-ppc.cc
+++ b/src/ppc/simulator-ppc.cc
@@ -2959,6 +2959,56 @@ void Simulator::ExecuteExt4(Instruction* instr) {
set_d_register(frt, frt_val);
return;
}
+ case FCTIDU: {
+ int frt = instr->RTValue();
+ int frb = instr->RBValue();
+ double frb_val = get_double_from_d_register(frb);
+ uint64_t frt_val;
+ uint64_t kMinLongLong = 0;
+ uint64_t kMaxLongLong = kMinLongLong - 1;
+
+ if (frb_val > kMaxLongLong) {
+ frt_val = kMaxLongLong;
+ } else if (frb_val < kMinLongLong) {
+ frt_val = kMinLongLong;
+ } else {
+ switch (fp_condition_reg_ & kFPRoundingModeMask) {
+ case kRoundToZero:
+ frt_val = (uint64_t)frb_val;
+ break;
+ case kRoundToPlusInf:
+ frt_val = (uint64_t)std::ceil(frb_val);
+ break;
+ case kRoundToMinusInf:
+ frt_val = (uint64_t)std::floor(frb_val);
+ break;
+ default:
+ frt_val = (uint64_t)frb_val;
+ UNIMPLEMENTED(); // Not used by V8.
+ break;
+ }
+ }
+ set_d_register(frt, frt_val);
+ return;
+ }
+ case FCTIDUZ: {
+ int frt = instr->RTValue();
+ int frb = instr->RBValue();
+ double frb_val = get_double_from_d_register(frb);
+ uint64_t frt_val;
+ uint64_t kMinLongLong = 0;
+ uint64_t kMaxLongLong = kMinLongLong - 1;
+
+ if (frb_val > kMaxLongLong) {
+ frt_val = kMaxLongLong;
+ } else if (frb_val < kMinLongLong) {
+ frt_val = kMinLongLong;
+ } else {
+ frt_val = (uint64_t)frb_val;
+ }
+ set_d_register(frt, frt_val);
+ return;
+ }
case FCTIW:
case FCTIWZ: {
int frt = instr->RTValue();
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698