OLD | NEW |
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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 // Shared routine for multiple word compare operations. | 1934 // Shared routine for multiple word compare operations. |
1935 void VisitWordCompare(InstructionSelector* selector, Node* node, | 1935 void VisitWordCompare(InstructionSelector* selector, Node* node, |
1936 InstructionCode opcode, FlagsContinuation* cont, | 1936 InstructionCode opcode, FlagsContinuation* cont, |
1937 bool commutative) { | 1937 bool commutative) { |
1938 Mips64OperandGenerator g(selector); | 1938 Mips64OperandGenerator g(selector); |
1939 Node* left = node->InputAt(0); | 1939 Node* left = node->InputAt(0); |
1940 Node* right = node->InputAt(1); | 1940 Node* right = node->InputAt(1); |
1941 | 1941 |
1942 // Match immediates on left or right side of comparison. | 1942 // Match immediates on left or right side of comparison. |
1943 if (g.CanBeImmediate(right, opcode)) { | 1943 if (g.CanBeImmediate(right, opcode)) { |
1944 switch (cont->condition()) { | 1944 if (opcode == kMips64Tst) { |
1945 case kEqual: | 1945 VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right), |
1946 case kNotEqual: | 1946 cont); |
1947 if (cont->IsSet()) { | 1947 } else { |
| 1948 switch (cont->condition()) { |
| 1949 case kEqual: |
| 1950 case kNotEqual: |
| 1951 if (cont->IsSet()) { |
| 1952 VisitCompare(selector, opcode, g.UseRegister(left), |
| 1953 g.UseImmediate(right), cont); |
| 1954 } else { |
| 1955 VisitCompare(selector, opcode, g.UseRegister(left), |
| 1956 g.UseRegister(right), cont); |
| 1957 } |
| 1958 break; |
| 1959 case kSignedLessThan: |
| 1960 case kSignedGreaterThanOrEqual: |
| 1961 case kUnsignedLessThan: |
| 1962 case kUnsignedGreaterThanOrEqual: |
1948 VisitCompare(selector, opcode, g.UseRegister(left), | 1963 VisitCompare(selector, opcode, g.UseRegister(left), |
1949 g.UseImmediate(right), cont); | 1964 g.UseImmediate(right), cont); |
1950 } else { | 1965 break; |
| 1966 default: |
1951 VisitCompare(selector, opcode, g.UseRegister(left), | 1967 VisitCompare(selector, opcode, g.UseRegister(left), |
1952 g.UseRegister(right), cont); | 1968 g.UseRegister(right), cont); |
1953 } | 1969 } |
1954 break; | |
1955 case kSignedLessThan: | |
1956 case kSignedGreaterThanOrEqual: | |
1957 case kUnsignedLessThan: | |
1958 case kUnsignedGreaterThanOrEqual: | |
1959 VisitCompare(selector, opcode, g.UseRegister(left), | |
1960 g.UseImmediate(right), cont); | |
1961 break; | |
1962 default: | |
1963 VisitCompare(selector, opcode, g.UseRegister(left), | |
1964 g.UseRegister(right), cont); | |
1965 } | 1970 } |
1966 } else if (g.CanBeImmediate(left, opcode)) { | 1971 } else if (g.CanBeImmediate(left, opcode)) { |
1967 if (!commutative) cont->Commute(); | 1972 if (!commutative) cont->Commute(); |
1968 switch (cont->condition()) { | 1973 if (opcode == kMips64Tst) { |
1969 case kEqual: | 1974 VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left), |
1970 case kNotEqual: | 1975 cont); |
1971 if (cont->IsSet()) { | 1976 } else { |
| 1977 switch (cont->condition()) { |
| 1978 case kEqual: |
| 1979 case kNotEqual: |
| 1980 if (cont->IsSet()) { |
| 1981 VisitCompare(selector, opcode, g.UseRegister(right), |
| 1982 g.UseImmediate(left), cont); |
| 1983 } else { |
| 1984 VisitCompare(selector, opcode, g.UseRegister(right), |
| 1985 g.UseRegister(left), cont); |
| 1986 } |
| 1987 break; |
| 1988 case kSignedLessThan: |
| 1989 case kSignedGreaterThanOrEqual: |
| 1990 case kUnsignedLessThan: |
| 1991 case kUnsignedGreaterThanOrEqual: |
1972 VisitCompare(selector, opcode, g.UseRegister(right), | 1992 VisitCompare(selector, opcode, g.UseRegister(right), |
1973 g.UseImmediate(left), cont); | 1993 g.UseImmediate(left), cont); |
1974 } else { | 1994 break; |
| 1995 default: |
1975 VisitCompare(selector, opcode, g.UseRegister(right), | 1996 VisitCompare(selector, opcode, g.UseRegister(right), |
1976 g.UseRegister(left), cont); | 1997 g.UseRegister(left), cont); |
1977 } | 1998 } |
1978 break; | |
1979 case kSignedLessThan: | |
1980 case kSignedGreaterThanOrEqual: | |
1981 case kUnsignedLessThan: | |
1982 case kUnsignedGreaterThanOrEqual: | |
1983 VisitCompare(selector, opcode, g.UseRegister(right), | |
1984 g.UseImmediate(left), cont); | |
1985 break; | |
1986 default: | |
1987 VisitCompare(selector, opcode, g.UseRegister(right), | |
1988 g.UseRegister(left), cont); | |
1989 } | 1999 } |
1990 } else { | 2000 } else { |
1991 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), | 2001 VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), |
1992 cont); | 2002 cont); |
1993 } | 2003 } |
1994 } | 2004 } |
1995 | 2005 |
1996 bool IsNodeUnsigned(Node* n) { | 2006 bool IsNodeUnsigned(Node* n) { |
1997 NodeMatcher m(n); | 2007 NodeMatcher m(n); |
1998 | 2008 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 } else { | 2571 } else { |
2562 DCHECK(kArchVariant == kMips64r2); | 2572 DCHECK(kArchVariant == kMips64r2); |
2563 return MachineOperatorBuilder::AlignmentRequirements:: | 2573 return MachineOperatorBuilder::AlignmentRequirements:: |
2564 NoUnalignedAccessSupport(); | 2574 NoUnalignedAccessSupport(); |
2565 } | 2575 } |
2566 } | 2576 } |
2567 | 2577 |
2568 } // namespace compiler | 2578 } // namespace compiler |
2569 } // namespace internal | 2579 } // namespace internal |
2570 } // namespace v8 | 2580 } // namespace v8 |
OLD | NEW |