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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdarg.h> 5 #include <stdarg.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <cmath> 7 #include <cmath>
8 8
9 #if V8_TARGET_ARCH_PPC 9 #if V8_TARGET_ARCH_PPC
10 10
(...skipping 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after
2952 if (frb_val > kMaxLongLong) { 2952 if (frb_val > kMaxLongLong) {
2953 frt_val = kMaxLongLong; 2953 frt_val = kMaxLongLong;
2954 } else if (frb_val < kMinLongLong) { 2954 } else if (frb_val < kMinLongLong) {
2955 frt_val = kMinLongLong; 2955 frt_val = kMinLongLong;
2956 } else { 2956 } else {
2957 frt_val = (int64_t)frb_val; 2957 frt_val = (int64_t)frb_val;
2958 } 2958 }
2959 set_d_register(frt, frt_val); 2959 set_d_register(frt, frt_val);
2960 return; 2960 return;
2961 } 2961 }
2962 case FCTIDU: {
2963 int frt = instr->RTValue();
2964 int frb = instr->RBValue();
2965 double frb_val = get_double_from_d_register(frb);
2966 uint64_t frt_val;
2967 uint64_t kMinLongLong = 0;
2968 uint64_t kMaxLongLong = kMinLongLong - 1;
2969
2970 if (frb_val > kMaxLongLong) {
2971 frt_val = kMaxLongLong;
2972 } else if (frb_val < kMinLongLong) {
2973 frt_val = kMinLongLong;
2974 } else {
2975 switch (fp_condition_reg_ & kFPRoundingModeMask) {
2976 case kRoundToZero:
2977 frt_val = (uint64_t)frb_val;
2978 break;
2979 case kRoundToPlusInf:
2980 frt_val = (uint64_t)std::ceil(frb_val);
2981 break;
2982 case kRoundToMinusInf:
2983 frt_val = (uint64_t)std::floor(frb_val);
2984 break;
2985 default:
2986 frt_val = (uint64_t)frb_val;
2987 UNIMPLEMENTED(); // Not used by V8.
2988 break;
2989 }
2990 }
2991 set_d_register(frt, frt_val);
2992 return;
2993 }
2994 case FCTIDUZ: {
2995 int frt = instr->RTValue();
2996 int frb = instr->RBValue();
2997 double frb_val = get_double_from_d_register(frb);
2998 uint64_t frt_val;
2999 uint64_t kMinLongLong = 0;
3000 uint64_t kMaxLongLong = kMinLongLong - 1;
3001
3002 if (frb_val > kMaxLongLong) {
3003 frt_val = kMaxLongLong;
3004 } else if (frb_val < kMinLongLong) {
3005 frt_val = kMinLongLong;
3006 } else {
3007 frt_val = (uint64_t)frb_val;
3008 }
3009 set_d_register(frt, frt_val);
3010 return;
3011 }
2962 case FCTIW: 3012 case FCTIW:
2963 case FCTIWZ: { 3013 case FCTIWZ: {
2964 int frt = instr->RTValue(); 3014 int frt = instr->RTValue();
2965 int frb = instr->RBValue(); 3015 int frb = instr->RBValue();
2966 double frb_val = get_double_from_d_register(frb); 3016 double frb_val = get_double_from_d_register(frb);
2967 int64_t frt_val; 3017 int64_t frt_val;
2968 if (frb_val > kMaxInt) { 3018 if (frb_val > kMaxInt) {
2969 frt_val = kMaxInt; 3019 frt_val = kMaxInt;
2970 } else if (frb_val < kMinInt) { 3020 } else if (frb_val < kMinInt) {
2971 frt_val = kMinInt; 3021 frt_val = kMinInt;
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); 4007 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
3958 uintptr_t address = *stack_slot; 4008 uintptr_t address = *stack_slot;
3959 set_register(sp, current_sp + sizeof(uintptr_t)); 4009 set_register(sp, current_sp + sizeof(uintptr_t));
3960 return address; 4010 return address;
3961 } 4011 }
3962 } // namespace internal 4012 } // namespace internal
3963 } // namespace v8 4013 } // namespace v8
3964 4014
3965 #endif // USE_SIMULATOR 4015 #endif // USE_SIMULATOR
3966 #endif // V8_TARGET_ARCH_PPC 4016 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« 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