11cb0ef41Sopenharmony_ci// Copyright 2013 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_COMPILER_MACHINE_OPERATOR_H_
61cb0ef41Sopenharmony_ci#define V8_COMPILER_MACHINE_OPERATOR_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/base/compiler-specific.h"
91cb0ef41Sopenharmony_ci#include "src/base/enum-set.h"
101cb0ef41Sopenharmony_ci#include "src/base/flags.h"
111cb0ef41Sopenharmony_ci#include "src/codegen/atomic-memory-order.h"
121cb0ef41Sopenharmony_ci#include "src/codegen/machine-type.h"
131cb0ef41Sopenharmony_ci#include "src/compiler/globals.h"
141cb0ef41Sopenharmony_ci#include "src/compiler/write-barrier-kind.h"
151cb0ef41Sopenharmony_ci#include "src/zone/zone.h"
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cinamespace v8 {
181cb0ef41Sopenharmony_cinamespace internal {
191cb0ef41Sopenharmony_cinamespace compiler {
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci// Forward declarations.
221cb0ef41Sopenharmony_cistruct MachineOperatorGlobalCache;
231cb0ef41Sopenharmony_ciclass Operator;
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci// For operators that are not supported on all platforms.
271cb0ef41Sopenharmony_ciclass OptionalOperator final {
281cb0ef41Sopenharmony_ci public:
291cb0ef41Sopenharmony_ci  OptionalOperator(bool supported, const Operator* op)
301cb0ef41Sopenharmony_ci      : supported_(supported), op_(op) {}
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  bool IsSupported() const { return supported_; }
331cb0ef41Sopenharmony_ci  // Gets the operator only if it is supported.
341cb0ef41Sopenharmony_ci  const Operator* op() const {
351cb0ef41Sopenharmony_ci    DCHECK(supported_);
361cb0ef41Sopenharmony_ci    return op_;
371cb0ef41Sopenharmony_ci  }
381cb0ef41Sopenharmony_ci  // Always gets the operator, even for unsupported operators. This is useful to
391cb0ef41Sopenharmony_ci  // use the operator as a placeholder in a graph, for instance.
401cb0ef41Sopenharmony_ci  const Operator* placeholder() const { return op_; }
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci private:
431cb0ef41Sopenharmony_ci  bool supported_;
441cb0ef41Sopenharmony_ci  const Operator* const op_;
451cb0ef41Sopenharmony_ci};
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci// A Load needs a MachineType.
491cb0ef41Sopenharmony_ciusing LoadRepresentation = MachineType;
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE LoadRepresentation LoadRepresentationOf(Operator const*)
521cb0ef41Sopenharmony_ci    V8_WARN_UNUSED_RESULT;
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci// A Word(32|64)AtomicLoad needs both a LoadRepresentation and a memory
551cb0ef41Sopenharmony_ci// order.
561cb0ef41Sopenharmony_ciclass AtomicLoadParameters final {
571cb0ef41Sopenharmony_ci public:
581cb0ef41Sopenharmony_ci  AtomicLoadParameters(LoadRepresentation representation,
591cb0ef41Sopenharmony_ci                       AtomicMemoryOrder order)
601cb0ef41Sopenharmony_ci      : representation_(representation), order_(order) {}
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci  LoadRepresentation representation() const { return representation_; }
631cb0ef41Sopenharmony_ci  AtomicMemoryOrder order() const { return order_; }
641cb0ef41Sopenharmony_ci
651cb0ef41Sopenharmony_ci private:
661cb0ef41Sopenharmony_ci  LoadRepresentation representation_;
671cb0ef41Sopenharmony_ci  AtomicMemoryOrder order_;
681cb0ef41Sopenharmony_ci};
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(AtomicLoadParameters, AtomicLoadParameters);
711cb0ef41Sopenharmony_cibool operator!=(AtomicLoadParameters, AtomicLoadParameters);
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_cisize_t hash_value(AtomicLoadParameters);
741cb0ef41Sopenharmony_ci
751cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, AtomicLoadParameters);
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE AtomicLoadParameters AtomicLoadParametersOf(Operator const*)
781cb0ef41Sopenharmony_ci    V8_WARN_UNUSED_RESULT;
791cb0ef41Sopenharmony_ci
801cb0ef41Sopenharmony_cienum class MemoryAccessKind {
811cb0ef41Sopenharmony_ci  kNormal,
821cb0ef41Sopenharmony_ci  kUnaligned,
831cb0ef41Sopenharmony_ci  kProtected,
841cb0ef41Sopenharmony_ci};
851cb0ef41Sopenharmony_ci
861cb0ef41Sopenharmony_cisize_t hash_value(MemoryAccessKind);
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, MemoryAccessKind);
891cb0ef41Sopenharmony_ci
901cb0ef41Sopenharmony_cienum class LoadTransformation {
911cb0ef41Sopenharmony_ci  kS128Load8Splat,
921cb0ef41Sopenharmony_ci  kS128Load16Splat,
931cb0ef41Sopenharmony_ci  kS128Load32Splat,
941cb0ef41Sopenharmony_ci  kS128Load64Splat,
951cb0ef41Sopenharmony_ci  kS128Load8x8S,
961cb0ef41Sopenharmony_ci  kS128Load8x8U,
971cb0ef41Sopenharmony_ci  kS128Load16x4S,
981cb0ef41Sopenharmony_ci  kS128Load16x4U,
991cb0ef41Sopenharmony_ci  kS128Load32x2S,
1001cb0ef41Sopenharmony_ci  kS128Load32x2U,
1011cb0ef41Sopenharmony_ci  kS128Load32Zero,
1021cb0ef41Sopenharmony_ci  kS128Load64Zero,
1031cb0ef41Sopenharmony_ci};
1041cb0ef41Sopenharmony_ci
1051cb0ef41Sopenharmony_cisize_t hash_value(LoadTransformation);
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, LoadTransformation);
1081cb0ef41Sopenharmony_ci
1091cb0ef41Sopenharmony_cistruct LoadTransformParameters {
1101cb0ef41Sopenharmony_ci  MemoryAccessKind kind;
1111cb0ef41Sopenharmony_ci  LoadTransformation transformation;
1121cb0ef41Sopenharmony_ci};
1131cb0ef41Sopenharmony_ci
1141cb0ef41Sopenharmony_cisize_t hash_value(LoadTransformParameters);
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
1171cb0ef41Sopenharmony_ci                                           LoadTransformParameters);
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE LoadTransformParameters const& LoadTransformParametersOf(
1201cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(LoadTransformParameters,
1231cb0ef41Sopenharmony_ci                                  LoadTransformParameters);
1241cb0ef41Sopenharmony_cibool operator!=(LoadTransformParameters, LoadTransformParameters);
1251cb0ef41Sopenharmony_ci
1261cb0ef41Sopenharmony_cistruct LoadLaneParameters {
1271cb0ef41Sopenharmony_ci  MemoryAccessKind kind;
1281cb0ef41Sopenharmony_ci  LoadRepresentation rep;
1291cb0ef41Sopenharmony_ci  uint8_t laneidx;
1301cb0ef41Sopenharmony_ci};
1311cb0ef41Sopenharmony_ci
1321cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, LoadLaneParameters);
1331cb0ef41Sopenharmony_ci
1341cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE LoadLaneParameters const& LoadLaneParametersOf(
1351cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci// A Store needs a MachineType and a WriteBarrierKind in order to emit the
1381cb0ef41Sopenharmony_ci// correct write barrier, and needs to state whether it is storing into the
1391cb0ef41Sopenharmony_ci// header word, so that the value can be packed, if necessary.
1401cb0ef41Sopenharmony_ciclass StoreRepresentation final {
1411cb0ef41Sopenharmony_ci public:
1421cb0ef41Sopenharmony_ci  StoreRepresentation(MachineRepresentation representation,
1431cb0ef41Sopenharmony_ci                      WriteBarrierKind write_barrier_kind)
1441cb0ef41Sopenharmony_ci      : representation_(representation),
1451cb0ef41Sopenharmony_ci        write_barrier_kind_(write_barrier_kind) {}
1461cb0ef41Sopenharmony_ci
1471cb0ef41Sopenharmony_ci  MachineRepresentation representation() const { return representation_; }
1481cb0ef41Sopenharmony_ci  WriteBarrierKind write_barrier_kind() const { return write_barrier_kind_; }
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ci private:
1511cb0ef41Sopenharmony_ci  MachineRepresentation representation_;
1521cb0ef41Sopenharmony_ci  WriteBarrierKind write_barrier_kind_;
1531cb0ef41Sopenharmony_ci};
1541cb0ef41Sopenharmony_ci
1551cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(StoreRepresentation, StoreRepresentation);
1561cb0ef41Sopenharmony_cibool operator!=(StoreRepresentation, StoreRepresentation);
1571cb0ef41Sopenharmony_ci
1581cb0ef41Sopenharmony_cisize_t hash_value(StoreRepresentation);
1591cb0ef41Sopenharmony_ci
1601cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreRepresentation);
1611cb0ef41Sopenharmony_ci
1621cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE StoreRepresentation const& StoreRepresentationOf(
1631cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci// A Word(32|64)AtomicStore needs both a StoreRepresentation and a memory order.
1661cb0ef41Sopenharmony_ciclass AtomicStoreParameters final {
1671cb0ef41Sopenharmony_ci public:
1681cb0ef41Sopenharmony_ci  AtomicStoreParameters(MachineRepresentation representation,
1691cb0ef41Sopenharmony_ci                        WriteBarrierKind write_barrier_kind,
1701cb0ef41Sopenharmony_ci                        AtomicMemoryOrder order)
1711cb0ef41Sopenharmony_ci      : store_representation_(representation, write_barrier_kind),
1721cb0ef41Sopenharmony_ci        order_(order) {}
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci  MachineRepresentation representation() const {
1751cb0ef41Sopenharmony_ci    return store_representation_.representation();
1761cb0ef41Sopenharmony_ci  }
1771cb0ef41Sopenharmony_ci  WriteBarrierKind write_barrier_kind() const {
1781cb0ef41Sopenharmony_ci    return store_representation_.write_barrier_kind();
1791cb0ef41Sopenharmony_ci  }
1801cb0ef41Sopenharmony_ci  AtomicMemoryOrder order() const { return order_; }
1811cb0ef41Sopenharmony_ci
1821cb0ef41Sopenharmony_ci  StoreRepresentation store_representation() const {
1831cb0ef41Sopenharmony_ci    return store_representation_;
1841cb0ef41Sopenharmony_ci  }
1851cb0ef41Sopenharmony_ci
1861cb0ef41Sopenharmony_ci private:
1871cb0ef41Sopenharmony_ci  StoreRepresentation store_representation_;
1881cb0ef41Sopenharmony_ci  AtomicMemoryOrder order_;
1891cb0ef41Sopenharmony_ci};
1901cb0ef41Sopenharmony_ci
1911cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(AtomicStoreParameters, AtomicStoreParameters);
1921cb0ef41Sopenharmony_cibool operator!=(AtomicStoreParameters, AtomicStoreParameters);
1931cb0ef41Sopenharmony_ci
1941cb0ef41Sopenharmony_cisize_t hash_value(AtomicStoreParameters);
1951cb0ef41Sopenharmony_ci
1961cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
1971cb0ef41Sopenharmony_ci                                           AtomicStoreParameters);
1981cb0ef41Sopenharmony_ci
1991cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE AtomicStoreParameters const& AtomicStoreParametersOf(
2001cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
2011cb0ef41Sopenharmony_ci
2021cb0ef41Sopenharmony_ci// An UnalignedStore needs a MachineType.
2031cb0ef41Sopenharmony_ciusing UnalignedStoreRepresentation = MachineRepresentation;
2041cb0ef41Sopenharmony_ci
2051cb0ef41Sopenharmony_ciUnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
2061cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
2071cb0ef41Sopenharmony_ci
2081cb0ef41Sopenharmony_cistruct StoreLaneParameters {
2091cb0ef41Sopenharmony_ci  MemoryAccessKind kind;
2101cb0ef41Sopenharmony_ci  MachineRepresentation rep;
2111cb0ef41Sopenharmony_ci  uint8_t laneidx;
2121cb0ef41Sopenharmony_ci};
2131cb0ef41Sopenharmony_ci
2141cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, StoreLaneParameters);
2151cb0ef41Sopenharmony_ci
2161cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE StoreLaneParameters const& StoreLaneParametersOf(
2171cb0ef41Sopenharmony_ci    Operator const*) V8_WARN_UNUSED_RESULT;
2181cb0ef41Sopenharmony_ci
2191cb0ef41Sopenharmony_ciclass StackSlotRepresentation final {
2201cb0ef41Sopenharmony_ci public:
2211cb0ef41Sopenharmony_ci  StackSlotRepresentation(int size, int alignment)
2221cb0ef41Sopenharmony_ci      : size_(size), alignment_(alignment) {}
2231cb0ef41Sopenharmony_ci
2241cb0ef41Sopenharmony_ci  int size() const { return size_; }
2251cb0ef41Sopenharmony_ci  int alignment() const { return alignment_; }
2261cb0ef41Sopenharmony_ci
2271cb0ef41Sopenharmony_ci private:
2281cb0ef41Sopenharmony_ci  int size_;
2291cb0ef41Sopenharmony_ci  int alignment_;
2301cb0ef41Sopenharmony_ci};
2311cb0ef41Sopenharmony_ci
2321cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(StackSlotRepresentation,
2331cb0ef41Sopenharmony_ci                                  StackSlotRepresentation);
2341cb0ef41Sopenharmony_cibool operator!=(StackSlotRepresentation, StackSlotRepresentation);
2351cb0ef41Sopenharmony_ci
2361cb0ef41Sopenharmony_cisize_t hash_value(StackSlotRepresentation);
2371cb0ef41Sopenharmony_ci
2381cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
2391cb0ef41Sopenharmony_ci                                           StackSlotRepresentation);
2401cb0ef41Sopenharmony_ci
2411cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE StackSlotRepresentation const& StackSlotRepresentationOf(
2421cb0ef41Sopenharmony_ci    Operator const* op) V8_WARN_UNUSED_RESULT;
2431cb0ef41Sopenharmony_ci
2441cb0ef41Sopenharmony_ciMachineType AtomicOpType(Operator const* op) V8_WARN_UNUSED_RESULT;
2451cb0ef41Sopenharmony_ci
2461cb0ef41Sopenharmony_ciclass S128ImmediateParameter {
2471cb0ef41Sopenharmony_ci public:
2481cb0ef41Sopenharmony_ci  explicit S128ImmediateParameter(const uint8_t immediate[16]) {
2491cb0ef41Sopenharmony_ci    std::copy(immediate, immediate + 16, immediate_.begin());
2501cb0ef41Sopenharmony_ci  }
2511cb0ef41Sopenharmony_ci  S128ImmediateParameter() = default;
2521cb0ef41Sopenharmony_ci  const std::array<uint8_t, 16>& immediate() const { return immediate_; }
2531cb0ef41Sopenharmony_ci  const uint8_t* data() const { return immediate_.data(); }
2541cb0ef41Sopenharmony_ci  uint8_t operator[](int x) const { return immediate_[x]; }
2551cb0ef41Sopenharmony_ci
2561cb0ef41Sopenharmony_ci private:
2571cb0ef41Sopenharmony_ci  std::array<uint8_t, 16> immediate_;
2581cb0ef41Sopenharmony_ci};
2591cb0ef41Sopenharmony_ci
2601cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE bool operator==(S128ImmediateParameter const& lhs,
2611cb0ef41Sopenharmony_ci                                  S128ImmediateParameter const& rhs);
2621cb0ef41Sopenharmony_cibool operator!=(S128ImmediateParameter const& lhs,
2631cb0ef41Sopenharmony_ci                S128ImmediateParameter const& rhs);
2641cb0ef41Sopenharmony_ci
2651cb0ef41Sopenharmony_cisize_t hash_value(S128ImmediateParameter const& p);
2661cb0ef41Sopenharmony_ci
2671cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
2681cb0ef41Sopenharmony_ci                                           S128ImmediateParameter const&);
2691cb0ef41Sopenharmony_ci
2701cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE S128ImmediateParameter const& S128ImmediateParameterOf(
2711cb0ef41Sopenharmony_ci    Operator const* op) V8_WARN_UNUSED_RESULT;
2721cb0ef41Sopenharmony_ci
2731cb0ef41Sopenharmony_ciStackCheckKind StackCheckKindOf(Operator const* op) V8_WARN_UNUSED_RESULT;
2741cb0ef41Sopenharmony_ci
2751cb0ef41Sopenharmony_ci// ShiftKind::kShiftOutZeros means that it is guaranteed that the bits shifted
2761cb0ef41Sopenharmony_ci// out of the left operand are all zeros. If this is not the case, undefined
2771cb0ef41Sopenharmony_ci// behavior (i.e., incorrect optimizations) will happen.
2781cb0ef41Sopenharmony_ci// This is mostly useful for Smi untagging.
2791cb0ef41Sopenharmony_cienum class ShiftKind { kNormal, kShiftOutZeros };
2801cb0ef41Sopenharmony_ci
2811cb0ef41Sopenharmony_cisize_t hash_value(ShiftKind);
2821cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ShiftKind);
2831cb0ef41Sopenharmony_ciShiftKind ShiftKindOf(Operator const*) V8_WARN_UNUSED_RESULT;
2841cb0ef41Sopenharmony_ci
2851cb0ef41Sopenharmony_ci// TruncateKind::kSetOverflowToMin sets the result of a saturating float-to-int
2861cb0ef41Sopenharmony_ci// conversion to INT_MIN if the conversion returns INT_MAX due to overflow. This
2871cb0ef41Sopenharmony_ci// makes it easier to detect an overflow. This parameter is ignored on platforms
2881cb0ef41Sopenharmony_ci// like x64 and ia32 where a range overflow does not result in INT_MAX.
2891cb0ef41Sopenharmony_cienum class TruncateKind { kArchitectureDefault, kSetOverflowToMin };
2901cb0ef41Sopenharmony_cistd::ostream& operator<<(std::ostream& os, TruncateKind kind);
2911cb0ef41Sopenharmony_cisize_t hash_value(TruncateKind kind);
2921cb0ef41Sopenharmony_ci
2931cb0ef41Sopenharmony_ci// Interface for building machine-level operators. These operators are
2941cb0ef41Sopenharmony_ci// machine-level but machine-independent and thus define a language suitable
2951cb0ef41Sopenharmony_ci// for generating code to run on architectures such as ia32, x64, arm, etc.
2961cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE MachineOperatorBuilder final
2971cb0ef41Sopenharmony_ci    : public NON_EXPORTED_BASE(ZoneObject) {
2981cb0ef41Sopenharmony_ci public:
2991cb0ef41Sopenharmony_ci  // Flags that specify which operations are available. This is useful
3001cb0ef41Sopenharmony_ci  // for operations that are unsupported by some back-ends.
3011cb0ef41Sopenharmony_ci  enum Flag : unsigned {
3021cb0ef41Sopenharmony_ci    kNoFlags = 0u,
3031cb0ef41Sopenharmony_ci    kFloat32RoundDown = 1u << 0,
3041cb0ef41Sopenharmony_ci    kFloat64RoundDown = 1u << 1,
3051cb0ef41Sopenharmony_ci    kFloat32RoundUp = 1u << 2,
3061cb0ef41Sopenharmony_ci    kFloat64RoundUp = 1u << 3,
3071cb0ef41Sopenharmony_ci    kFloat32RoundTruncate = 1u << 4,
3081cb0ef41Sopenharmony_ci    kFloat64RoundTruncate = 1u << 5,
3091cb0ef41Sopenharmony_ci    kFloat32RoundTiesEven = 1u << 6,
3101cb0ef41Sopenharmony_ci    kFloat64RoundTiesEven = 1u << 7,
3111cb0ef41Sopenharmony_ci    kFloat64RoundTiesAway = 1u << 8,
3121cb0ef41Sopenharmony_ci    kInt32DivIsSafe = 1u << 9,
3131cb0ef41Sopenharmony_ci    kUint32DivIsSafe = 1u << 10,
3141cb0ef41Sopenharmony_ci    kWord32ShiftIsSafe = 1u << 11,
3151cb0ef41Sopenharmony_ci    kWord32Ctz = 1u << 12,
3161cb0ef41Sopenharmony_ci    kWord64Ctz = 1u << 13,
3171cb0ef41Sopenharmony_ci    kWord64CtzLowerable = 1u << 14,
3181cb0ef41Sopenharmony_ci    kWord32Popcnt = 1u << 15,
3191cb0ef41Sopenharmony_ci    kWord64Popcnt = 1u << 16,
3201cb0ef41Sopenharmony_ci    kWord32ReverseBits = 1u << 17,
3211cb0ef41Sopenharmony_ci    kWord64ReverseBits = 1u << 18,
3221cb0ef41Sopenharmony_ci    kFloat32Select = 1u << 19,
3231cb0ef41Sopenharmony_ci    kFloat64Select = 1u << 20,
3241cb0ef41Sopenharmony_ci    kInt32AbsWithOverflow = 1u << 21,
3251cb0ef41Sopenharmony_ci    kInt64AbsWithOverflow = 1u << 22,
3261cb0ef41Sopenharmony_ci    kWord32Rol = 1u << 23,
3271cb0ef41Sopenharmony_ci    kWord64Rol = 1u << 24,
3281cb0ef41Sopenharmony_ci    kWord64RolLowerable = 1u << 25,
3291cb0ef41Sopenharmony_ci    kSatConversionIsSafe = 1u << 26,
3301cb0ef41Sopenharmony_ci    kWord32Select = 1u << 27,
3311cb0ef41Sopenharmony_ci    kWord64Select = 1u << 28,
3321cb0ef41Sopenharmony_ci    kAllOptionalOps =
3331cb0ef41Sopenharmony_ci        kFloat32RoundDown | kFloat64RoundDown | kFloat32RoundUp |
3341cb0ef41Sopenharmony_ci        kFloat64RoundUp | kFloat32RoundTruncate | kFloat64RoundTruncate |
3351cb0ef41Sopenharmony_ci        kFloat64RoundTiesAway | kFloat32RoundTiesEven | kFloat64RoundTiesEven |
3361cb0ef41Sopenharmony_ci        kWord32Ctz | kWord64Ctz | kWord64CtzLowerable | kWord32Popcnt |
3371cb0ef41Sopenharmony_ci        kWord64Popcnt | kWord32ReverseBits | kWord64ReverseBits |
3381cb0ef41Sopenharmony_ci        kInt32AbsWithOverflow | kInt64AbsWithOverflow | kWord32Rol |
3391cb0ef41Sopenharmony_ci        kWord64Rol | kWord64RolLowerable | kSatConversionIsSafe |
3401cb0ef41Sopenharmony_ci        kFloat32Select | kFloat64Select | kWord32Select | kWord64Select
3411cb0ef41Sopenharmony_ci  };
3421cb0ef41Sopenharmony_ci  using Flags = base::Flags<Flag, unsigned>;
3431cb0ef41Sopenharmony_ci
3441cb0ef41Sopenharmony_ci  class AlignmentRequirements {
3451cb0ef41Sopenharmony_ci   public:
3461cb0ef41Sopenharmony_ci    enum UnalignedAccessSupport { kNoSupport, kSomeSupport, kFullSupport };
3471cb0ef41Sopenharmony_ci
3481cb0ef41Sopenharmony_ci    bool IsUnalignedLoadSupported(MachineRepresentation rep) const {
3491cb0ef41Sopenharmony_ci      return IsUnalignedSupported(unalignedLoadUnsupportedTypes_, rep);
3501cb0ef41Sopenharmony_ci    }
3511cb0ef41Sopenharmony_ci
3521cb0ef41Sopenharmony_ci    bool IsUnalignedStoreSupported(MachineRepresentation rep) const {
3531cb0ef41Sopenharmony_ci      return IsUnalignedSupported(unalignedStoreUnsupportedTypes_, rep);
3541cb0ef41Sopenharmony_ci    }
3551cb0ef41Sopenharmony_ci
3561cb0ef41Sopenharmony_ci    static AlignmentRequirements FullUnalignedAccessSupport() {
3571cb0ef41Sopenharmony_ci      return AlignmentRequirements(kFullSupport);
3581cb0ef41Sopenharmony_ci    }
3591cb0ef41Sopenharmony_ci    static AlignmentRequirements NoUnalignedAccessSupport() {
3601cb0ef41Sopenharmony_ci      return AlignmentRequirements(kNoSupport);
3611cb0ef41Sopenharmony_ci    }
3621cb0ef41Sopenharmony_ci    static AlignmentRequirements SomeUnalignedAccessUnsupported(
3631cb0ef41Sopenharmony_ci        base::EnumSet<MachineRepresentation> unalignedLoadUnsupportedTypes,
3641cb0ef41Sopenharmony_ci        base::EnumSet<MachineRepresentation> unalignedStoreUnsupportedTypes) {
3651cb0ef41Sopenharmony_ci      return AlignmentRequirements(kSomeSupport, unalignedLoadUnsupportedTypes,
3661cb0ef41Sopenharmony_ci                                   unalignedStoreUnsupportedTypes);
3671cb0ef41Sopenharmony_ci    }
3681cb0ef41Sopenharmony_ci
3691cb0ef41Sopenharmony_ci   private:
3701cb0ef41Sopenharmony_ci    explicit AlignmentRequirements(
3711cb0ef41Sopenharmony_ci        AlignmentRequirements::UnalignedAccessSupport unalignedAccessSupport,
3721cb0ef41Sopenharmony_ci        base::EnumSet<MachineRepresentation> unalignedLoadUnsupportedTypes =
3731cb0ef41Sopenharmony_ci            base::EnumSet<MachineRepresentation>(),
3741cb0ef41Sopenharmony_ci        base::EnumSet<MachineRepresentation> unalignedStoreUnsupportedTypes =
3751cb0ef41Sopenharmony_ci            base::EnumSet<MachineRepresentation>())
3761cb0ef41Sopenharmony_ci        : unalignedSupport_(unalignedAccessSupport),
3771cb0ef41Sopenharmony_ci          unalignedLoadUnsupportedTypes_(unalignedLoadUnsupportedTypes),
3781cb0ef41Sopenharmony_ci          unalignedStoreUnsupportedTypes_(unalignedStoreUnsupportedTypes) {}
3791cb0ef41Sopenharmony_ci
3801cb0ef41Sopenharmony_ci    bool IsUnalignedSupported(base::EnumSet<MachineRepresentation> unsupported,
3811cb0ef41Sopenharmony_ci                              MachineRepresentation rep) const {
3821cb0ef41Sopenharmony_ci      // All accesses of bytes in memory are aligned.
3831cb0ef41Sopenharmony_ci      DCHECK_NE(MachineRepresentation::kWord8, rep);
3841cb0ef41Sopenharmony_ci      switch (unalignedSupport_) {
3851cb0ef41Sopenharmony_ci        case kFullSupport:
3861cb0ef41Sopenharmony_ci          return true;
3871cb0ef41Sopenharmony_ci        case kNoSupport:
3881cb0ef41Sopenharmony_ci          return false;
3891cb0ef41Sopenharmony_ci        case kSomeSupport:
3901cb0ef41Sopenharmony_ci          return !unsupported.contains(rep);
3911cb0ef41Sopenharmony_ci      }
3921cb0ef41Sopenharmony_ci      UNREACHABLE();
3931cb0ef41Sopenharmony_ci    }
3941cb0ef41Sopenharmony_ci
3951cb0ef41Sopenharmony_ci    const AlignmentRequirements::UnalignedAccessSupport unalignedSupport_;
3961cb0ef41Sopenharmony_ci    const base::EnumSet<MachineRepresentation> unalignedLoadUnsupportedTypes_;
3971cb0ef41Sopenharmony_ci    const base::EnumSet<MachineRepresentation> unalignedStoreUnsupportedTypes_;
3981cb0ef41Sopenharmony_ci  };
3991cb0ef41Sopenharmony_ci
4001cb0ef41Sopenharmony_ci  explicit MachineOperatorBuilder(
4011cb0ef41Sopenharmony_ci      Zone* zone,
4021cb0ef41Sopenharmony_ci      MachineRepresentation word = MachineType::PointerRepresentation(),
4031cb0ef41Sopenharmony_ci      Flags supportedOperators = kNoFlags,
4041cb0ef41Sopenharmony_ci      AlignmentRequirements alignmentRequirements =
4051cb0ef41Sopenharmony_ci          AlignmentRequirements::FullUnalignedAccessSupport());
4061cb0ef41Sopenharmony_ci
4071cb0ef41Sopenharmony_ci  MachineOperatorBuilder(const MachineOperatorBuilder&) = delete;
4081cb0ef41Sopenharmony_ci  MachineOperatorBuilder& operator=(const MachineOperatorBuilder&) = delete;
4091cb0ef41Sopenharmony_ci
4101cb0ef41Sopenharmony_ci  const Operator* Comment(const char* msg);
4111cb0ef41Sopenharmony_ci  const Operator* AbortCSADcheck();
4121cb0ef41Sopenharmony_ci  const Operator* DebugBreak();
4131cb0ef41Sopenharmony_ci  const Operator* UnsafePointerAdd();
4141cb0ef41Sopenharmony_ci
4151cb0ef41Sopenharmony_ci  const Operator* Word32And();
4161cb0ef41Sopenharmony_ci  const Operator* Word32Or();
4171cb0ef41Sopenharmony_ci  const Operator* Word32Xor();
4181cb0ef41Sopenharmony_ci  const Operator* Word32Shl();
4191cb0ef41Sopenharmony_ci  const Operator* Word32Shr();
4201cb0ef41Sopenharmony_ci  const Operator* Word32Sar(ShiftKind kind);
4211cb0ef41Sopenharmony_ci  const Operator* Word32Sar() { return Word32Sar(ShiftKind::kNormal); }
4221cb0ef41Sopenharmony_ci  const Operator* Word32SarShiftOutZeros() {
4231cb0ef41Sopenharmony_ci    return Word32Sar(ShiftKind::kShiftOutZeros);
4241cb0ef41Sopenharmony_ci  }
4251cb0ef41Sopenharmony_ci  const OptionalOperator Word32Rol();
4261cb0ef41Sopenharmony_ci  const Operator* Word32Ror();
4271cb0ef41Sopenharmony_ci  const Operator* Word32Equal();
4281cb0ef41Sopenharmony_ci  const Operator* Word32Clz();
4291cb0ef41Sopenharmony_ci  const OptionalOperator Word32Ctz();
4301cb0ef41Sopenharmony_ci  const OptionalOperator Word32Popcnt();
4311cb0ef41Sopenharmony_ci  const OptionalOperator Word64Popcnt();
4321cb0ef41Sopenharmony_ci  const OptionalOperator Word32ReverseBits();
4331cb0ef41Sopenharmony_ci  const OptionalOperator Word64ReverseBits();
4341cb0ef41Sopenharmony_ci  const Operator* Word32ReverseBytes();
4351cb0ef41Sopenharmony_ci  const Operator* Word64ReverseBytes();
4361cb0ef41Sopenharmony_ci  const Operator* Simd128ReverseBytes();
4371cb0ef41Sopenharmony_ci  const OptionalOperator Int32AbsWithOverflow();
4381cb0ef41Sopenharmony_ci  const OptionalOperator Int64AbsWithOverflow();
4391cb0ef41Sopenharmony_ci
4401cb0ef41Sopenharmony_ci  // Return true if the target's Word32 shift implementation is directly
4411cb0ef41Sopenharmony_ci  // compatible with JavaScript's specification. Otherwise, we have to manually
4421cb0ef41Sopenharmony_ci  // generate a mask with 0x1f on the amount ahead of generating the shift.
4431cb0ef41Sopenharmony_ci  bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; }
4441cb0ef41Sopenharmony_ci
4451cb0ef41Sopenharmony_ci  // Return true if the target's implementation of float-to-int-conversions is a
4461cb0ef41Sopenharmony_ci  // saturating conversion rounding towards 0. Otherwise, we have to manually
4471cb0ef41Sopenharmony_ci  // generate the correct value if a saturating conversion is requested.
4481cb0ef41Sopenharmony_ci  bool SatConversionIsSafe() const { return flags_ & kSatConversionIsSafe; }
4491cb0ef41Sopenharmony_ci
4501cb0ef41Sopenharmony_ci  const Operator* Word64And();
4511cb0ef41Sopenharmony_ci  const Operator* Word64Or();
4521cb0ef41Sopenharmony_ci  const Operator* Word64Xor();
4531cb0ef41Sopenharmony_ci  const Operator* Word64Shl();
4541cb0ef41Sopenharmony_ci  const Operator* Word64Shr();
4551cb0ef41Sopenharmony_ci  const Operator* Word64Sar(ShiftKind kind);
4561cb0ef41Sopenharmony_ci  const Operator* Word64Sar() { return Word64Sar(ShiftKind::kNormal); }
4571cb0ef41Sopenharmony_ci  const Operator* Word64SarShiftOutZeros() {
4581cb0ef41Sopenharmony_ci    return Word64Sar(ShiftKind::kShiftOutZeros);
4591cb0ef41Sopenharmony_ci  }
4601cb0ef41Sopenharmony_ci
4611cb0ef41Sopenharmony_ci  // 64-bit rol, ror, clz and ctz operators have two versions: the non-suffixed
4621cb0ef41Sopenharmony_ci  // ones are meant to be used in 64-bit systems and have no control input. The
4631cb0ef41Sopenharmony_ci  // "Lowerable"-suffixed ones are meant to be temporary operators in 32-bit
4641cb0ef41Sopenharmony_ci  // systems and will be lowered to 32-bit operators. They have a control input
4651cb0ef41Sopenharmony_ci  // to enable the lowering.
4661cb0ef41Sopenharmony_ci  const OptionalOperator Word64Rol();
4671cb0ef41Sopenharmony_ci  const Operator* Word64Ror();
4681cb0ef41Sopenharmony_ci  const Operator* Word64Clz();
4691cb0ef41Sopenharmony_ci  const OptionalOperator Word64Ctz();
4701cb0ef41Sopenharmony_ci  const OptionalOperator Word64RolLowerable();
4711cb0ef41Sopenharmony_ci  const Operator* Word64RorLowerable();
4721cb0ef41Sopenharmony_ci  const Operator* Word64ClzLowerable();
4731cb0ef41Sopenharmony_ci  const OptionalOperator Word64CtzLowerable();
4741cb0ef41Sopenharmony_ci
4751cb0ef41Sopenharmony_ci  const Operator* Word64Equal();
4761cb0ef41Sopenharmony_ci
4771cb0ef41Sopenharmony_ci  const Operator* Int32PairAdd();
4781cb0ef41Sopenharmony_ci  const Operator* Int32PairSub();
4791cb0ef41Sopenharmony_ci  const Operator* Int32PairMul();
4801cb0ef41Sopenharmony_ci  const Operator* Word32PairShl();
4811cb0ef41Sopenharmony_ci  const Operator* Word32PairShr();
4821cb0ef41Sopenharmony_ci  const Operator* Word32PairSar();
4831cb0ef41Sopenharmony_ci
4841cb0ef41Sopenharmony_ci  const Operator* Int32Add();
4851cb0ef41Sopenharmony_ci  const Operator* Int32AddWithOverflow();
4861cb0ef41Sopenharmony_ci  const Operator* Int32Sub();
4871cb0ef41Sopenharmony_ci  const Operator* Int32SubWithOverflow();
4881cb0ef41Sopenharmony_ci  const Operator* Int32Mul();
4891cb0ef41Sopenharmony_ci  const Operator* Int32MulWithOverflow();
4901cb0ef41Sopenharmony_ci  const Operator* Int32MulHigh();
4911cb0ef41Sopenharmony_ci  const Operator* Int32Div();
4921cb0ef41Sopenharmony_ci  const Operator* Int32Mod();
4931cb0ef41Sopenharmony_ci  const Operator* Int32LessThan();
4941cb0ef41Sopenharmony_ci  const Operator* Int32LessThanOrEqual();
4951cb0ef41Sopenharmony_ci  const Operator* Uint32Div();
4961cb0ef41Sopenharmony_ci  const Operator* Uint32LessThan();
4971cb0ef41Sopenharmony_ci  const Operator* Uint32LessThanOrEqual();
4981cb0ef41Sopenharmony_ci  const Operator* Uint32Mod();
4991cb0ef41Sopenharmony_ci  const Operator* Uint32MulHigh();
5001cb0ef41Sopenharmony_ci  bool Int32DivIsSafe() const { return flags_ & kInt32DivIsSafe; }
5011cb0ef41Sopenharmony_ci  bool Uint32DivIsSafe() const { return flags_ & kUint32DivIsSafe; }
5021cb0ef41Sopenharmony_ci
5031cb0ef41Sopenharmony_ci  const Operator* Int64Add();
5041cb0ef41Sopenharmony_ci  const Operator* Int64AddWithOverflow();
5051cb0ef41Sopenharmony_ci  const Operator* Int64Sub();
5061cb0ef41Sopenharmony_ci  const Operator* Int64SubWithOverflow();
5071cb0ef41Sopenharmony_ci  const Operator* Int64Mul();
5081cb0ef41Sopenharmony_ci  const Operator* Int64Div();
5091cb0ef41Sopenharmony_ci  const Operator* Int64Mod();
5101cb0ef41Sopenharmony_ci  const Operator* Int64LessThan();
5111cb0ef41Sopenharmony_ci  const Operator* Int64LessThanOrEqual();
5121cb0ef41Sopenharmony_ci  const Operator* Uint64Div();
5131cb0ef41Sopenharmony_ci  const Operator* Uint64LessThan();
5141cb0ef41Sopenharmony_ci  const Operator* Uint64LessThanOrEqual();
5151cb0ef41Sopenharmony_ci  const Operator* Uint64Mod();
5161cb0ef41Sopenharmony_ci
5171cb0ef41Sopenharmony_ci  // This operator reinterprets the bits of a tagged pointer as a word.
5181cb0ef41Sopenharmony_ci  const Operator* BitcastTaggedToWord();
5191cb0ef41Sopenharmony_ci
5201cb0ef41Sopenharmony_ci  // This operator reinterprets the bits of a tagged value as a word preserving
5211cb0ef41Sopenharmony_ci  // non-pointer bits (all the bits that are not modified by GC):
5221cb0ef41Sopenharmony_ci  // 1) smi tag
5231cb0ef41Sopenharmony_ci  // 2) weak tag
5241cb0ef41Sopenharmony_ci  // 3) smi payload if the tagged value is a smi.
5251cb0ef41Sopenharmony_ci  // Note, that it's illegal to "look" at the pointer bits of non-smi values.
5261cb0ef41Sopenharmony_ci  const Operator* BitcastTaggedToWordForTagAndSmiBits();
5271cb0ef41Sopenharmony_ci
5281cb0ef41Sopenharmony_ci  // This operator reinterprets the bits of a tagged MaybeObject pointer as
5291cb0ef41Sopenharmony_ci  // word.
5301cb0ef41Sopenharmony_ci  const Operator* BitcastMaybeObjectToWord();
5311cb0ef41Sopenharmony_ci
5321cb0ef41Sopenharmony_ci  // This operator reinterprets the bits of a word as tagged pointer.
5331cb0ef41Sopenharmony_ci  const Operator* BitcastWordToTagged();
5341cb0ef41Sopenharmony_ci
5351cb0ef41Sopenharmony_ci  // This operator reinterprets the bits of a word as a Smi.
5361cb0ef41Sopenharmony_ci  const Operator* BitcastWordToTaggedSigned();
5371cb0ef41Sopenharmony_ci
5381cb0ef41Sopenharmony_ci  // JavaScript float64 to int32/uint32 truncation.
5391cb0ef41Sopenharmony_ci  const Operator* TruncateFloat64ToWord32();
5401cb0ef41Sopenharmony_ci
5411cb0ef41Sopenharmony_ci  // These operators change the representation of numbers while preserving the
5421cb0ef41Sopenharmony_ci  // value of the number. Narrowing operators assume the input is representable
5431cb0ef41Sopenharmony_ci  // in the target type and are *not* defined for other inputs.
5441cb0ef41Sopenharmony_ci  // Use narrowing change operators only when there is a static guarantee that
5451cb0ef41Sopenharmony_ci  // the input value is representable in the target value.
5461cb0ef41Sopenharmony_ci  //
5471cb0ef41Sopenharmony_ci  // Some operators can have the behaviour on overflow change through specifying
5481cb0ef41Sopenharmony_ci  // TruncateKind. The exact semantics are documented in the tests in
5491cb0ef41Sopenharmony_ci  // test/cctest/compiler/test-run-machops.cc .
5501cb0ef41Sopenharmony_ci  const Operator* ChangeFloat32ToFloat64();
5511cb0ef41Sopenharmony_ci  const Operator* ChangeFloat64ToInt32();   // narrowing
5521cb0ef41Sopenharmony_ci  const Operator* ChangeFloat64ToInt64();
5531cb0ef41Sopenharmony_ci  const Operator* ChangeFloat64ToUint32();  // narrowing
5541cb0ef41Sopenharmony_ci  const Operator* ChangeFloat64ToUint64();
5551cb0ef41Sopenharmony_ci  const Operator* TruncateFloat64ToInt64(TruncateKind kind);
5561cb0ef41Sopenharmony_ci  const Operator* TruncateFloat64ToUint32();
5571cb0ef41Sopenharmony_ci  const Operator* TruncateFloat32ToInt32(TruncateKind kind);
5581cb0ef41Sopenharmony_ci  const Operator* TruncateFloat32ToUint32(TruncateKind kind);
5591cb0ef41Sopenharmony_ci  const Operator* TryTruncateFloat32ToInt64();
5601cb0ef41Sopenharmony_ci  const Operator* TryTruncateFloat64ToInt64();
5611cb0ef41Sopenharmony_ci  const Operator* TryTruncateFloat32ToUint64();
5621cb0ef41Sopenharmony_ci  const Operator* TryTruncateFloat64ToUint64();
5631cb0ef41Sopenharmony_ci  const Operator* ChangeInt32ToFloat64();
5641cb0ef41Sopenharmony_ci  const Operator* BitcastWord32ToWord64();
5651cb0ef41Sopenharmony_ci  const Operator* ChangeInt32ToInt64();
5661cb0ef41Sopenharmony_ci  const Operator* ChangeInt64ToFloat64();
5671cb0ef41Sopenharmony_ci  const Operator* ChangeUint32ToFloat64();
5681cb0ef41Sopenharmony_ci  const Operator* ChangeUint32ToUint64();
5691cb0ef41Sopenharmony_ci
5701cb0ef41Sopenharmony_ci  // These operators truncate or round numbers, both changing the representation
5711cb0ef41Sopenharmony_ci  // of the number and mapping multiple input values onto the same output value.
5721cb0ef41Sopenharmony_ci  const Operator* TruncateFloat64ToFloat32();
5731cb0ef41Sopenharmony_ci  const Operator* TruncateInt64ToInt32();
5741cb0ef41Sopenharmony_ci  const Operator* RoundFloat64ToInt32();
5751cb0ef41Sopenharmony_ci  const Operator* RoundInt32ToFloat32();
5761cb0ef41Sopenharmony_ci  const Operator* RoundInt64ToFloat32();
5771cb0ef41Sopenharmony_ci  const Operator* RoundInt64ToFloat64();
5781cb0ef41Sopenharmony_ci  const Operator* RoundUint32ToFloat32();
5791cb0ef41Sopenharmony_ci  const Operator* RoundUint64ToFloat32();
5801cb0ef41Sopenharmony_ci  const Operator* RoundUint64ToFloat64();
5811cb0ef41Sopenharmony_ci
5821cb0ef41Sopenharmony_ci  // These operators reinterpret the bits of a floating point number as an
5831cb0ef41Sopenharmony_ci  // integer and vice versa.
5841cb0ef41Sopenharmony_ci  const Operator* BitcastFloat32ToInt32();
5851cb0ef41Sopenharmony_ci  const Operator* BitcastFloat64ToInt64();
5861cb0ef41Sopenharmony_ci  const Operator* BitcastInt32ToFloat32();
5871cb0ef41Sopenharmony_ci  const Operator* BitcastInt64ToFloat64();
5881cb0ef41Sopenharmony_ci
5891cb0ef41Sopenharmony_ci  // These operators sign-extend to Int32/Int64
5901cb0ef41Sopenharmony_ci  const Operator* SignExtendWord8ToInt32();
5911cb0ef41Sopenharmony_ci  const Operator* SignExtendWord16ToInt32();
5921cb0ef41Sopenharmony_ci  const Operator* SignExtendWord8ToInt64();
5931cb0ef41Sopenharmony_ci  const Operator* SignExtendWord16ToInt64();
5941cb0ef41Sopenharmony_ci  const Operator* SignExtendWord32ToInt64();
5951cb0ef41Sopenharmony_ci
5961cb0ef41Sopenharmony_ci  // Floating point operators always operate with IEEE 754 round-to-nearest
5971cb0ef41Sopenharmony_ci  // (single-precision).
5981cb0ef41Sopenharmony_ci  const Operator* Float32Add();
5991cb0ef41Sopenharmony_ci  const Operator* Float32Sub();
6001cb0ef41Sopenharmony_ci  const Operator* Float32Mul();
6011cb0ef41Sopenharmony_ci  const Operator* Float32Div();
6021cb0ef41Sopenharmony_ci  const Operator* Float32Sqrt();
6031cb0ef41Sopenharmony_ci
6041cb0ef41Sopenharmony_ci  // Floating point operators always operate with IEEE 754 round-to-nearest
6051cb0ef41Sopenharmony_ci  // (double-precision).
6061cb0ef41Sopenharmony_ci  const Operator* Float64Add();
6071cb0ef41Sopenharmony_ci  const Operator* Float64Sub();
6081cb0ef41Sopenharmony_ci  const Operator* Float64Mul();
6091cb0ef41Sopenharmony_ci  const Operator* Float64Div();
6101cb0ef41Sopenharmony_ci  const Operator* Float64Mod();
6111cb0ef41Sopenharmony_ci  const Operator* Float64Sqrt();
6121cb0ef41Sopenharmony_ci
6131cb0ef41Sopenharmony_ci  // Floating point comparisons complying to IEEE 754 (single-precision).
6141cb0ef41Sopenharmony_ci  const Operator* Float32Equal();
6151cb0ef41Sopenharmony_ci  const Operator* Float32LessThan();
6161cb0ef41Sopenharmony_ci  const Operator* Float32LessThanOrEqual();
6171cb0ef41Sopenharmony_ci
6181cb0ef41Sopenharmony_ci  // Floating point comparisons complying to IEEE 754 (double-precision).
6191cb0ef41Sopenharmony_ci  const Operator* Float64Equal();
6201cb0ef41Sopenharmony_ci  const Operator* Float64LessThan();
6211cb0ef41Sopenharmony_ci  const Operator* Float64LessThanOrEqual();
6221cb0ef41Sopenharmony_ci
6231cb0ef41Sopenharmony_ci  // Floating point min/max complying to EcmaScript 6 (double-precision).
6241cb0ef41Sopenharmony_ci  const Operator* Float64Max();
6251cb0ef41Sopenharmony_ci  const Operator* Float64Min();
6261cb0ef41Sopenharmony_ci  // Floating point min/max complying to WebAssembly (single-precision).
6271cb0ef41Sopenharmony_ci  const Operator* Float32Max();
6281cb0ef41Sopenharmony_ci  const Operator* Float32Min();
6291cb0ef41Sopenharmony_ci
6301cb0ef41Sopenharmony_ci  // Floating point abs complying to IEEE 754 (single-precision).
6311cb0ef41Sopenharmony_ci  const Operator* Float32Abs();
6321cb0ef41Sopenharmony_ci
6331cb0ef41Sopenharmony_ci  // Floating point abs complying to IEEE 754 (double-precision).
6341cb0ef41Sopenharmony_ci  const Operator* Float64Abs();
6351cb0ef41Sopenharmony_ci
6361cb0ef41Sopenharmony_ci  // Floating point rounding.
6371cb0ef41Sopenharmony_ci  const OptionalOperator Float32RoundDown();
6381cb0ef41Sopenharmony_ci  const OptionalOperator Float64RoundDown();
6391cb0ef41Sopenharmony_ci  const OptionalOperator Float32RoundUp();
6401cb0ef41Sopenharmony_ci  const OptionalOperator Float64RoundUp();
6411cb0ef41Sopenharmony_ci  const OptionalOperator Float32RoundTruncate();
6421cb0ef41Sopenharmony_ci  const OptionalOperator Float64RoundTruncate();
6431cb0ef41Sopenharmony_ci  const OptionalOperator Float64RoundTiesAway();
6441cb0ef41Sopenharmony_ci  const OptionalOperator Float32RoundTiesEven();
6451cb0ef41Sopenharmony_ci  const OptionalOperator Float64RoundTiesEven();
6461cb0ef41Sopenharmony_ci
6471cb0ef41Sopenharmony_ci  // Conditional selects. Input 1 is the condition, Input 2 is the result value
6481cb0ef41Sopenharmony_ci  // if the condition is {true}, Input 3 is the result value if the condition is
6491cb0ef41Sopenharmony_ci  // false.
6501cb0ef41Sopenharmony_ci  const OptionalOperator Word32Select();
6511cb0ef41Sopenharmony_ci  const OptionalOperator Word64Select();
6521cb0ef41Sopenharmony_ci  const OptionalOperator Float32Select();
6531cb0ef41Sopenharmony_ci  const OptionalOperator Float64Select();
6541cb0ef41Sopenharmony_ci
6551cb0ef41Sopenharmony_ci  // Floating point neg.
6561cb0ef41Sopenharmony_ci  const Operator* Float32Neg();
6571cb0ef41Sopenharmony_ci  const Operator* Float64Neg();
6581cb0ef41Sopenharmony_ci
6591cb0ef41Sopenharmony_ci  // Floating point trigonometric functions (double-precision).
6601cb0ef41Sopenharmony_ci  const Operator* Float64Acos();
6611cb0ef41Sopenharmony_ci  const Operator* Float64Acosh();
6621cb0ef41Sopenharmony_ci  const Operator* Float64Asin();
6631cb0ef41Sopenharmony_ci  const Operator* Float64Asinh();
6641cb0ef41Sopenharmony_ci  const Operator* Float64Atan();
6651cb0ef41Sopenharmony_ci  const Operator* Float64Atan2();
6661cb0ef41Sopenharmony_ci  const Operator* Float64Atanh();
6671cb0ef41Sopenharmony_ci  const Operator* Float64Cos();
6681cb0ef41Sopenharmony_ci  const Operator* Float64Cosh();
6691cb0ef41Sopenharmony_ci  const Operator* Float64Sin();
6701cb0ef41Sopenharmony_ci  const Operator* Float64Sinh();
6711cb0ef41Sopenharmony_ci  const Operator* Float64Tan();
6721cb0ef41Sopenharmony_ci  const Operator* Float64Tanh();
6731cb0ef41Sopenharmony_ci
6741cb0ef41Sopenharmony_ci  // Floating point exponential functions (double-precision).
6751cb0ef41Sopenharmony_ci  const Operator* Float64Exp();
6761cb0ef41Sopenharmony_ci  const Operator* Float64Expm1();
6771cb0ef41Sopenharmony_ci  const Operator* Float64Pow();
6781cb0ef41Sopenharmony_ci
6791cb0ef41Sopenharmony_ci  // Floating point logarithm (double-precision).
6801cb0ef41Sopenharmony_ci  const Operator* Float64Log();
6811cb0ef41Sopenharmony_ci  const Operator* Float64Log1p();
6821cb0ef41Sopenharmony_ci  const Operator* Float64Log2();
6831cb0ef41Sopenharmony_ci  const Operator* Float64Log10();
6841cb0ef41Sopenharmony_ci
6851cb0ef41Sopenharmony_ci  // Floating point cube root (double-precision).
6861cb0ef41Sopenharmony_ci  const Operator* Float64Cbrt();
6871cb0ef41Sopenharmony_ci
6881cb0ef41Sopenharmony_ci  // Floating point bit representation.
6891cb0ef41Sopenharmony_ci  const Operator* Float64ExtractLowWord32();
6901cb0ef41Sopenharmony_ci  const Operator* Float64ExtractHighWord32();
6911cb0ef41Sopenharmony_ci  const Operator* Float64InsertLowWord32();
6921cb0ef41Sopenharmony_ci  const Operator* Float64InsertHighWord32();
6931cb0ef41Sopenharmony_ci
6941cb0ef41Sopenharmony_ci  // Change signalling NaN to quiet NaN.
6951cb0ef41Sopenharmony_ci  // Identity for any input that is not signalling NaN.
6961cb0ef41Sopenharmony_ci  const Operator* Float64SilenceNaN();
6971cb0ef41Sopenharmony_ci
6981cb0ef41Sopenharmony_ci  // SIMD operators.
6991cb0ef41Sopenharmony_ci  const Operator* F64x2Splat();
7001cb0ef41Sopenharmony_ci  const Operator* F64x2Abs();
7011cb0ef41Sopenharmony_ci  const Operator* F64x2Neg();
7021cb0ef41Sopenharmony_ci  const Operator* F64x2Sqrt();
7031cb0ef41Sopenharmony_ci  const Operator* F64x2Add();
7041cb0ef41Sopenharmony_ci  const Operator* F64x2Sub();
7051cb0ef41Sopenharmony_ci  const Operator* F64x2Mul();
7061cb0ef41Sopenharmony_ci  const Operator* F64x2Div();
7071cb0ef41Sopenharmony_ci  const Operator* F64x2ExtractLane(int32_t);
7081cb0ef41Sopenharmony_ci  const Operator* F64x2Min();
7091cb0ef41Sopenharmony_ci  const Operator* F64x2Max();
7101cb0ef41Sopenharmony_ci  const Operator* F64x2ReplaceLane(int32_t);
7111cb0ef41Sopenharmony_ci  const Operator* F64x2Eq();
7121cb0ef41Sopenharmony_ci  const Operator* F64x2Ne();
7131cb0ef41Sopenharmony_ci  const Operator* F64x2Lt();
7141cb0ef41Sopenharmony_ci  const Operator* F64x2Le();
7151cb0ef41Sopenharmony_ci  const Operator* F64x2Qfma();
7161cb0ef41Sopenharmony_ci  const Operator* F64x2Qfms();
7171cb0ef41Sopenharmony_ci  const Operator* F64x2Pmin();
7181cb0ef41Sopenharmony_ci  const Operator* F64x2Pmax();
7191cb0ef41Sopenharmony_ci  const Operator* F64x2Ceil();
7201cb0ef41Sopenharmony_ci  const Operator* F64x2Floor();
7211cb0ef41Sopenharmony_ci  const Operator* F64x2Trunc();
7221cb0ef41Sopenharmony_ci  const Operator* F64x2NearestInt();
7231cb0ef41Sopenharmony_ci  const Operator* F64x2ConvertLowI32x4S();
7241cb0ef41Sopenharmony_ci  const Operator* F64x2ConvertLowI32x4U();
7251cb0ef41Sopenharmony_ci  const Operator* F64x2PromoteLowF32x4();
7261cb0ef41Sopenharmony_ci
7271cb0ef41Sopenharmony_ci  const Operator* F32x4Splat();
7281cb0ef41Sopenharmony_ci  const Operator* F32x4ExtractLane(int32_t);
7291cb0ef41Sopenharmony_ci  const Operator* F32x4ReplaceLane(int32_t);
7301cb0ef41Sopenharmony_ci  const Operator* F32x4SConvertI32x4();
7311cb0ef41Sopenharmony_ci  const Operator* F32x4UConvertI32x4();
7321cb0ef41Sopenharmony_ci  const Operator* F32x4Abs();
7331cb0ef41Sopenharmony_ci  const Operator* F32x4Neg();
7341cb0ef41Sopenharmony_ci  const Operator* F32x4Sqrt();
7351cb0ef41Sopenharmony_ci  const Operator* F32x4RecipApprox();
7361cb0ef41Sopenharmony_ci  const Operator* F32x4RecipSqrtApprox();
7371cb0ef41Sopenharmony_ci  const Operator* F32x4Add();
7381cb0ef41Sopenharmony_ci  const Operator* F32x4Sub();
7391cb0ef41Sopenharmony_ci  const Operator* F32x4Mul();
7401cb0ef41Sopenharmony_ci  const Operator* F32x4Div();
7411cb0ef41Sopenharmony_ci  const Operator* F32x4Min();
7421cb0ef41Sopenharmony_ci  const Operator* F32x4Max();
7431cb0ef41Sopenharmony_ci  const Operator* F32x4Eq();
7441cb0ef41Sopenharmony_ci  const Operator* F32x4Ne();
7451cb0ef41Sopenharmony_ci  const Operator* F32x4Lt();
7461cb0ef41Sopenharmony_ci  const Operator* F32x4Le();
7471cb0ef41Sopenharmony_ci  const Operator* F32x4Qfma();
7481cb0ef41Sopenharmony_ci  const Operator* F32x4Qfms();
7491cb0ef41Sopenharmony_ci  const Operator* F32x4Pmin();
7501cb0ef41Sopenharmony_ci  const Operator* F32x4Pmax();
7511cb0ef41Sopenharmony_ci  const Operator* F32x4Ceil();
7521cb0ef41Sopenharmony_ci  const Operator* F32x4Floor();
7531cb0ef41Sopenharmony_ci  const Operator* F32x4Trunc();
7541cb0ef41Sopenharmony_ci  const Operator* F32x4NearestInt();
7551cb0ef41Sopenharmony_ci  const Operator* F32x4DemoteF64x2Zero();
7561cb0ef41Sopenharmony_ci
7571cb0ef41Sopenharmony_ci  const Operator* I64x2Splat();
7581cb0ef41Sopenharmony_ci  const Operator* I64x2SplatI32Pair();
7591cb0ef41Sopenharmony_ci  const Operator* I64x2ExtractLane(int32_t);
7601cb0ef41Sopenharmony_ci  const Operator* I64x2ReplaceLane(int32_t);
7611cb0ef41Sopenharmony_ci  const Operator* I64x2ReplaceLaneI32Pair(int32_t);
7621cb0ef41Sopenharmony_ci  const Operator* I64x2Abs();
7631cb0ef41Sopenharmony_ci  const Operator* I64x2Neg();
7641cb0ef41Sopenharmony_ci  const Operator* I64x2SConvertI32x4Low();
7651cb0ef41Sopenharmony_ci  const Operator* I64x2SConvertI32x4High();
7661cb0ef41Sopenharmony_ci  const Operator* I64x2UConvertI32x4Low();
7671cb0ef41Sopenharmony_ci  const Operator* I64x2UConvertI32x4High();
7681cb0ef41Sopenharmony_ci  const Operator* I64x2BitMask();
7691cb0ef41Sopenharmony_ci  const Operator* I64x2Shl();
7701cb0ef41Sopenharmony_ci  const Operator* I64x2ShrS();
7711cb0ef41Sopenharmony_ci  const Operator* I64x2Add();
7721cb0ef41Sopenharmony_ci  const Operator* I64x2Sub();
7731cb0ef41Sopenharmony_ci  const Operator* I64x2Mul();
7741cb0ef41Sopenharmony_ci  const Operator* I64x2Eq();
7751cb0ef41Sopenharmony_ci  const Operator* I64x2Ne();
7761cb0ef41Sopenharmony_ci  const Operator* I64x2GtS();
7771cb0ef41Sopenharmony_ci  const Operator* I64x2GeS();
7781cb0ef41Sopenharmony_ci  const Operator* I64x2ShrU();
7791cb0ef41Sopenharmony_ci  const Operator* I64x2ExtMulLowI32x4S();
7801cb0ef41Sopenharmony_ci  const Operator* I64x2ExtMulHighI32x4S();
7811cb0ef41Sopenharmony_ci  const Operator* I64x2ExtMulLowI32x4U();
7821cb0ef41Sopenharmony_ci  const Operator* I64x2ExtMulHighI32x4U();
7831cb0ef41Sopenharmony_ci
7841cb0ef41Sopenharmony_ci  const Operator* I32x4Splat();
7851cb0ef41Sopenharmony_ci  const Operator* I32x4ExtractLane(int32_t);
7861cb0ef41Sopenharmony_ci  const Operator* I32x4ReplaceLane(int32_t);
7871cb0ef41Sopenharmony_ci  const Operator* I32x4SConvertF32x4();
7881cb0ef41Sopenharmony_ci  const Operator* I32x4SConvertI16x8Low();
7891cb0ef41Sopenharmony_ci  const Operator* I32x4SConvertI16x8High();
7901cb0ef41Sopenharmony_ci  const Operator* I32x4Neg();
7911cb0ef41Sopenharmony_ci  const Operator* I32x4Shl();
7921cb0ef41Sopenharmony_ci  const Operator* I32x4ShrS();
7931cb0ef41Sopenharmony_ci  const Operator* I32x4Add();
7941cb0ef41Sopenharmony_ci  const Operator* I32x4Sub();
7951cb0ef41Sopenharmony_ci  const Operator* I32x4Mul();
7961cb0ef41Sopenharmony_ci  const Operator* I32x4MinS();
7971cb0ef41Sopenharmony_ci  const Operator* I32x4MaxS();
7981cb0ef41Sopenharmony_ci  const Operator* I32x4Eq();
7991cb0ef41Sopenharmony_ci  const Operator* I32x4Ne();
8001cb0ef41Sopenharmony_ci  const Operator* I32x4GtS();
8011cb0ef41Sopenharmony_ci  const Operator* I32x4GeS();
8021cb0ef41Sopenharmony_ci
8031cb0ef41Sopenharmony_ci  const Operator* I32x4UConvertF32x4();
8041cb0ef41Sopenharmony_ci  const Operator* I32x4UConvertI16x8Low();
8051cb0ef41Sopenharmony_ci  const Operator* I32x4UConvertI16x8High();
8061cb0ef41Sopenharmony_ci  const Operator* I32x4ShrU();
8071cb0ef41Sopenharmony_ci  const Operator* I32x4MinU();
8081cb0ef41Sopenharmony_ci  const Operator* I32x4MaxU();
8091cb0ef41Sopenharmony_ci  const Operator* I32x4GtU();
8101cb0ef41Sopenharmony_ci  const Operator* I32x4GeU();
8111cb0ef41Sopenharmony_ci  const Operator* I32x4Abs();
8121cb0ef41Sopenharmony_ci  const Operator* I32x4BitMask();
8131cb0ef41Sopenharmony_ci  const Operator* I32x4DotI16x8S();
8141cb0ef41Sopenharmony_ci  const Operator* I32x4ExtMulLowI16x8S();
8151cb0ef41Sopenharmony_ci  const Operator* I32x4ExtMulHighI16x8S();
8161cb0ef41Sopenharmony_ci  const Operator* I32x4ExtMulLowI16x8U();
8171cb0ef41Sopenharmony_ci  const Operator* I32x4ExtMulHighI16x8U();
8181cb0ef41Sopenharmony_ci  const Operator* I32x4ExtAddPairwiseI16x8S();
8191cb0ef41Sopenharmony_ci  const Operator* I32x4ExtAddPairwiseI16x8U();
8201cb0ef41Sopenharmony_ci  const Operator* I32x4TruncSatF64x2SZero();
8211cb0ef41Sopenharmony_ci  const Operator* I32x4TruncSatF64x2UZero();
8221cb0ef41Sopenharmony_ci
8231cb0ef41Sopenharmony_ci  const Operator* I16x8Splat();
8241cb0ef41Sopenharmony_ci  const Operator* I16x8ExtractLaneU(int32_t);
8251cb0ef41Sopenharmony_ci  const Operator* I16x8ExtractLaneS(int32_t);
8261cb0ef41Sopenharmony_ci  const Operator* I16x8ReplaceLane(int32_t);
8271cb0ef41Sopenharmony_ci  const Operator* I16x8SConvertI8x16Low();
8281cb0ef41Sopenharmony_ci  const Operator* I16x8SConvertI8x16High();
8291cb0ef41Sopenharmony_ci  const Operator* I16x8Neg();
8301cb0ef41Sopenharmony_ci  const Operator* I16x8Shl();
8311cb0ef41Sopenharmony_ci  const Operator* I16x8ShrS();
8321cb0ef41Sopenharmony_ci  const Operator* I16x8SConvertI32x4();
8331cb0ef41Sopenharmony_ci  const Operator* I16x8Add();
8341cb0ef41Sopenharmony_ci  const Operator* I16x8AddSatS();
8351cb0ef41Sopenharmony_ci  const Operator* I16x8Sub();
8361cb0ef41Sopenharmony_ci  const Operator* I16x8SubSatS();
8371cb0ef41Sopenharmony_ci  const Operator* I16x8Mul();
8381cb0ef41Sopenharmony_ci  const Operator* I16x8MinS();
8391cb0ef41Sopenharmony_ci  const Operator* I16x8MaxS();
8401cb0ef41Sopenharmony_ci  const Operator* I16x8Eq();
8411cb0ef41Sopenharmony_ci  const Operator* I16x8Ne();
8421cb0ef41Sopenharmony_ci  const Operator* I16x8GtS();
8431cb0ef41Sopenharmony_ci  const Operator* I16x8GeS();
8441cb0ef41Sopenharmony_ci
8451cb0ef41Sopenharmony_ci  const Operator* I16x8UConvertI8x16Low();
8461cb0ef41Sopenharmony_ci  const Operator* I16x8UConvertI8x16High();
8471cb0ef41Sopenharmony_ci  const Operator* I16x8ShrU();
8481cb0ef41Sopenharmony_ci  const Operator* I16x8UConvertI32x4();
8491cb0ef41Sopenharmony_ci  const Operator* I16x8AddSatU();
8501cb0ef41Sopenharmony_ci  const Operator* I16x8SubSatU();
8511cb0ef41Sopenharmony_ci  const Operator* I16x8MinU();
8521cb0ef41Sopenharmony_ci  const Operator* I16x8MaxU();
8531cb0ef41Sopenharmony_ci  const Operator* I16x8GtU();
8541cb0ef41Sopenharmony_ci  const Operator* I16x8GeU();
8551cb0ef41Sopenharmony_ci  const Operator* I16x8RoundingAverageU();
8561cb0ef41Sopenharmony_ci  const Operator* I16x8Q15MulRSatS();
8571cb0ef41Sopenharmony_ci  const Operator* I16x8Abs();
8581cb0ef41Sopenharmony_ci  const Operator* I16x8BitMask();
8591cb0ef41Sopenharmony_ci  const Operator* I16x8ExtMulLowI8x16S();
8601cb0ef41Sopenharmony_ci  const Operator* I16x8ExtMulHighI8x16S();
8611cb0ef41Sopenharmony_ci  const Operator* I16x8ExtMulLowI8x16U();
8621cb0ef41Sopenharmony_ci  const Operator* I16x8ExtMulHighI8x16U();
8631cb0ef41Sopenharmony_ci  const Operator* I16x8ExtAddPairwiseI8x16S();
8641cb0ef41Sopenharmony_ci  const Operator* I16x8ExtAddPairwiseI8x16U();
8651cb0ef41Sopenharmony_ci
8661cb0ef41Sopenharmony_ci  const Operator* I8x16Splat();
8671cb0ef41Sopenharmony_ci  const Operator* I8x16ExtractLaneU(int32_t);
8681cb0ef41Sopenharmony_ci  const Operator* I8x16ExtractLaneS(int32_t);
8691cb0ef41Sopenharmony_ci  const Operator* I8x16ReplaceLane(int32_t);
8701cb0ef41Sopenharmony_ci  const Operator* I8x16Neg();
8711cb0ef41Sopenharmony_ci  const Operator* I8x16Shl();
8721cb0ef41Sopenharmony_ci  const Operator* I8x16ShrS();
8731cb0ef41Sopenharmony_ci  const Operator* I8x16SConvertI16x8();
8741cb0ef41Sopenharmony_ci  const Operator* I8x16Add();
8751cb0ef41Sopenharmony_ci  const Operator* I8x16AddSatS();
8761cb0ef41Sopenharmony_ci  const Operator* I8x16Sub();
8771cb0ef41Sopenharmony_ci  const Operator* I8x16SubSatS();
8781cb0ef41Sopenharmony_ci  const Operator* I8x16MinS();
8791cb0ef41Sopenharmony_ci  const Operator* I8x16MaxS();
8801cb0ef41Sopenharmony_ci  const Operator* I8x16Eq();
8811cb0ef41Sopenharmony_ci  const Operator* I8x16Ne();
8821cb0ef41Sopenharmony_ci  const Operator* I8x16GtS();
8831cb0ef41Sopenharmony_ci  const Operator* I8x16GeS();
8841cb0ef41Sopenharmony_ci
8851cb0ef41Sopenharmony_ci  const Operator* I8x16ShrU();
8861cb0ef41Sopenharmony_ci  const Operator* I8x16UConvertI16x8();
8871cb0ef41Sopenharmony_ci  const Operator* I8x16AddSatU();
8881cb0ef41Sopenharmony_ci  const Operator* I8x16SubSatU();
8891cb0ef41Sopenharmony_ci  const Operator* I8x16MinU();
8901cb0ef41Sopenharmony_ci  const Operator* I8x16MaxU();
8911cb0ef41Sopenharmony_ci  const Operator* I8x16GtU();
8921cb0ef41Sopenharmony_ci  const Operator* I8x16GeU();
8931cb0ef41Sopenharmony_ci  const Operator* I8x16RoundingAverageU();
8941cb0ef41Sopenharmony_ci  const Operator* I8x16Popcnt();
8951cb0ef41Sopenharmony_ci  const Operator* I8x16Abs();
8961cb0ef41Sopenharmony_ci  const Operator* I8x16BitMask();
8971cb0ef41Sopenharmony_ci
8981cb0ef41Sopenharmony_ci  const Operator* S128Const(const uint8_t value[16]);
8991cb0ef41Sopenharmony_ci
9001cb0ef41Sopenharmony_ci  const Operator* S128Zero();
9011cb0ef41Sopenharmony_ci  const Operator* S128And();
9021cb0ef41Sopenharmony_ci  const Operator* S128Or();
9031cb0ef41Sopenharmony_ci  const Operator* S128Xor();
9041cb0ef41Sopenharmony_ci  const Operator* S128Not();
9051cb0ef41Sopenharmony_ci  const Operator* S128Select();
9061cb0ef41Sopenharmony_ci  const Operator* S128AndNot();
9071cb0ef41Sopenharmony_ci
9081cb0ef41Sopenharmony_ci  const Operator* I8x16Swizzle(bool relaxed = false);
9091cb0ef41Sopenharmony_ci  const Operator* I8x16Shuffle(const uint8_t shuffle[16]);
9101cb0ef41Sopenharmony_ci
9111cb0ef41Sopenharmony_ci  const Operator* V128AnyTrue();
9121cb0ef41Sopenharmony_ci  const Operator* I64x2AllTrue();
9131cb0ef41Sopenharmony_ci  const Operator* I32x4AllTrue();
9141cb0ef41Sopenharmony_ci  const Operator* I16x8AllTrue();
9151cb0ef41Sopenharmony_ci  const Operator* I8x16AllTrue();
9161cb0ef41Sopenharmony_ci
9171cb0ef41Sopenharmony_ci  // Relaxed SIMD operators.
9181cb0ef41Sopenharmony_ci  const Operator* I8x16RelaxedLaneSelect();
9191cb0ef41Sopenharmony_ci  const Operator* I16x8RelaxedLaneSelect();
9201cb0ef41Sopenharmony_ci  const Operator* I32x4RelaxedLaneSelect();
9211cb0ef41Sopenharmony_ci  const Operator* I64x2RelaxedLaneSelect();
9221cb0ef41Sopenharmony_ci  const Operator* F32x4RelaxedMin();
9231cb0ef41Sopenharmony_ci  const Operator* F32x4RelaxedMax();
9241cb0ef41Sopenharmony_ci  const Operator* F64x2RelaxedMin();
9251cb0ef41Sopenharmony_ci  const Operator* F64x2RelaxedMax();
9261cb0ef41Sopenharmony_ci  const Operator* I32x4RelaxedTruncF32x4S();
9271cb0ef41Sopenharmony_ci  const Operator* I32x4RelaxedTruncF32x4U();
9281cb0ef41Sopenharmony_ci  const Operator* I32x4RelaxedTruncF64x2SZero();
9291cb0ef41Sopenharmony_ci  const Operator* I32x4RelaxedTruncF64x2UZero();
9301cb0ef41Sopenharmony_ci
9311cb0ef41Sopenharmony_ci  // load [base + index]
9321cb0ef41Sopenharmony_ci  const Operator* Load(LoadRepresentation rep);
9331cb0ef41Sopenharmony_ci  const Operator* LoadImmutable(LoadRepresentation rep);
9341cb0ef41Sopenharmony_ci  const Operator* ProtectedLoad(LoadRepresentation rep);
9351cb0ef41Sopenharmony_ci
9361cb0ef41Sopenharmony_ci  const Operator* LoadTransform(MemoryAccessKind kind,
9371cb0ef41Sopenharmony_ci                                LoadTransformation transform);
9381cb0ef41Sopenharmony_ci
9391cb0ef41Sopenharmony_ci  // SIMD load: replace a specified lane with [base + index].
9401cb0ef41Sopenharmony_ci  const Operator* LoadLane(MemoryAccessKind kind, LoadRepresentation rep,
9411cb0ef41Sopenharmony_ci                           uint8_t laneidx);
9421cb0ef41Sopenharmony_ci
9431cb0ef41Sopenharmony_ci  // store [base + index], value
9441cb0ef41Sopenharmony_ci  const Operator* Store(StoreRepresentation rep);
9451cb0ef41Sopenharmony_ci  const Operator* ProtectedStore(MachineRepresentation rep);
9461cb0ef41Sopenharmony_ci
9471cb0ef41Sopenharmony_ci  // SIMD store: store a specified lane of value into [base + index].
9481cb0ef41Sopenharmony_ci  const Operator* StoreLane(MemoryAccessKind kind, MachineRepresentation rep,
9491cb0ef41Sopenharmony_ci                            uint8_t laneidx);
9501cb0ef41Sopenharmony_ci
9511cb0ef41Sopenharmony_ci  // unaligned load [base + index]
9521cb0ef41Sopenharmony_ci  const Operator* UnalignedLoad(LoadRepresentation rep);
9531cb0ef41Sopenharmony_ci
9541cb0ef41Sopenharmony_ci  // unaligned store [base + index], value
9551cb0ef41Sopenharmony_ci  const Operator* UnalignedStore(UnalignedStoreRepresentation rep);
9561cb0ef41Sopenharmony_ci
9571cb0ef41Sopenharmony_ci  const Operator* StackSlot(int size, int alignment = 0);
9581cb0ef41Sopenharmony_ci  const Operator* StackSlot(MachineRepresentation rep, int alignment = 0);
9591cb0ef41Sopenharmony_ci
9601cb0ef41Sopenharmony_ci  // Access to the machine stack.
9611cb0ef41Sopenharmony_ci  const Operator* LoadFramePointer();
9621cb0ef41Sopenharmony_ci  const Operator* LoadParentFramePointer();
9631cb0ef41Sopenharmony_ci
9641cb0ef41Sopenharmony_ci  // Compares: stack_pointer [- offset] > value. The offset is optionally
9651cb0ef41Sopenharmony_ci  // applied for kFunctionEntry stack checks.
9661cb0ef41Sopenharmony_ci  const Operator* StackPointerGreaterThan(StackCheckKind kind);
9671cb0ef41Sopenharmony_ci
9681cb0ef41Sopenharmony_ci  // Loads the offset that should be applied to the current stack
9691cb0ef41Sopenharmony_ci  // pointer before a stack check. Used as input to the
9701cb0ef41Sopenharmony_ci  // Runtime::kStackGuardWithGap call.
9711cb0ef41Sopenharmony_ci  const Operator* LoadStackCheckOffset();
9721cb0ef41Sopenharmony_ci
9731cb0ef41Sopenharmony_ci  // Memory barrier.
9741cb0ef41Sopenharmony_ci  const Operator* MemBarrier();
9751cb0ef41Sopenharmony_ci
9761cb0ef41Sopenharmony_ci  // atomic-load [base + index]
9771cb0ef41Sopenharmony_ci  const Operator* Word32AtomicLoad(AtomicLoadParameters params);
9781cb0ef41Sopenharmony_ci  // atomic-load [base + index]
9791cb0ef41Sopenharmony_ci  const Operator* Word64AtomicLoad(AtomicLoadParameters params);
9801cb0ef41Sopenharmony_ci  // atomic-store [base + index], value
9811cb0ef41Sopenharmony_ci  const Operator* Word32AtomicStore(AtomicStoreParameters params);
9821cb0ef41Sopenharmony_ci  // atomic-store [base + index], value
9831cb0ef41Sopenharmony_ci  const Operator* Word64AtomicStore(AtomicStoreParameters params);
9841cb0ef41Sopenharmony_ci  // atomic-exchange [base + index], value
9851cb0ef41Sopenharmony_ci  const Operator* Word32AtomicExchange(MachineType type);
9861cb0ef41Sopenharmony_ci  // atomic-exchange [base + index], value
9871cb0ef41Sopenharmony_ci  const Operator* Word64AtomicExchange(MachineType type);
9881cb0ef41Sopenharmony_ci  // atomic-compare-exchange [base + index], old_value, new_value
9891cb0ef41Sopenharmony_ci  const Operator* Word32AtomicCompareExchange(MachineType type);
9901cb0ef41Sopenharmony_ci  // atomic-compare-exchange [base + index], old_value, new_value
9911cb0ef41Sopenharmony_ci  const Operator* Word64AtomicCompareExchange(MachineType type);
9921cb0ef41Sopenharmony_ci  // atomic-add [base + index], value
9931cb0ef41Sopenharmony_ci  const Operator* Word32AtomicAdd(MachineType type);
9941cb0ef41Sopenharmony_ci  // atomic-sub [base + index], value
9951cb0ef41Sopenharmony_ci  const Operator* Word32AtomicSub(MachineType type);
9961cb0ef41Sopenharmony_ci  // atomic-and [base + index], value
9971cb0ef41Sopenharmony_ci  const Operator* Word32AtomicAnd(MachineType type);
9981cb0ef41Sopenharmony_ci  // atomic-or [base + index], value
9991cb0ef41Sopenharmony_ci  const Operator* Word32AtomicOr(MachineType type);
10001cb0ef41Sopenharmony_ci  // atomic-xor [base + index], value
10011cb0ef41Sopenharmony_ci  const Operator* Word32AtomicXor(MachineType type);
10021cb0ef41Sopenharmony_ci  // atomic-add [base + index], value
10031cb0ef41Sopenharmony_ci  const Operator* Word64AtomicAdd(MachineType type);
10041cb0ef41Sopenharmony_ci  // atomic-sub [base + index], value
10051cb0ef41Sopenharmony_ci  const Operator* Word64AtomicSub(MachineType type);
10061cb0ef41Sopenharmony_ci  // atomic-and [base + index], value
10071cb0ef41Sopenharmony_ci  const Operator* Word64AtomicAnd(MachineType type);
10081cb0ef41Sopenharmony_ci  // atomic-or [base + index], value
10091cb0ef41Sopenharmony_ci  const Operator* Word64AtomicOr(MachineType type);
10101cb0ef41Sopenharmony_ci  // atomic-xor [base + index], value
10111cb0ef41Sopenharmony_ci  const Operator* Word64AtomicXor(MachineType type);
10121cb0ef41Sopenharmony_ci  // atomic-pair-load [base + index]
10131cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairLoad(AtomicMemoryOrder order);
10141cb0ef41Sopenharmony_ci  // atomic-pair-sub [base + index], value_high, value-low
10151cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairStore(AtomicMemoryOrder order);
10161cb0ef41Sopenharmony_ci  // atomic-pair-add [base + index], value_high, value_low
10171cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairAdd();
10181cb0ef41Sopenharmony_ci  // atomic-pair-sub [base + index], value_high, value-low
10191cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairSub();
10201cb0ef41Sopenharmony_ci  // atomic-pair-and [base + index], value_high, value_low
10211cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairAnd();
10221cb0ef41Sopenharmony_ci  // atomic-pair-or [base + index], value_high, value_low
10231cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairOr();
10241cb0ef41Sopenharmony_ci  // atomic-pair-xor [base + index], value_high, value_low
10251cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairXor();
10261cb0ef41Sopenharmony_ci  // atomic-pair-exchange [base + index], value_high, value_low
10271cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairExchange();
10281cb0ef41Sopenharmony_ci  // atomic-pair-compare-exchange [base + index], old_value_high, old_value_low,
10291cb0ef41Sopenharmony_ci  // new_value_high, new_value_low
10301cb0ef41Sopenharmony_ci  const Operator* Word32AtomicPairCompareExchange();
10311cb0ef41Sopenharmony_ci
10321cb0ef41Sopenharmony_ci  // Target machine word-size assumed by this builder.
10331cb0ef41Sopenharmony_ci  bool Is32() const { return word() == MachineRepresentation::kWord32; }
10341cb0ef41Sopenharmony_ci  bool Is64() const { return word() == MachineRepresentation::kWord64; }
10351cb0ef41Sopenharmony_ci  MachineRepresentation word() const { return word_; }
10361cb0ef41Sopenharmony_ci
10371cb0ef41Sopenharmony_ci  bool UnalignedLoadSupported(MachineRepresentation rep) {
10381cb0ef41Sopenharmony_ci    return alignment_requirements_.IsUnalignedLoadSupported(rep);
10391cb0ef41Sopenharmony_ci  }
10401cb0ef41Sopenharmony_ci
10411cb0ef41Sopenharmony_ci  bool UnalignedStoreSupported(MachineRepresentation rep) {
10421cb0ef41Sopenharmony_ci    return alignment_requirements_.IsUnalignedStoreSupported(rep);
10431cb0ef41Sopenharmony_ci  }
10441cb0ef41Sopenharmony_ci
10451cb0ef41Sopenharmony_ci// Pseudo operators that translate to 32/64-bit operators depending on the
10461cb0ef41Sopenharmony_ci// word-size of the target machine assumed by this builder.
10471cb0ef41Sopenharmony_ci#define PSEUDO_OP_LIST(V)      \
10481cb0ef41Sopenharmony_ci  V(Word, And)                 \
10491cb0ef41Sopenharmony_ci  V(Word, Or)                  \
10501cb0ef41Sopenharmony_ci  V(Word, Xor)                 \
10511cb0ef41Sopenharmony_ci  V(Word, Shl)                 \
10521cb0ef41Sopenharmony_ci  V(Word, Shr)                 \
10531cb0ef41Sopenharmony_ci  V(Word, Ror)                 \
10541cb0ef41Sopenharmony_ci  V(Word, Clz)                 \
10551cb0ef41Sopenharmony_ci  V(Word, Equal)               \
10561cb0ef41Sopenharmony_ci  V(Int, Add)                  \
10571cb0ef41Sopenharmony_ci  V(Int, Sub)                  \
10581cb0ef41Sopenharmony_ci  V(Int, Mul)                  \
10591cb0ef41Sopenharmony_ci  V(Int, Div)                  \
10601cb0ef41Sopenharmony_ci  V(Int, Mod)                  \
10611cb0ef41Sopenharmony_ci  V(Int, LessThan)             \
10621cb0ef41Sopenharmony_ci  V(Int, LessThanOrEqual)      \
10631cb0ef41Sopenharmony_ci  V(Uint, Div)                 \
10641cb0ef41Sopenharmony_ci  V(Uint, LessThan)            \
10651cb0ef41Sopenharmony_ci  V(Uint, Mod)
10661cb0ef41Sopenharmony_ci#define PSEUDO_OP(Prefix, Suffix)                                \
10671cb0ef41Sopenharmony_ci  const Operator* Prefix##Suffix() {                             \
10681cb0ef41Sopenharmony_ci    return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \
10691cb0ef41Sopenharmony_ci  }
10701cb0ef41Sopenharmony_ci  PSEUDO_OP_LIST(PSEUDO_OP)
10711cb0ef41Sopenharmony_ci#undef PSEUDO_OP
10721cb0ef41Sopenharmony_ci#undef PSEUDO_OP_LIST
10731cb0ef41Sopenharmony_ci
10741cb0ef41Sopenharmony_ci  const Operator* WordSar(ShiftKind kind = ShiftKind::kNormal) {
10751cb0ef41Sopenharmony_ci    return Is32() ? Word32Sar(kind) : Word64Sar(kind);
10761cb0ef41Sopenharmony_ci  }
10771cb0ef41Sopenharmony_ci  const Operator* WordSarShiftOutZeros() {
10781cb0ef41Sopenharmony_ci    return WordSar(ShiftKind::kShiftOutZeros);
10791cb0ef41Sopenharmony_ci  }
10801cb0ef41Sopenharmony_ci
10811cb0ef41Sopenharmony_ci private:
10821cb0ef41Sopenharmony_ci  Zone* zone_;
10831cb0ef41Sopenharmony_ci  MachineOperatorGlobalCache const& cache_;
10841cb0ef41Sopenharmony_ci  MachineRepresentation const word_;
10851cb0ef41Sopenharmony_ci  Flags const flags_;
10861cb0ef41Sopenharmony_ci  AlignmentRequirements const alignment_requirements_;
10871cb0ef41Sopenharmony_ci};
10881cb0ef41Sopenharmony_ci
10891cb0ef41Sopenharmony_ci
10901cb0ef41Sopenharmony_ciDEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
10911cb0ef41Sopenharmony_ci
10921cb0ef41Sopenharmony_ci}  // namespace compiler
10931cb0ef41Sopenharmony_ci}  // namespace internal
10941cb0ef41Sopenharmony_ci}  // namespace v8
10951cb0ef41Sopenharmony_ci
10961cb0ef41Sopenharmony_ci#endif  // V8_COMPILER_MACHINE_OPERATOR_H_
1097