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

Side by Side Diff: src/crankshaft/ppc/lithium-codegen-ppc.cc

Issue 1698903002: PPC: [crankshaft] Fix Math.min(0, 0) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | 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 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/crankshaft/ppc/lithium-codegen-ppc.h" 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/crankshaft/hydrogen-osr.h" 10 #include "src/crankshaft/hydrogen-osr.h"
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 __ bunordered(&check_nan_left); 1953 __ bunordered(&check_nan_left);
1954 __ beq(&check_zero); 1954 __ beq(&check_zero);
1955 __ b(cond, &return_left); 1955 __ b(cond, &return_left);
1956 __ b(&return_right); 1956 __ b(&return_right);
1957 1957
1958 __ bind(&check_zero); 1958 __ bind(&check_zero);
1959 __ fcmpu(left_reg, kDoubleRegZero); 1959 __ fcmpu(left_reg, kDoubleRegZero);
1960 __ bne(&return_left); // left == right != 0. 1960 __ bne(&return_left); // left == right != 0.
1961 1961
1962 // At this point, both left and right are either 0 or -0. 1962 // At this point, both left and right are either 0 or -0.
1963 // N.B. The following works because +0 + -0 == +0
1964 if (operation == HMathMinMax::kMathMin) { 1963 if (operation == HMathMinMax::kMathMin) {
1965 // For min we want logical-or of sign bit: -(-L + -R) 1964 // Min: The algorithm is: -((-L) + (-R)), which in case of L and R being
1965 // different registers is most efficiently expressed as -((-L) - R).
1966 __ fneg(left_reg, left_reg); 1966 __ fneg(left_reg, left_reg);
1967 __ fsub(result_reg, left_reg, right_reg); 1967 if (left_reg.is(right_reg)) {
1968 __ fadd(result_reg, left_reg, right_reg);
1969 } else {
1970 __ fsub(result_reg, left_reg, right_reg);
1971 }
1968 __ fneg(result_reg, result_reg); 1972 __ fneg(result_reg, result_reg);
1969 } else { 1973 } else {
1970 // For max we want logical-and of sign bit: (L + R) 1974 // Max: The following works because +0 + -0 == +0
1971 __ fadd(result_reg, left_reg, right_reg); 1975 __ fadd(result_reg, left_reg, right_reg);
1972 } 1976 }
1973 __ b(&done); 1977 __ b(&done);
1974 1978
1975 __ bind(&check_nan_left); 1979 __ bind(&check_nan_left);
1976 __ fcmpu(left_reg, left_reg); 1980 __ fcmpu(left_reg, left_reg);
1977 __ bunordered(&return_left); // left == NaN. 1981 __ bunordered(&return_left); // left == NaN.
1978 1982
1979 __ bind(&return_right); 1983 __ bind(&return_right);
1980 if (!right_reg.is(result_reg)) { 1984 if (!right_reg.is(result_reg)) {
(...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after
5778 __ Push(scope_info); 5782 __ Push(scope_info);
5779 __ push(ToRegister(instr->function())); 5783 __ push(ToRegister(instr->function()));
5780 CallRuntime(Runtime::kPushBlockContext, instr); 5784 CallRuntime(Runtime::kPushBlockContext, instr);
5781 RecordSafepoint(Safepoint::kNoLazyDeopt); 5785 RecordSafepoint(Safepoint::kNoLazyDeopt);
5782 } 5786 }
5783 5787
5784 5788
5785 #undef __ 5789 #undef __
5786 } // namespace internal 5790 } // namespace internal
5787 } // namespace v8 5791 } // 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