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

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

Issue 1533613002: PPC: [turbofan] Change TruncateFloat32ToUint64 to TryTruncateFloat32ToUint64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@patch08
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"
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1), 1184 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1),
1185 v8::internal::Assembler::encode_crbit(cr7, crbit)); 1185 v8::internal::Assembler::encode_crbit(cr7, crbit));
1186 } 1186 }
1187 #endif 1187 #endif
1188 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1188 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1189 break; 1189 break;
1190 } 1190 }
1191 #if V8_TARGET_ARCH_PPC64 1191 #if V8_TARGET_ARCH_PPC64
1192 case kPPC_DoubleToUint64: { 1192 case kPPC_DoubleToUint64: {
1193 bool check_conversion = (i.OutputCount() > 1); 1193 bool check_conversion = (i.OutputCount() > 1);
1194 Label done;
1194 if (check_conversion) { 1195 if (check_conversion) {
1196 // Set 2nd output to zero if conversion fails.
1197 // We must check explicitly for negative values here since the
1198 // conversion instruction rounds the input toward zero before
1199 // checking for validity (otherwise, values between -1 and 0
1200 // would produce incorrect results).
1201 __ li(i.OutputRegister(1), Operand::Zero());
1202 __ fcmpu(i.InputDoubleRegister(0), kDoubleRegZero);
1203 __ blt(&done);
1195 __ mtfsb0(VXCVI); // clear FPSCR:VXCVI bit 1204 __ mtfsb0(VXCVI); // clear FPSCR:VXCVI bit
1196 } 1205 }
1197 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0), 1206 __ ConvertDoubleToUnsignedInt64(i.InputDoubleRegister(0),
1198 i.OutputRegister(0), kScratchDoubleReg); 1207 i.OutputRegister(0), kScratchDoubleReg);
1199 if (check_conversion) { 1208 if (check_conversion) {
1200 // Set 2nd output to zero if conversion fails.
1201 CRBit crbit = static_cast<CRBit>(VXCVI % CRWIDTH); 1209 CRBit crbit = static_cast<CRBit>(VXCVI % CRWIDTH);
1202 __ mcrfs(cr7, VXCVI); // extract FPSCR field containing VXCVI into cr7 1210 __ mcrfs(cr7, VXCVI); // extract FPSCR field containing VXCVI into cr7
1203 __ li(i.OutputRegister(1), Operand(1)); 1211 __ li(i.OutputRegister(1), Operand(1));
1204 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1), 1212 __ isel(i.OutputRegister(1), r0, i.OutputRegister(1),
1205 v8::internal::Assembler::encode_crbit(cr7, crbit)); 1213 v8::internal::Assembler::encode_crbit(cr7, crbit));
1214 __ bind(&done);
1206 } 1215 }
1207 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 1216 DCHECK_EQ(LeaveRC, i.OutputRCBit());
1208 break; 1217 break;
1209 } 1218 }
1210 #endif 1219 #endif
1211 case kPPC_DoubleToFloat32: 1220 case kPPC_DoubleToFloat32:
1212 ASSEMBLE_FLOAT_UNOP_RC(frsp); 1221 ASSEMBLE_FLOAT_UNOP_RC(frsp);
1213 break; 1222 break;
1214 case kPPC_Float32ToDouble: 1223 case kPPC_Float32ToDouble:
1215 // Nothing to do. 1224 // Nothing to do.
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 padding_size -= v8::internal::Assembler::kInstrSize; 1815 padding_size -= v8::internal::Assembler::kInstrSize;
1807 } 1816 }
1808 } 1817 }
1809 } 1818 }
1810 1819
1811 #undef __ 1820 #undef __
1812 1821
1813 } // namespace compiler 1822 } // namespace compiler
1814 } // namespace internal 1823 } // namespace internal
1815 } // namespace v8 1824 } // 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