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

Unified Diff: src/compiler/machine-operator.h

Issue 2045943002: [compiler] [wasm] Introduce Word32/64ReverseBytes as TF Optional Opcode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use ByteReverse in simulator Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/int64-lowering.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator.h
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h
index e9045d114499ef3e45b9dba8e439105ecfe4a688..32791ac7764fce02b4fcafce278d1fec773d8958 100644
--- a/src/compiler/machine-operator.h
+++ b/src/compiler/machine-operator.h
@@ -121,13 +121,17 @@ class MachineOperatorBuilder final : public ZoneObject {
kWord64ReverseBits = 1u << 21,
kFloat32Neg = 1u << 22,
kFloat64Neg = 1u << 23,
+ kWord16ReverseBytes = 1u << 24,
+ kWord32ReverseBytes = 1u << 25,
+ kWord64ReverseBytes = 1u << 26,
kAllOptionalOps =
kFloat32Max | kFloat32Min | kFloat64Max | kFloat64Min |
kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp |
kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate |
kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven |
kWord32Ctz | kWord64Ctz | kWord32Popcnt | kWord64Popcnt |
- kWord32ReverseBits | kWord64ReverseBits | kFloat32Neg | kFloat64Neg
+ kWord32ReverseBits | kWord64ReverseBits | kFloat32Neg | kFloat64Neg |
+ kWord16ReverseBytes | kWord32ReverseBytes | kWord64ReverseBytes
};
typedef base::Flags<Flag, unsigned> Flags;
@@ -217,6 +221,9 @@ class MachineOperatorBuilder final : public ZoneObject {
const OptionalOperator Word64Popcnt();
const OptionalOperator Word32ReverseBits();
const OptionalOperator Word64ReverseBits();
+ const OptionalOperator Word16ReverseBytes();
+ const OptionalOperator Word32ReverseBytes();
+ const OptionalOperator Word64ReverseBytes();
bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; }
const Operator* Word64And();
@@ -620,6 +627,7 @@ class MachineOperatorBuilder final : public ZoneObject {
const Operator* AtomicStore(MachineRepresentation rep);
// Target machine word-size assumed by this builder.
+ bool Is16() const { return word() == MachineRepresentation::kWord16; }
ahaas 2016/07/27 01:31:15 The introduction of Is16() worries me. Is a word s
john.yan 2016/07/27 18:18:19 Ok, I agree. Word16ReverseBytes Opcode is now remo
bool Is32() const { return word() == MachineRepresentation::kWord32; }
bool Is64() const { return word() == MachineRepresentation::kWord64; }
MachineRepresentation word() const { return word_; }
@@ -636,6 +644,17 @@ class MachineOperatorBuilder final : public ZoneObject {
alignment);
}
+ bool ReverseBytesSupported(const MachineType& machineType) {
ahaas 2016/07/27 01:31:15 Why is the machineType passed in if it is not used
john.yan 2016/07/27 18:18:19 Thanks for pointing out. This is my mistake.
+ if (Is16())
+ return Word16ReverseBytes().IsSupported();
+ else if (Is32())
+ return Word32ReverseBytes().IsSupported();
+ else if (Is64())
+ return Word64ReverseBytes().IsSupported();
+ else
+ return false;
+ }
+
// Pseudo operators that translate to 32/64-bit operators depending on the
// word-size of the target machine assumed by this builder.
#define PSEUDO_OP_LIST(V) \
« no previous file with comments | « src/compiler/int64-lowering.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698