OLD | NEW |
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/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/ppc/macro-assembler-ppc.h" | 10 #include "src/ppc/macro-assembler-ppc.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 __ PrepareCallCFunction(0, 2, kScratchReg); \ | 332 __ PrepareCallCFunction(0, 2, kScratchReg); \ |
333 __ MovToFloatParameters(i.InputDoubleRegister(0), \ | 333 __ MovToFloatParameters(i.InputDoubleRegister(0), \ |
334 i.InputDoubleRegister(1)); \ | 334 i.InputDoubleRegister(1)); \ |
335 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \ | 335 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \ |
336 0, 2); \ | 336 0, 2); \ |
337 __ MovFromFloatResult(i.OutputDoubleRegister()); \ | 337 __ MovFromFloatResult(i.OutputDoubleRegister()); \ |
338 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ | 338 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ |
339 } while (0) | 339 } while (0) |
340 | 340 |
341 | 341 |
| 342 #define ASSEMBLE_FLOAT_MAX(scratch_reg) \ |
| 343 do { \ |
| 344 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ |
| 345 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(0), \ |
| 346 i.InputDoubleRegister(1)); \ |
| 347 } while (0) |
| 348 |
| 349 |
| 350 #define ASSEMBLE_FLOAT_MIN(scratch_reg) \ |
| 351 do { \ |
| 352 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ |
| 353 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(1), \ |
| 354 i.InputDoubleRegister(0)); \ |
| 355 } while (0) |
| 356 |
| 357 |
342 #define ASSEMBLE_LOAD_FLOAT(asm_instr, asm_instrx) \ | 358 #define ASSEMBLE_LOAD_FLOAT(asm_instr, asm_instrx) \ |
343 do { \ | 359 do { \ |
344 DoubleRegister result = i.OutputDoubleRegister(); \ | 360 DoubleRegister result = i.OutputDoubleRegister(); \ |
345 AddressingMode mode = kMode_None; \ | 361 AddressingMode mode = kMode_None; \ |
346 MemOperand operand = i.MemoryOperand(&mode); \ | 362 MemOperand operand = i.MemoryOperand(&mode); \ |
347 if (mode == kMode_MRI) { \ | 363 if (mode == kMode_MRI) { \ |
348 __ asm_instr(result, operand); \ | 364 __ asm_instr(result, operand); \ |
349 } else { \ | 365 } else { \ |
350 __ asm_instrx(result, operand); \ | 366 __ asm_instrx(result, operand); \ |
351 } \ | 367 } \ |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 #endif | 808 #endif |
793 case kPPC_ModFloat64: | 809 case kPPC_ModFloat64: |
794 // TODO(bmeurer): We should really get rid of this special instruction, | 810 // TODO(bmeurer): We should really get rid of this special instruction, |
795 // and generate a CallAddress instruction instead. | 811 // and generate a CallAddress instruction instead. |
796 ASSEMBLE_FLOAT_MODULO(); | 812 ASSEMBLE_FLOAT_MODULO(); |
797 break; | 813 break; |
798 case kPPC_Neg32: | 814 case kPPC_Neg32: |
799 case kPPC_Neg64: | 815 case kPPC_Neg64: |
800 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); | 816 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); |
801 break; | 817 break; |
| 818 case kPPC_MaxFloat64: |
| 819 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg); |
| 820 break; |
| 821 case kPPC_MinFloat64: |
| 822 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg); |
| 823 break; |
802 case kPPC_SqrtFloat64: | 824 case kPPC_SqrtFloat64: |
803 ASSEMBLE_FLOAT_UNOP_RC(fsqrt); | 825 ASSEMBLE_FLOAT_UNOP_RC(fsqrt); |
804 break; | 826 break; |
805 case kPPC_FloorFloat64: | 827 case kPPC_FloorFloat64: |
806 ASSEMBLE_FLOAT_UNOP_RC(frim); | 828 ASSEMBLE_FLOAT_UNOP_RC(frim); |
807 break; | 829 break; |
808 case kPPC_CeilFloat64: | 830 case kPPC_CeilFloat64: |
809 ASSEMBLE_FLOAT_UNOP_RC(frip); | 831 ASSEMBLE_FLOAT_UNOP_RC(frip); |
810 break; | 832 break; |
811 case kPPC_TruncateFloat64: | 833 case kPPC_TruncateFloat64: |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 } | 1446 } |
1425 } | 1447 } |
1426 MarkLazyDeoptSite(); | 1448 MarkLazyDeoptSite(); |
1427 } | 1449 } |
1428 | 1450 |
1429 #undef __ | 1451 #undef __ |
1430 | 1452 |
1431 } // namespace compiler | 1453 } // namespace compiler |
1432 } // namespace internal | 1454 } // namespace internal |
1433 } // namespace v8 | 1455 } // namespace v8 |
OLD | NEW |