Commit afec86ee authored by Nico Hartmann's avatar Nico Hartmann Committed by Commit Bot

[turbofan] Adds Word64 optimizations to MachineOperatorReducer

This CL adds optimizations for Word64And, Word64Or and Word64Xor
to the MachineOperatorReducer. Some of these (esp. constant folding)
have previously been removed from CodeAssembler to streamline
the optimization pipeline.

Bug: v8:10021
Change-Id: I679f0b60589a84b2d92ca6d9083efaddfe0b6423
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1997131
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65781}
parent 484e1952
This diff is collapsed.
...@@ -17,6 +17,8 @@ namespace compiler { ...@@ -17,6 +17,8 @@ namespace compiler {
// Forward declarations. // Forward declarations.
class CommonOperatorBuilder; class CommonOperatorBuilder;
class MachineGraph; class MachineGraph;
class Word32Adapter;
class Word64Adapter;
// Performs constant folding and strength reduction on nodes that have // Performs constant folding and strength reduction on nodes that have
// machine operators. // machine operators.
...@@ -32,6 +34,9 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final ...@@ -32,6 +34,9 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final
Reduction Reduce(Node* node) override; Reduction Reduce(Node* node) override;
private: private:
friend class Word32Adapter;
friend class Word64Adapter;
Node* Float32Constant(volatile float value); Node* Float32Constant(volatile float value);
Node* Float64Constant(volatile double value); Node* Float64Constant(volatile double value);
Node* Int32Constant(int32_t value); Node* Int32Constant(int32_t value);
...@@ -51,6 +56,7 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final ...@@ -51,6 +56,7 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final
Node* Word32Sar(Node* lhs, uint32_t rhs); Node* Word32Sar(Node* lhs, uint32_t rhs);
Node* Word32Shr(Node* lhs, uint32_t rhs); Node* Word32Shr(Node* lhs, uint32_t rhs);
Node* Word32Equal(Node* lhs, Node* rhs); Node* Word32Equal(Node* lhs, Node* rhs);
Node* Word64And(Node* lhs, Node* rhs);
Node* Int32Add(Node* lhs, Node* rhs); Node* Int32Add(Node* lhs, Node* rhs);
Node* Int32Sub(Node* lhs, Node* rhs); Node* Int32Sub(Node* lhs, Node* rhs);
Node* Int32Mul(Node* lhs, Node* rhs); Node* Int32Mul(Node* lhs, Node* rhs);
...@@ -93,9 +99,12 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final ...@@ -93,9 +99,12 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final
Reduction ReduceWord32Sar(Node* node); Reduction ReduceWord32Sar(Node* node);
Reduction ReduceWord64Sar(Node* node); Reduction ReduceWord64Sar(Node* node);
Reduction ReduceWord32And(Node* node); Reduction ReduceWord32And(Node* node);
Reduction ReduceWord64And(Node* node);
Reduction TryMatchWord32Ror(Node* node); Reduction TryMatchWord32Ror(Node* node);
Reduction ReduceWord32Or(Node* node); Reduction ReduceWord32Or(Node* node);
Reduction ReduceWord64Or(Node* node);
Reduction ReduceWord32Xor(Node* node); Reduction ReduceWord32Xor(Node* node);
Reduction ReduceWord64Xor(Node* node);
Reduction ReduceFloat64InsertLowWord32(Node* node); Reduction ReduceFloat64InsertLowWord32(Node* node);
Reduction ReduceFloat64InsertHighWord32(Node* node); Reduction ReduceFloat64InsertHighWord32(Node* node);
Reduction ReduceFloat64Compare(Node* node); Reduction ReduceFloat64Compare(Node* node);
...@@ -106,6 +115,15 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final ...@@ -106,6 +115,15 @@ class V8_EXPORT_PRIVATE MachineOperatorReducer final
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
MachineOperatorBuilder* machine() const; MachineOperatorBuilder* machine() const;
// These reductions can be applied to operations of different word sizes.
// Use Word32Adapter or Word64Adapter to specialize for a particular one.
template <typename WordNAdapter>
Reduction ReduceWordNAnd(Node* node);
template <typename WordNAdapter>
Reduction ReduceWordNOr(Node* node);
template <typename WordNAdapter>
Reduction ReduceWordNXor(Node* node);
MachineGraph* mcgraph_; MachineGraph* mcgraph_;
bool allow_signalling_nan_; bool allow_signalling_nan_;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment