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

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

Issue 1515603002: PPC64: [turbofan] Changed TruncateFloat64ToInt64 to TryTruncateFloat64ToInt64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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-selector-ppc.cc » ('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"
11 #include "src/compiler/osr.h" 11 #include "src/compiler/osr.h"
12 #include "src/ppc/macro-assembler-ppc.h" 12 #include "src/ppc/macro-assembler-ppc.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace compiler { 16 namespace compiler {
17 17
18 #define __ masm()-> 18 #define __ masm()->
19 19
20 20
21 #define kScratchReg r11 21 #define kScratchReg r11
22 22
23 23
24 // Adds PPC-specific methods to convert InstructionOperands. 24 // Adds PPC-specific methods to convert InstructionOperands.
25 class PPCOperandConverter final : public InstructionOperandConverter { 25 class PPCOperandConverter final : public InstructionOperandConverter {
26 public: 26 public:
27 PPCOperandConverter(CodeGenerator* gen, Instruction* instr) 27 PPCOperandConverter(CodeGenerator* gen, Instruction* instr)
28 : InstructionOperandConverter(gen, instr) {} 28 : InstructionOperandConverter(gen, instr) {}
29 29
30 size_t OutputCount() { return instr_->OutputCount(); }
31
30 RCBit OutputRCBit() const { 32 RCBit OutputRCBit() const {
31 switch (instr_->flags_mode()) { 33 switch (instr_->flags_mode()) {
32 case kFlags_branch: 34 case kFlags_branch:
33 case kFlags_set: 35 case kFlags_set:
34 return SetRC; 36 return SetRC;
35 case kFlags_none: 37 case kFlags_none:
36 return LeaveRC; 38 return LeaveRC;
37 } 39 }
38 UNREACHABLE(); 40 UNREACHABLE();
39 return LeaveRC; 41 return LeaveRC;
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 __ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister()); 1152 __ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister());
1151 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1153 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1152 break; 1154 break;
1153 case kPPC_Uint32ToDouble: 1155 case kPPC_Uint32ToDouble:
1154 __ ConvertUnsignedIntToDouble(i.InputRegister(0), 1156 __ ConvertUnsignedIntToDouble(i.InputRegister(0),
1155 i.OutputDoubleRegister()); 1157 i.OutputDoubleRegister());
1156 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1158 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1157 break; 1159 break;
1158 case kPPC_DoubleToInt32: 1160 case kPPC_DoubleToInt32:
1159 case kPPC_DoubleToUint32: 1161 case kPPC_DoubleToUint32:
1160 case kPPC_DoubleToInt64: 1162 case kPPC_DoubleToInt64: {
1163 #if V8_TARGET_ARCH_PPC64
1164 bool check_conversion =
1165 (opcode == kPPC_DoubleToInt64 && i.OutputCount() > 1);
1166 if (check_conversion) {
1167 __ mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
1168 }
1169 #endif
1161 __ ConvertDoubleToInt64(i.InputDoubleRegister(0), 1170 __ ConvertDoubleToInt64(i.InputDoubleRegister(0),
1162 #if !V8_TARGET_ARCH_PPC64 1171 #if !V8_TARGET_ARCH_PPC64
1163 kScratchReg, 1172 kScratchReg,
1164 #endif 1173 #endif
1165 i.OutputRegister(), kScratchDoubleReg); 1174 i.OutputRegister(0), kScratchDoubleReg);
1175 #if V8_TARGET_ARCH_PPC64
1176 if (check_conversion) {
1177 // Set 2nd output to zero if conversion fails.
1178 CRBit crbit = static_cast<CRBit>(VXCVI % CRWIDTH);
1179 __ mcrfs(cr7, VXCVI); // extract FPSCR field containing VXCVI into cr7
1180 __ li(i.OutputRegister(1), Operand(1));
1181 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1),
1182 v8::internal::Assembler::encode_crbit(cr7, crbit));
1183 }
1184 #endif
1166 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1185 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1167 break; 1186 break;
1187 }
1168 #if V8_TARGET_ARCH_PPC64 1188 #if V8_TARGET_ARCH_PPC64
1169 case kPPC_DoubleToUint64: 1189 case kPPC_DoubleToUint64:
1170 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0), 1190 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0),
1171 i.OutputRegister(), kScratchDoubleReg); 1191 i.OutputRegister(), kScratchDoubleReg);
1172 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1192 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1173 break; 1193 break;
1174 #endif 1194 #endif
1175 case kPPC_DoubleToFloat32: 1195 case kPPC_DoubleToFloat32:
1176 ASSEMBLE_FLOAT_UNOP_RC(frsp); 1196 ASSEMBLE_FLOAT_UNOP_RC(frsp);
1177 break; 1197 break;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 padding_size -= v8::internal::Assembler::kInstrSize; 1790 padding_size -= v8::internal::Assembler::kInstrSize;
1771 } 1791 }
1772 } 1792 }
1773 } 1793 }
1774 1794
1775 #undef __ 1795 #undef __
1776 1796
1777 } // namespace compiler 1797 } // namespace compiler
1778 } // namespace internal 1798 } // namespace internal
1779 } // namespace v8 1799 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-selector-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698