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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/x87/instruction-codes-x87.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x87/code-generator-x87.cc
diff --git a/src/compiler/x87/code-generator-x87.cc b/src/compiler/x87/code-generator-x87.cc
index 976cd0ac426e182ffb1b025e87fad3a79496c38e..1064e622eb8f05d39c0525462083fc6e13b89ed2 100644
--- a/src/compiler/x87/code-generator-x87.cc
+++ b/src/compiler/x87/code-generator-x87.cc
@@ -1300,6 +1300,42 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ lea(esp, Operand(esp, 2 * kDoubleSize));
break;
}
+ case kX87Float32Max: {
+ Label compare_swap, done_compare;
+ if (FLAG_debug_code && FLAG_enable_slow_asserts) {
+ __ VerifyX87StackDepth(1);
+ }
+ __ fstp(0);
+ __ fld_s(MemOperand(esp, kFloatSize));
+ __ fld_s(MemOperand(esp, 0));
+ __ fld(1);
+ __ fld(1);
+ __ FCmp();
+
+ auto ool =
+ new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
+ __ j(parity_even, ool->entry());
+ __ j(below, &done_compare, Label::kNear);
+ __ j(above, &compare_swap, Label::kNear);
+ __ push(eax);
+ __ lea(esp, Operand(esp, -kFloatSize));
+ __ fld(1);
+ __ fstp_s(Operand(esp, 0));
+ __ mov(eax, MemOperand(esp, 0));
+ __ and_(eax, Immediate(0x80000000));
+ __ lea(esp, Operand(esp, kFloatSize));
+ __ pop(eax);
+ __ j(zero, &done_compare, Label::kNear);
+
+ __ bind(&compare_swap);
+ __ bind(ool->exit());
+ __ fxch(1);
+
+ __ bind(&done_compare);
+ __ fstp(0);
+ __ lea(esp, Operand(esp, 2 * kFloatSize));
+ break;
+ }
case kX87Float64Max: {
Label compare_swap, done_compare;
if (FLAG_debug_code && FLAG_enable_slow_asserts) {
@@ -1336,6 +1372,42 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ lea(esp, Operand(esp, 2 * kDoubleSize));
break;
}
+ case kX87Float32Min: {
+ Label compare_swap, done_compare;
+ if (FLAG_debug_code && FLAG_enable_slow_asserts) {
+ __ VerifyX87StackDepth(1);
+ }
+ __ fstp(0);
+ __ fld_s(MemOperand(esp, kFloatSize));
+ __ fld_s(MemOperand(esp, 0));
+ __ fld(1);
+ __ fld(1);
+ __ FCmp();
+
+ auto ool =
+ new (zone()) OutOfLineLoadFloat32NaN(this, i.OutputDoubleRegister());
+ __ j(parity_even, ool->entry());
+ __ j(above, &done_compare, Label::kNear);
+ __ j(below, &compare_swap, Label::kNear);
+ __ push(eax);
+ __ lea(esp, Operand(esp, -kFloatSize));
+ __ fld(0);
+ __ fstp_s(Operand(esp, 0));
+ __ mov(eax, MemOperand(esp, 0));
+ __ and_(eax, Immediate(0x80000000));
+ __ lea(esp, Operand(esp, kFloatSize));
+ __ pop(eax);
+ __ j(zero, &done_compare, Label::kNear);
+
+ __ bind(&compare_swap);
+ __ bind(ool->exit());
+ __ fxch(1);
+
+ __ bind(&done_compare);
+ __ fstp(0);
+ __ lea(esp, Operand(esp, 2 * kFloatSize));
+ break;
+ }
case kX87Float64Min: {
Label compare_swap, done_compare;
if (FLAG_debug_code && FLAG_enable_slow_asserts) {
« 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