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

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

Issue 1522333002: X87: [TurboFan] Change the implementation of Float32's NaN comparision's return value in kX87Float3… (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 | no next file » | 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 737 }
738 case kX87Float32Max: { 738 case kX87Float32Max: {
739 Label check_nan_left, check_zero, return_left, return_right; 739 Label check_nan_left, check_zero, return_left, return_right;
740 Condition condition = below; 740 Condition condition = below;
741 __ fstp(0); 741 __ fstp(0);
742 __ fld_s(MemOperand(esp, kFloatSize)); 742 __ fld_s(MemOperand(esp, kFloatSize));
743 __ fld_s(MemOperand(esp, 0)); 743 __ fld_s(MemOperand(esp, 0));
744 __ fld(1); 744 __ fld(1);
745 __ fld(1); 745 __ fld(1);
746 __ FCmp(); 746 __ FCmp();
747 __ j(parity_even, &check_nan_left, Label::kNear); // At least one NaN. 747
748 // At least one NaN.
749 // Return the second operands if one of the two operands is NaN
750 __ j(parity_even, &return_right, Label::kNear);
748 __ j(equal, &check_zero, Label::kNear); // left == right. 751 __ j(equal, &check_zero, Label::kNear); // left == right.
749 __ j(condition, &return_left, Label::kNear); 752 __ j(condition, &return_left, Label::kNear);
750 __ jmp(&return_right, Label::kNear); 753 __ jmp(&return_right, Label::kNear);
751 754
752 __ bind(&check_zero); 755 __ bind(&check_zero);
753 __ fld(0); 756 __ fld(0);
754 __ fldz(); 757 __ fldz();
755 __ FCmp(); 758 __ FCmp();
756 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. 759 __ j(not_equal, &return_left, Label::kNear); // left == right != 0.
757 760
758 __ fadd(1); 761 __ fadd(1);
759 __ jmp(&return_left, Label::kNear); 762 __ jmp(&return_left, Label::kNear);
760 763
761 __ bind(&check_nan_left);
762 __ fld(0);
763 __ fld(0);
764 __ FCmp(); // NaN check.
765 __ j(parity_even, &return_left, Label::kNear); // left == NaN.
766
767 __ bind(&return_right); 764 __ bind(&return_right);
768 __ fxch(); 765 __ fxch();
769 766
770 __ bind(&return_left); 767 __ bind(&return_left);
771 __ fstp(0); 768 __ fstp(0);
772 __ lea(esp, Operand(esp, 2 * kFloatSize)); 769 __ lea(esp, Operand(esp, 2 * kFloatSize));
773 break; 770 break;
774 } 771 }
775 case kX87Float32Min: { 772 case kX87Float32Min: {
776 Label check_nan_left, check_zero, return_left, return_right; 773 Label check_nan_left, check_zero, return_left, return_right;
777 Condition condition = above; 774 Condition condition = above;
778 __ fstp(0); 775 __ fstp(0);
779 __ fld_s(MemOperand(esp, kFloatSize)); 776 __ fld_s(MemOperand(esp, kFloatSize));
780 __ fld_s(MemOperand(esp, 0)); 777 __ fld_s(MemOperand(esp, 0));
781 __ fld(1); 778 __ fld(1);
782 __ fld(1); 779 __ fld(1);
783 __ FCmp(); 780 __ FCmp();
784 __ j(parity_even, &check_nan_left, Label::kNear); // At least one NaN. 781 // At least one NaN.
782 // Return the second operands if one of the two operands is NaN
783 __ j(parity_even, &return_right, Label::kNear);
785 __ j(equal, &check_zero, Label::kNear); // left == right. 784 __ j(equal, &check_zero, Label::kNear); // left == right.
786 __ j(condition, &return_left, Label::kNear); 785 __ j(condition, &return_left, Label::kNear);
787 __ jmp(&return_right, Label::kNear); 786 __ jmp(&return_right, Label::kNear);
788 787
789 __ bind(&check_zero); 788 __ bind(&check_zero);
790 __ fld(0); 789 __ fld(0);
791 __ fldz(); 790 __ fldz();
792 __ FCmp(); 791 __ FCmp();
793 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. 792 __ j(not_equal, &return_left, Label::kNear); // left == right != 0.
794 // At this point, both left and right are either 0 or -0. 793 // At this point, both left and right are either 0 or -0.
795 // Push st0 and st1 to stack, then pop them to temp registers and OR them, 794 // Push st0 and st1 to stack, then pop them to temp registers and OR them,
796 // load it to left. 795 // load it to left.
797 __ push(eax); 796 __ push(eax);
798 __ fld(1); 797 __ fld(1);
799 __ fld(1); 798 __ fld(1);
800 __ sub(esp, Immediate(2 * kPointerSize)); 799 __ sub(esp, Immediate(2 * kPointerSize));
801 __ fstp_s(MemOperand(esp, 0)); 800 __ fstp_s(MemOperand(esp, 0));
802 __ fstp_s(MemOperand(esp, kPointerSize)); 801 __ fstp_s(MemOperand(esp, kPointerSize));
803 __ pop(eax); 802 __ pop(eax);
804 __ xor_(MemOperand(esp, 0), eax); 803 __ xor_(MemOperand(esp, 0), eax);
805 __ fstp(0); 804 __ fstp(0);
806 __ fld_s(MemOperand(esp, 0)); 805 __ fld_s(MemOperand(esp, 0));
807 __ pop(eax); // restore esp 806 __ pop(eax); // restore esp
808 __ pop(eax); // restore esp 807 __ pop(eax); // restore esp
809 __ jmp(&return_left, Label::kNear); 808 __ jmp(&return_left, Label::kNear);
810 809
811 __ bind(&check_nan_left);
812 __ fld(0);
813 __ fld(0);
814 __ FCmp(); // NaN check.
815 __ j(parity_even, &return_left, Label::kNear); // left == NaN.
816 810
817 __ bind(&return_right); 811 __ bind(&return_right);
818 __ fxch(); 812 __ fxch();
819 813
820 __ bind(&return_left); 814 __ bind(&return_left);
821 __ fstp(0); 815 __ fstp(0);
822 __ lea(esp, Operand(esp, 2 * kFloatSize)); 816 __ lea(esp, Operand(esp, 2 * kFloatSize));
823 break; 817 break;
824 } 818 }
825 case kX87Float32Sqrt: { 819 case kX87Float32Sqrt: {
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2001 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2008 __ Nop(padding_size); 2002 __ Nop(padding_size);
2009 } 2003 }
2010 } 2004 }
2011 2005
2012 #undef __ 2006 #undef __
2013 2007
2014 } // namespace compiler 2008 } // namespace compiler
2015 } // namespace internal 2009 } // namespace internal
2016 } // namespace v8 2010 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698