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

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

Issue 2252863003: [turbofan] Add Float32(Max|Min) machine operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Type is number now. Created 4 years, 4 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 | « src/compiler/wasm-compiler.cc ('k') | src/compiler/x64/instruction-codes-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 __ j(parity_even, &mod_loop); 1290 __ j(parity_even, &mod_loop);
1291 // Move output to stack and clean up. 1291 // Move output to stack and clean up.
1292 __ fstp(1); 1292 __ fstp(1);
1293 __ fstp_d(Operand(rsp, 0)); 1293 __ fstp_d(Operand(rsp, 0));
1294 __ Movsd(i.OutputDoubleRegister(), Operand(rsp, 0)); 1294 __ Movsd(i.OutputDoubleRegister(), Operand(rsp, 0));
1295 __ addq(rsp, Immediate(kDoubleSize)); 1295 __ addq(rsp, Immediate(kDoubleSize));
1296 unwinding_info_writer_.MaybeIncreaseBaseOffsetAt(__ pc_offset(), 1296 unwinding_info_writer_.MaybeIncreaseBaseOffsetAt(__ pc_offset(),
1297 -kDoubleSize); 1297 -kDoubleSize);
1298 break; 1298 break;
1299 } 1299 }
1300 case kSSEFloat32Max: {
1301 Label compare_nan, compare_swap, done_compare;
1302 if (instr->InputAt(1)->IsFPRegister()) {
1303 __ Ucomiss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1304 } else {
1305 __ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
1306 }
1307 auto ool =
1308 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1309 __ j(parity_even, ool->entry());
1310 __ j(above, &done_compare, Label::kNear);
1311 __ j(below, &compare_swap, Label::kNear);
1312 __ Movmskps(kScratchRegister, i.InputDoubleRegister(0));
1313 __ testl(kScratchRegister, Immediate(1));
1314 __ j(zero, &done_compare, Label::kNear);
1315 __ bind(&compare_swap);
1316 if (instr->InputAt(1)->IsFPRegister()) {
1317 __ Movss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1318 } else {
1319 __ Movss(i.InputDoubleRegister(0), i.InputOperand(1));
1320 }
1321 __ bind(&done_compare);
1322 __ bind(ool->exit());
1323 break;
1324 }
1325 case kSSEFloat32Min: {
1326 Label compare_swap, done_compare;
1327 if (instr->InputAt(1)->IsFPRegister()) {
1328 __ Ucomiss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1329 } else {
1330 __ Ucomiss(i.InputDoubleRegister(0), i.InputOperand(1));
1331 }
1332 auto ool =
1333 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1334 __ j(parity_even, ool->entry());
1335 __ j(below, &done_compare, Label::kNear);
1336 __ j(above, &compare_swap, Label::kNear);
1337 if (instr->InputAt(1)->IsFPRegister()) {
1338 __ Movmskps(kScratchRegister, i.InputDoubleRegister(1));
1339 } else {
1340 __ Movss(kScratchDoubleReg, i.InputOperand(1));
1341 __ Movmskps(kScratchRegister, kScratchDoubleReg);
1342 }
1343 __ testl(kScratchRegister, Immediate(1));
1344 __ j(zero, &done_compare, Label::kNear);
1345 __ bind(&compare_swap);
1346 if (instr->InputAt(1)->IsFPRegister()) {
1347 __ Movss(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1348 } else {
1349 __ Movss(i.InputDoubleRegister(0), i.InputOperand(1));
1350 }
1351 __ bind(&done_compare);
1352 __ bind(ool->exit());
1353 break;
1354 }
1300 case kSSEFloat64Max: { 1355 case kSSEFloat64Max: {
1301 Label compare_nan, compare_swap, done_compare; 1356 Label compare_nan, compare_swap, done_compare;
1302 if (instr->InputAt(1)->IsFPRegister()) { 1357 if (instr->InputAt(1)->IsFPRegister()) {
1303 __ Ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); 1358 __ Ucomisd(i.InputDoubleRegister(0), i.InputDoubleRegister(1));
1304 } else { 1359 } else {
1305 __ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); 1360 __ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
1306 } 1361 }
1307 auto ool = 1362 auto ool =
1308 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); 1363 new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister());
1309 __ j(parity_even, ool->entry()); 1364 __ j(parity_even, ool->entry());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2661 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2607 __ Nop(padding_size); 2662 __ Nop(padding_size);
2608 } 2663 }
2609 } 2664 }
2610 2665
2611 #undef __ 2666 #undef __
2612 2667
2613 } // namespace compiler 2668 } // namespace compiler
2614 } // namespace internal 2669 } // namespace internal
2615 } // namespace v8 2670 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/compiler/x64/instruction-codes-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698