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/compiler/machine-operator-reducer.h" | 5 #include "src/compiler/machine-operator-reducer.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler/diamond.h" | 10 #include "src/compiler/diamond.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); | 427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); |
428 break; | 428 break; |
429 } | 429 } |
430 case IrOpcode::kTruncateFloat64ToFloat32: { | 430 case IrOpcode::kTruncateFloat64ToFloat32: { |
431 Float64Matcher m(node->InputAt(0)); | 431 Float64Matcher m(node->InputAt(0)); |
432 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); | 432 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); |
433 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); | 433 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); |
434 break; | 434 break; |
435 } | 435 } |
| 436 case IrOpcode::kFloat64InsertLowWord32: |
| 437 return ReduceFloat64InsertLowWord32(node); |
| 438 case IrOpcode::kFloat64InsertHighWord32: |
| 439 return ReduceFloat64InsertHighWord32(node); |
436 case IrOpcode::kStore: | 440 case IrOpcode::kStore: |
437 return ReduceStore(node); | 441 return ReduceStore(node); |
438 default: | 442 default: |
439 break; | 443 break; |
440 } | 444 } |
441 return NoChange(); | 445 return NoChange(); |
442 } | 446 } |
443 | 447 |
444 | 448 |
445 Reduction MachineOperatorReducer::ReduceInt32Add(Node* node) { | 449 Reduction MachineOperatorReducer::ReduceInt32Add(Node* node) { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 if (!msub.left().Is(32) || msub.right().node() != y) return NoChange(); | 972 if (!msub.left().Is(32) || msub.right().node() != y) return NoChange(); |
969 } | 973 } |
970 | 974 |
971 node->set_op(machine()->Word32Ror()); | 975 node->set_op(machine()->Word32Ror()); |
972 node->ReplaceInput(0, mshl.left().node()); | 976 node->ReplaceInput(0, mshl.left().node()); |
973 node->ReplaceInput(1, mshr.right().node()); | 977 node->ReplaceInput(1, mshr.right().node()); |
974 return Changed(node); | 978 return Changed(node); |
975 } | 979 } |
976 | 980 |
977 | 981 |
| 982 Reduction MachineOperatorReducer::ReduceFloat64InsertLowWord32(Node* node) { |
| 983 DCHECK_EQ(IrOpcode::kFloat64InsertLowWord32, node->opcode()); |
| 984 Float64Matcher mlhs(node->InputAt(0)); |
| 985 Uint32Matcher mrhs(node->InputAt(1)); |
| 986 if (mlhs.HasValue() && mrhs.HasValue()) { |
| 987 return ReplaceFloat64(bit_cast<double>( |
| 988 (bit_cast<uint64_t>(mlhs.Value()) & V8_UINT64_C(0xFFFFFFFF00000000)) | |
| 989 mrhs.Value())); |
| 990 } |
| 991 return NoChange(); |
| 992 } |
| 993 |
| 994 |
| 995 Reduction MachineOperatorReducer::ReduceFloat64InsertHighWord32(Node* node) { |
| 996 DCHECK_EQ(IrOpcode::kFloat64InsertHighWord32, node->opcode()); |
| 997 Float64Matcher mlhs(node->InputAt(0)); |
| 998 Uint32Matcher mrhs(node->InputAt(1)); |
| 999 if (mlhs.HasValue() && mrhs.HasValue()) { |
| 1000 return ReplaceFloat64(bit_cast<double>( |
| 1001 (bit_cast<uint64_t>(mlhs.Value()) & V8_UINT64_C(0xFFFFFFFF)) | |
| 1002 (static_cast<uint64_t>(mrhs.Value()) << 32))); |
| 1003 } |
| 1004 return NoChange(); |
| 1005 } |
| 1006 |
| 1007 |
978 CommonOperatorBuilder* MachineOperatorReducer::common() const { | 1008 CommonOperatorBuilder* MachineOperatorReducer::common() const { |
979 return jsgraph()->common(); | 1009 return jsgraph()->common(); |
980 } | 1010 } |
981 | 1011 |
982 | 1012 |
983 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1013 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
984 return jsgraph()->machine(); | 1014 return jsgraph()->machine(); |
985 } | 1015 } |
986 | 1016 |
987 | 1017 |
988 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1018 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
989 | 1019 |
990 } // namespace compiler | 1020 } // namespace compiler |
991 } // namespace internal | 1021 } // namespace internal |
992 } // namespace v8 | 1022 } // namespace v8 |
OLD | NEW |