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

Side by Side Diff: src/compiler/ppc/code-generator-ppc.cc

Issue 2061753002: PPC: [builtins] Introduce proper Float64Log1p, Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('j') | 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 "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 FrameScope scope(masm(), StackFrame::MANUAL); \ 429 FrameScope scope(masm(), StackFrame::MANUAL); \
430 __ PrepareCallCFunction(0, 2, kScratchReg); \ 430 __ PrepareCallCFunction(0, 2, kScratchReg); \
431 __ MovToFloatParameters(i.InputDoubleRegister(0), \ 431 __ MovToFloatParameters(i.InputDoubleRegister(0), \
432 i.InputDoubleRegister(1)); \ 432 i.InputDoubleRegister(1)); \
433 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \ 433 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \
434 0, 2); \ 434 0, 2); \
435 __ MovFromFloatResult(i.OutputDoubleRegister()); \ 435 __ MovFromFloatResult(i.OutputDoubleRegister()); \
436 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 436 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
437 } while (0) 437 } while (0)
438 438
439 #define ASSEMBLE_FLOAT_LOG() \ 439 #define ASSEMBLE_IEEE754_UNOP(name) \
440 do { \ 440 do { \
441 FrameScope scope(masm(), StackFrame::MANUAL); \ 441 /* TODO(bmeurer): We should really get rid of this special instruction, */ \
442 __ PrepareCallCFunction(0, 1, kScratchReg); \ 442 /* and generate a CallAddress instruction instead. */ \
443 __ MovToFloatParameter(i.InputDoubleRegister(0)); \ 443 FrameScope scope(masm(), StackFrame::MANUAL); \
444 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 0, \ 444 __ PrepareCallCFunction(0, 1, kScratchReg); \
445 1); \ 445 __ MovToFloatParameter(i.InputDoubleRegister(0)); \
446 __ MovFromFloatResult(i.OutputDoubleRegister()); \ 446 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \
447 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ 447 0, 1); \
448 /* Move the result in the double result register. */ \
449 __ MovFromFloatResult(i.OutputDoubleRegister()); \
450 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
451 } while (0)
452
453 #define ASSEMBLE_IEEE754_BINOP(name) \
454 do { \
455 /* TODO(bmeurer): We should really get rid of this special instruction, */ \
456 /* and generate a CallAddress instruction instead. */ \
457 FrameScope scope(masm(), StackFrame::MANUAL); \
458 __ PrepareCallCFunction(0, 2, kScratchReg); \
459 __ MovToFloatParameters(i.InputDoubleRegister(0), \
460 i.InputDoubleRegister(1)); \
461 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \
462 0, 2); \
463 /* Move the result in the double result register. */ \
464 __ MovFromFloatResult(i.OutputDoubleRegister()); \
465 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
448 } while (0) 466 } while (0)
449 467
450 #define ASSEMBLE_FLOAT_MAX(scratch_reg) \ 468 #define ASSEMBLE_FLOAT_MAX(scratch_reg) \
451 do { \ 469 do { \
452 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ 470 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \
453 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(0), \ 471 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(0), \
454 i.InputDoubleRegister(1)); \ 472 i.InputDoubleRegister(1)); \
455 } while (0) 473 } while (0)
456 474
457 475
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 #if V8_TARGET_ARCH_PPC64 1250 #if V8_TARGET_ARCH_PPC64
1233 case kPPC_ModU64: 1251 case kPPC_ModU64:
1234 ASSEMBLE_MODULO(divdu, mulld); 1252 ASSEMBLE_MODULO(divdu, mulld);
1235 break; 1253 break;
1236 #endif 1254 #endif
1237 case kPPC_ModDouble: 1255 case kPPC_ModDouble:
1238 // TODO(bmeurer): We should really get rid of this special instruction, 1256 // TODO(bmeurer): We should really get rid of this special instruction,
1239 // and generate a CallAddress instruction instead. 1257 // and generate a CallAddress instruction instead.
1240 ASSEMBLE_FLOAT_MODULO(); 1258 ASSEMBLE_FLOAT_MODULO();
1241 break; 1259 break;
1242 case kPPC_LogDouble: 1260 case kIeee754Float64Atan:
1243 // TODO(bmeurer): We should really get rid of this special instruction, 1261 ASSEMBLE_IEEE754_UNOP(atan);
1244 // and generate a CallAddress instruction instead. 1262 break;
1245 ASSEMBLE_FLOAT_LOG(); 1263 case kIeee754Float64Atan2:
1264 ASSEMBLE_IEEE754_BINOP(atan2);
1265 break;
1266 case kIeee754Float64Log:
1267 ASSEMBLE_IEEE754_UNOP(log);
1268 break;
1269 case kIeee754Float64Log1p:
1270 ASSEMBLE_IEEE754_UNOP(log1p);
1246 break; 1271 break;
1247 case kPPC_Neg: 1272 case kPPC_Neg:
1248 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); 1273 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit());
1249 break; 1274 break;
1250 case kPPC_MaxDouble: 1275 case kPPC_MaxDouble:
1251 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg); 1276 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg);
1252 break; 1277 break;
1253 case kPPC_MinDouble: 1278 case kPPC_MinDouble:
1254 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg); 1279 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg);
1255 break; 1280 break;
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 padding_size -= v8::internal::Assembler::kInstrSize; 2184 padding_size -= v8::internal::Assembler::kInstrSize;
2160 } 2185 }
2161 } 2186 }
2162 } 2187 }
2163 2188
2164 #undef __ 2189 #undef __
2165 2190
2166 } // namespace compiler 2191 } // namespace compiler
2167 } // namespace internal 2192 } // namespace internal
2168 } // namespace v8 2193 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698