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

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

Issue 2270193003: X87: [turbofan] Add Float32(Max|Min) machine operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/compiler/x87/instruction-codes-x87.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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 __ fstp(0); 1293 __ fstp(0);
1294 __ fld_d(MemOperand(eax, 0)); 1294 __ fld_d(MemOperand(eax, 0));
1295 __ fstp_d(Operand(esp, 1 * kDoubleSize)); 1295 __ fstp_d(Operand(esp, 1 * kDoubleSize));
1296 __ fld_d(MemOperand(eax, kDoubleSize)); 1296 __ fld_d(MemOperand(eax, kDoubleSize));
1297 __ fstp_d(Operand(esp, 0)); 1297 __ fstp_d(Operand(esp, 0));
1298 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), 1298 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()),
1299 4); 1299 4);
1300 __ lea(esp, Operand(esp, 2 * kDoubleSize)); 1300 __ lea(esp, Operand(esp, 2 * kDoubleSize));
1301 break; 1301 break;
1302 } 1302 }
1303 case kX87Float32Max: {
1304 Label compare_swap, done_compare;
1305 if (FLAG_debug_code && FLAG_enable_slow_asserts) {
1306 __ VerifyX87StackDepth(1);
1307 }
1308 __ fstp(0);
1309 __ fld_s(MemOperand(esp, kFloatSize));
1310 __ fld_s(MemOperand(esp, 0));
1311 __ fld(1);
1312 __ fld(1);
1313 __ FCmp();
1314
1315 auto ool =
1316 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1317 __ j(parity_even, ool->entry());
1318 __ j(below, &done_compare, Label::kNear);
1319 __ j(above, &compare_swap, Label::kNear);
1320 __ push(eax);
1321 __ lea(esp, Operand(esp, -kFloatSize));
1322 __ fld(1);
1323 __ fstp_s(Operand(esp, 0));
1324 __ mov(eax, MemOperand(esp, 0));
1325 __ and_(eax, Immediate(0x80000000));
1326 __ lea(esp, Operand(esp, kFloatSize));
1327 __ pop(eax);
1328 __ j(zero, &done_compare, Label::kNear);
1329
1330 __ bind(&compare_swap);
1331 __ bind(ool->exit());
1332 __ fxch(1);
1333
1334 __ bind(&done_compare);
1335 __ fstp(0);
1336 __ lea(esp, Operand(esp, 2 * kFloatSize));
1337 break;
1338 }
1303 case kX87Float64Max: { 1339 case kX87Float64Max: {
1304 Label compare_swap, done_compare; 1340 Label compare_swap, done_compare;
1305 if (FLAG_debug_code && FLAG_enable_slow_asserts) { 1341 if (FLAG_debug_code && FLAG_enable_slow_asserts) {
1306 __ VerifyX87StackDepth(1); 1342 __ VerifyX87StackDepth(1);
1307 } 1343 }
1308 __ fstp(0); 1344 __ fstp(0);
1309 __ fld_d(MemOperand(esp, kDoubleSize)); 1345 __ fld_d(MemOperand(esp, kDoubleSize));
1310 __ fld_d(MemOperand(esp, 0)); 1346 __ fld_d(MemOperand(esp, 0));
1311 __ fld(1); 1347 __ fld(1);
1312 __ fld(1); 1348 __ fld(1);
(...skipping 16 matching lines...) Expand all
1329 1365
1330 __ bind(&compare_swap); 1366 __ bind(&compare_swap);
1331 __ bind(ool->exit()); 1367 __ bind(ool->exit());
1332 __ fxch(1); 1368 __ fxch(1);
1333 1369
1334 __ bind(&done_compare); 1370 __ bind(&done_compare);
1335 __ fstp(0); 1371 __ fstp(0);
1336 __ lea(esp, Operand(esp, 2 * kDoubleSize)); 1372 __ lea(esp, Operand(esp, 2 * kDoubleSize));
1337 break; 1373 break;
1338 } 1374 }
1375 case kX87Float32Min: {
1376 Label compare_swap, done_compare;
1377 if (FLAG_debug_code && FLAG_enable_slow_asserts) {
1378 __ VerifyX87StackDepth(1);
1379 }
1380 __ fstp(0);
1381 __ fld_s(MemOperand(esp, kFloatSize));
1382 __ fld_s(MemOperand(esp, 0));
1383 __ fld(1);
1384 __ fld(1);
1385 __ FCmp();
1386
1387 auto ool =
1388 new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
1389 __ j(parity_even, ool->entry());
1390 __ j(above, &done_compare, Label::kNear);
1391 __ j(below, &compare_swap, Label::kNear);
1392 __ push(eax);
1393 __ lea(esp, Operand(esp, -kFloatSize));
1394 __ fld(0);
1395 __ fstp_s(Operand(esp, 0));
1396 __ mov(eax, MemOperand(esp, 0));
1397 __ and_(eax, Immediate(0x80000000));
1398 __ lea(esp, Operand(esp, kFloatSize));
1399 __ pop(eax);
1400 __ j(zero, &done_compare, Label::kNear);
1401
1402 __ bind(&compare_swap);
1403 __ bind(ool->exit());
1404 __ fxch(1);
1405
1406 __ bind(&done_compare);
1407 __ fstp(0);
1408 __ lea(esp, Operand(esp, 2 * kFloatSize));
1409 break;
1410 }
1339 case kX87Float64Min: { 1411 case kX87Float64Min: {
1340 Label compare_swap, done_compare; 1412 Label compare_swap, done_compare;
1341 if (FLAG_debug_code && FLAG_enable_slow_asserts) { 1413 if (FLAG_debug_code && FLAG_enable_slow_asserts) {
1342 __ VerifyX87StackDepth(1); 1414 __ VerifyX87StackDepth(1);
1343 } 1415 }
1344 __ fstp(0); 1416 __ fstp(0);
1345 __ fld_d(MemOperand(esp, kDoubleSize)); 1417 __ fld_d(MemOperand(esp, kDoubleSize));
1346 __ fld_d(MemOperand(esp, 0)); 1418 __ fld_d(MemOperand(esp, 0));
1347 __ fld(1); 1419 __ fld(1);
1348 __ fld(1); 1420 __ fld(1);
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2727 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2656 __ Nop(padding_size); 2728 __ Nop(padding_size);
2657 } 2729 }
2658 } 2730 }
2659 2731
2660 #undef __ 2732 #undef __
2661 2733
2662 } // namespace compiler 2734 } // namespace compiler
2663 } // namespace internal 2735 } // namespace internal
2664 } // namespace v8 2736 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x87/instruction-codes-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698