5#ifndef V8_COMPILER_TURBOSHAFT_WASM_REVEC_REDUCER_H_ 
    6#define V8_COMPILER_TURBOSHAFT_WASM_REVEC_REDUCER_H_ 
    8#if !V8_ENABLE_WEBASSEMBLY 
    9#error This header should only be included if WebAssembly is enabled. 
   23#define SIMD256_LOADTRANSFORM_OP(V) \ 
 
   35#define SIMD256_UNARY_SIMPLE_OP(V)                         \ 
   37  V(I8x16Abs, I8x32Abs)                                    \ 
   38  V(I8x16Neg, I8x32Neg)                                    \ 
   39  V(I16x8ExtAddPairwiseI8x16S, I16x16ExtAddPairwiseI8x32S) \ 
   40  V(I16x8ExtAddPairwiseI8x16U, I16x16ExtAddPairwiseI8x32U) \ 
   41  V(I32x4ExtAddPairwiseI16x8S, I32x8ExtAddPairwiseI16x16S) \ 
   42  V(I32x4ExtAddPairwiseI16x8U, I32x8ExtAddPairwiseI16x16U) \ 
   43  V(I16x8Abs, I16x16Abs)                                   \ 
   44  V(I16x8Neg, I16x16Neg)                                   \ 
   45  V(I32x4Abs, I32x8Abs)                                    \ 
   46  V(I32x4Neg, I32x8Neg)                                    \ 
   47  V(F32x4Abs, F32x8Abs)                                    \ 
   48  V(F32x4Neg, F32x8Neg)                                    \ 
   49  V(F32x4Sqrt, F32x8Sqrt)                                  \ 
   50  V(F64x2Abs, F64x4Abs)                                    \ 
   51  V(F64x2Neg, F64x4Neg)                                    \ 
   52  V(F64x2Sqrt, F64x4Sqrt)                                  \ 
   53  V(I32x4UConvertF32x4, I32x8UConvertF32x8)                \ 
   54  V(I32x4SConvertF32x4, I32x8SConvertF32x8)                \ 
   55  V(F32x4UConvertI32x4, F32x8UConvertI32x8)                \ 
   56  V(F32x4SConvertI32x4, F32x8SConvertI32x8)                \ 
   57  V(I32x4RelaxedTruncF32x4S, I32x8RelaxedTruncF32x8S)      \ 
   58  V(I32x4RelaxedTruncF32x4U, I32x8RelaxedTruncF32x8U) 
 
   60#define SIMD256_UNARY_SIGN_EXTENSION_OP(V)                              \ 
   61  V(I64x2SConvertI32x4Low, I64x4SConvertI32x4, I64x2SConvertI32x4High)  \ 
   62  V(I64x2UConvertI32x4Low, I64x4UConvertI32x4, I64x2UConvertI32x4High)  \ 
   63  V(I32x4SConvertI16x8Low, I32x8SConvertI16x8, I32x4SConvertI16x8High)  \ 
   64  V(I32x4UConvertI16x8Low, I32x8UConvertI16x8, I32x4UConvertI16x8High)  \ 
   65  V(I16x8SConvertI8x16Low, I16x16SConvertI8x16, I16x8SConvertI8x16High) \ 
   66  V(I16x8UConvertI8x16Low, I16x16UConvertI8x16, I16x8UConvertI8x16High) 
 
   68#define SIMD256_BINOP_SIMPLE_OP(V)                 \ 
   71  V(I8x16GtS, I8x32GtS)                            \ 
   72  V(I8x16GtU, I8x32GtU)                            \ 
   73  V(I8x16GeS, I8x32GeS)                            \ 
   74  V(I8x16GeU, I8x32GeU)                            \ 
   75  V(I16x8Eq, I16x16Eq)                             \ 
   76  V(I16x8Ne, I16x16Ne)                             \ 
   77  V(I16x8GtS, I16x16GtS)                           \ 
   78  V(I16x8GtU, I16x16GtU)                           \ 
   79  V(I16x8GeS, I16x16GeS)                           \ 
   80  V(I16x8GeU, I16x16GeU)                           \ 
   83  V(I32x4GtS, I32x8GtS)                            \ 
   84  V(I32x4GtU, I32x8GtU)                            \ 
   85  V(I32x4GeS, I32x8GeS)                            \ 
   86  V(I32x4GeU, I32x8GeU)                            \ 
   96  V(S128AndNot, S256AndNot)                        \ 
   99  V(I8x16SConvertI16x8, I8x32SConvertI16x16)       \ 
  100  V(I8x16UConvertI16x8, I8x32UConvertI16x16)       \ 
  101  V(I8x16Add, I8x32Add)                            \ 
  102  V(I8x16AddSatS, I8x32AddSatS)                    \ 
  103  V(I8x16AddSatU, I8x32AddSatU)                    \ 
  104  V(I8x16Sub, I8x32Sub)                            \ 
  105  V(I8x16SubSatS, I8x32SubSatS)                    \ 
  106  V(I8x16SubSatU, I8x32SubSatU)                    \ 
  107  V(I8x16MinS, I8x32MinS)                          \ 
  108  V(I8x16MinU, I8x32MinU)                          \ 
  109  V(I8x16MaxS, I8x32MaxS)                          \ 
  110  V(I8x16MaxU, I8x32MaxU)                          \ 
  111  V(I8x16RoundingAverageU, I8x32RoundingAverageU)  \ 
  112  V(I16x8SConvertI32x4, I16x16SConvertI32x8)       \ 
  113  V(I16x8UConvertI32x4, I16x16UConvertI32x8)       \ 
  114  V(I16x8Add, I16x16Add)                           \ 
  115  V(I16x8AddSatS, I16x16AddSatS)                   \ 
  116  V(I16x8AddSatU, I16x16AddSatU)                   \ 
  117  V(I16x8Sub, I16x16Sub)                           \ 
  118  V(I16x8SubSatS, I16x16SubSatS)                   \ 
  119  V(I16x8SubSatU, I16x16SubSatU)                   \ 
  120  V(I16x8Mul, I16x16Mul)                           \ 
  121  V(I16x8MinS, I16x16MinS)                         \ 
  122  V(I16x8MinU, I16x16MinU)                         \ 
  123  V(I16x8MaxS, I16x16MaxS)                         \ 
  124  V(I16x8MaxU, I16x16MaxU)                         \ 
  125  V(I16x8RoundingAverageU, I16x16RoundingAverageU) \ 
  126  V(I32x4Add, I32x8Add)                            \ 
  127  V(I32x4Sub, I32x8Sub)                            \ 
  128  V(I32x4Mul, I32x8Mul)                            \ 
  129  V(I32x4MinS, I32x8MinS)                          \ 
  130  V(I32x4MinU, I32x8MinU)                          \ 
  131  V(I32x4MaxS, I32x8MaxS)                          \ 
  132  V(I32x4MaxU, I32x8MaxU)                          \ 
  133  V(I32x4DotI16x8S, I32x8DotI16x16S)               \ 
  134  V(I64x2Add, I64x4Add)                            \ 
  135  V(I64x2Sub, I64x4Sub)                            \ 
  136  V(I64x2Mul, I64x4Mul)                            \ 
  137  V(I64x2Eq, I64x4Eq)                              \ 
  138  V(I64x2Ne, I64x4Ne)                              \ 
  139  V(I64x2GtS, I64x4GtS)                            \ 
  140  V(I64x2GeS, I64x4GeS)                            \ 
  141  V(F32x4Add, F32x8Add)                            \ 
  142  V(F32x4Sub, F32x8Sub)                            \ 
  143  V(F32x4Mul, F32x8Mul)                            \ 
  144  V(F32x4Div, F32x8Div)                            \ 
  145  V(F32x4Min, F32x8Min)                            \ 
  146  V(F32x4Max, F32x8Max)                            \ 
  147  V(F32x4Pmin, F32x8Pmin)                          \ 
  148  V(F32x4Pmax, F32x8Pmax)                          \ 
  149  V(F64x2Add, F64x4Add)                            \ 
  150  V(F64x2Sub, F64x4Sub)                            \ 
  151  V(F64x2Mul, F64x4Mul)                            \ 
  152  V(F64x2Div, F64x4Div)                            \ 
  153  V(F64x2Min, F64x4Min)                            \ 
  154  V(F64x2Max, F64x4Max)                            \ 
  155  V(F64x2Pmin, F64x4Pmin)                          \ 
  156  V(F64x2Pmax, F64x4Pmax)                          \ 
  157  V(F32x4RelaxedMin, F32x8RelaxedMin)              \ 
  158  V(F32x4RelaxedMax, F32x8RelaxedMax)              \ 
  159  V(F64x2RelaxedMin, F64x4RelaxedMin)              \ 
  160  V(F64x2RelaxedMax, F64x4RelaxedMax)              \ 
  161  V(I16x8DotI8x16I7x16S, I16x16DotI8x32I7x32S) 
 
  163#define SIMD256_BINOP_SIGN_EXTENSION_OP(V)                           \ 
  164  V(I16x8ExtMulLowI8x16S, I16x16ExtMulI8x16S, I16x8ExtMulHighI8x16S) \ 
  165  V(I16x8ExtMulLowI8x16U, I16x16ExtMulI8x16U, I16x8ExtMulHighI8x16U) \ 
  166  V(I32x4ExtMulLowI16x8S, I32x8ExtMulI16x8S, I32x4ExtMulHighI16x8S)  \ 
  167  V(I32x4ExtMulLowI16x8U, I32x8ExtMulI16x8U, I32x4ExtMulHighI16x8U)  \ 
  168  V(I64x2ExtMulLowI32x4S, I64x4ExtMulI32x4S, I64x2ExtMulHighI32x4S)  \ 
  169  V(I64x2ExtMulLowI32x4U, I64x4ExtMulI32x4U, I64x2ExtMulHighI32x4U) 
 
  171#define SIMD256_SHIFT_OP(V) \ 
  172  V(I16x8Shl, I16x16Shl)    \ 
  173  V(I16x8ShrS, I16x16ShrS)  \ 
  174  V(I16x8ShrU, I16x16ShrU)  \ 
  175  V(I32x4Shl, I32x8Shl)     \ 
  176  V(I32x4ShrS, I32x8ShrS)   \ 
  177  V(I32x4ShrU, I32x8ShrU)   \ 
  178  V(I64x2Shl, I64x4Shl)     \ 
  179  V(I64x2ShrU, I64x4ShrU) 
 
  181#define SIMD256_TERNARY_OP(V)                        \ 
  182  V(S128Select, S256Select)                          \ 
  183  V(F32x4Qfma, F32x8Qfma)                            \ 
  184  V(F32x4Qfms, F32x8Qfms)                            \ 
  185  V(F64x2Qfma, F64x4Qfma)                            \ 
  186  V(F64x2Qfms, F64x4Qfms)                            \ 
  187  V(I8x16RelaxedLaneSelect, I8x32RelaxedLaneSelect)  \ 
  188  V(I16x8RelaxedLaneSelect, I16x16RelaxedLaneSelect) \ 
  189  V(I32x4RelaxedLaneSelect, I32x8RelaxedLaneSelect)  \ 
  190  V(I64x2RelaxedLaneSelect, I64x4RelaxedLaneSelect)  \ 
  191  V(I32x4DotI8x16I7x16AddS, I32x8DotI8x32I7x32AddS) 
 
  193#define SIMD256_SPLAT_OP(V) \ 
 
  201#define REDUCE_SEED_KIND(V) \ 
  209  V(I16x8SConvertI32x4)     \ 
  210  V(I16x8UConvertI32x4)     \ 
  211  V(I8x16SConvertI16x8)     \ 
  212  V(I8x16UConvertI16x8) 
 
  228    return indexes_[0] == other.indexes_[0] && 
indexes_[1] == other.indexes_[1];
 
 
  231    return indexes_[0] != other.indexes_[0] || 
indexes_[1] != other.indexes_[1];
 
 
 
  272    return nodes_ == node_group;
 
 
  308    if (
operands_.size() < 
static_cast<size_t>(index + 1)) {
 
 
 
  352#ifdef V8_TARGET_ARCH_X64 
 
  361#ifdef V8_TARGET_ARCH_X64 
  362      uint8_t shufd_control;
 
  363      uint8_t shufps_control;
 
 
  381#ifdef V8_TARGET_ARCH_X64 
  382    void set_shufd_control(uint8_t control) {
 
  384      param_.shufd_control = control;
 
  386    uint8_t shufd_control()
 const {
 
  388      return param_.shufd_control;
 
  391    void set_shufps_control(uint8_t control) {
 
  393      param_.shufps_control = control;
 
  395    uint8_t shufps_control()
 const {
 
  397      return param_.shufps_control;
 
 
 
  501  void Print(
const char* info);
 
  518                                    int8_t 
offset, uint8_t lane_size,
 
  519                                    bool is_sign_extract, 
bool is_sign_convert);
 
  523                                 int count, 
unsigned depth);
 
  539                                              const uint8_t* shuffle0,
 
  540                                              const uint8_t* shuffle1);
 
  542#ifdef V8_TARGET_ARCH_X64 
  558                                         const uint8_t* shuffle0,
 
  559                                         const uint8_t* shuffle1);
 
  563                                ExtendIntToF32x4Info* info);
 
 
  644  void Print(
const char* info);
 
 
  667    const auto lane = base::checked_cast<uint8_t>(
 
  668        std::find(pnode->nodes().begin(), pnode->nodes().end(), ig_index) -
 
  669        pnode->nodes().begin());
 
  672    if (pnode->is_force_packing()) {
 
  673      SimdPack128To256Op& op = 
__ output_graph()
 
  674                                   .Get(pnode -> RevectorizedNode())
 
  676      return lane == 0 ? op.left() : op.right();
 
  684      if (use_pnode != 
nullptr && !use_pnode->is_force_packing()) {
 
  686        if (
__ input_graph().
Get(use).opcode != Opcode::kStore ||
 
  687            use_pnode->nodes()[0] != use ||
 
  688            use_pnode->nodes()[0] > use_pnode->nodes()[1])
 
  692      return __ Simd256Extract128Lane(og_index, lane);
 
 
  699      V<Simd128> ig_index, 
const Simd128ConstantOp& constant_op) {
 
  702      return Adapter::ReduceInputGraphSimd128Constant(ig_index, constant_op);
 
  707    if (!og_index.
valid()) {
 
  709      const Simd128ConstantOp& op0 =
 
  711      const Simd128ConstantOp& op1 =
 
  717      og_index = 
__ Simd256Constant(value);
 
 
  725      V<Simd128> ig_index, 
const Simd128LoadTransformOp& load_transform) {
 
  728      return Adapter::ReduceInputGraphSimd128LoadTransform(ig_index,
 
  734    if (!og_index.
valid()) {
 
  735      auto base = 
__ MapToNewGraph(load_transform.base());
 
  736      auto index = 
__ MapToNewGraph(load_transform.index());
 
  737      auto offset = load_transform.offset;
 
  740      og_index = 
__ Simd256LoadTransform(
 
  741          base, index, load_transform.load_kind,
 
 
  752      return Adapter::ReduceInputGraphLoad(ig_index, load);
 
  757    if (!og_index.
valid()) {
 
  762      auto base = 
__ MapToNewGraph(load.base());
 
  766      auto index = 
__ MapToNewGraph(load.index());
 
 
  779      return Adapter::ReduceInputGraphStore(ig_index, store);
 
  784    if (!og_index.
valid()) {
 
  794      if (ig_index == pnode->
nodes()[0]) {
 
  795        Adapter::ReduceInputGraphStore(ig_index, store);
 
  798      auto base = 
__ MapToNewGraph(store.base());
 
  802      auto index = 
__ MapToNewGraph(store.index());
 
  807               store.write_barrier, 
start.offset);
 
 
  820        OpIndex og_index = pnode->RevectorizedNode();
 
  823        if (!og_index.
valid()) {
 
  825          og_index = 
__ ResolvePhi(
 
  827              [&](
OpIndex ind, 
int block_id, 
int old_block_id = 0) {
 
  831          pnode->SetRevectorizedNode(og_index);
 
  842          return extract_op_index;
 
  847    return Adapter::ReduceInputGraphPhi(ig_index, phi);
 
 
  851                  Block* output_graph_loop) {
 
  853      OpIndex phi_index = 
__ input_graph().Index(input_phi);
 
  856        auto pending_index = pnode->RevectorizedNode();
 
  857        DCHECK(pending_index.valid());
 
  858        if (pending_index.valid() &&
 
  859            output_graph_loop->
Contains(pending_index)) {
 
  861          if (
auto* pending_phi = 
__ output_graph()
 
  864            __ output_graph().template Replace<PhiOp>(
 
  875    return Adapter::FixLoopPhi(input_phi, output_index, output_graph_loop);
 
 
  879                                              const Simd128UnaryOp& unary) {
 
  882      return Adapter::ReduceInputGraphSimd128Unary(ig_index, unary);
 
  887    if (!og_index.
valid()) {
 
  889      if (!input.valid()) {
 
 
  901                                              const Simd128BinopOp& op) {
 
  904      return Adapter::ReduceInputGraphSimd128Binop(ig_index, op);
 
  909    if (!og_index.
valid()) {
 
 
  925                                              const Simd128ShiftOp& op) {
 
  928      return Adapter::ReduceInputGraphSimd128Shift(ig_index, op);
 
  933    if (!og_index.
valid()) {
 
 
  944      V<Simd128> ig_index, 
const Simd128TernaryOp& ternary) {
 
  947      return Adapter::ReduceInputGraphSimd128Ternary(ig_index, ternary);
 
  952    if (!og_index.
valid()) {
 
  957      og_index = 
__ Simd256Ternary(first, 
second, third,
 
 
  966                                              const Simd128SplatOp& op) {
 
  969      return Adapter::ReduceInputGraphSimd128Splat(ig_index, op);
 
  974    if (!og_index.
valid()) {
 
  975      og_index = 
__ Simd256Splat(
__ MapToNewGraph(op.input()),
 
 
  984                                                const Simd128ShuffleOp& op) {
 
  987      return Adapter::ReduceInputGraphSimd128Shuffle(ig_index, op);
 
  989    DCHECK_EQ(op.kind, Simd128ShuffleOp::Kind::kI8x16);
 
  994    if (!og_index.
valid()) {
 
 1007          const int bytes_per_lane = is_32 ? 4 : 8;
 
 1009          const int offset = splat_index + load.offset;
 
 1015                                 ? 
__ MapToNewGraph(load.index().value())
 
 1018          const Simd256LoadTransformOp::TransformKind transform_kind =
 
 1019              is_32 ? Simd256LoadTransformOp::TransformKind::k32Splat
 
 1020                    : Simd256LoadTransformOp::TransformKind::k64Splat;
 
 1021          og_index = 
__ Simd256LoadTransform(
base, index, load.kind,
 
 1027          const Simd128ShuffleOp& op0 = 
__ input_graph()
 
 1028                                            .Get(pnode -> nodes()[0])
 
 1037          const Simd128LoadTransformOp& load_transform =
 
 1039                  .Get(load_transform_idx)
 
 1041          DCHECK_EQ(load_transform.transform_kind,
 
 1042                    Simd128LoadTransformOp::TransformKind::k64Zero);
 
 1044          V<WordPtr> index = 
__ MapToNewGraph(load_transform.index());
 
 1045          og_index = 
__ Simd256LoadTransform(
 
 1046              base, index, load_transform.load_kind,
 
 1047              Simd256LoadTransformOp::TransformKind::k8x8U,
 
 1048              load_transform.offset);
 
 1052#ifdef V8_TARGET_ARCH_X64 
 1053        case ShufflePackNode::SpecificInfo::Kind::kShufd: {
 
 1056          og_index = 
__ Simd256Shufd(og_left, pnode->
info().shufd_control());
 
 1060        case ShufflePackNode::SpecificInfo::Kind::kShufps: {
 
 1063          og_index = 
__ Simd256Shufps(og_left, og_right,
 
 1064                                      pnode->
info().shufps_control());
 
 1068        case ShufflePackNode::SpecificInfo::Kind::kS32x8UnpackLow: {
 
 1071          og_index = 
__ Simd256Unpack(og_left, og_right,
 
 1072                                      Simd256UnpackOp::Kind::k32x8Low);
 
 1076        case ShufflePackNode::SpecificInfo::Kind::kS32x8UnpackHigh: {
 
 1079          og_index = 
__ Simd256Unpack(og_left, og_right,
 
 1080                                      Simd256UnpackOp::Kind::k32x8High);
 
 
 1093      OpIndex ig_index, 
const Simd128ReplaceLaneOp& replace) {
 
 1096      return Adapter::ReduceInputGraphSimd128ReplaceLane(ig_index, replace);
 
 1101    if (!og_index.
valid()) {
 
 1108          if (bundle_pnode->
offset() == 0) {
 
 1110                base_index, Simd128UnaryOp::Kind::kI16x8SConvertI8x16Low);
 
 1114                base_index, Simd128UnaryOp::Kind::kI16x8SConvertI8x16High);
 
 1117        i32x8_index = 
__ Simd256Unary(
 
 1118            i16x8_index, Simd256UnaryOp::Kind::kI32x8SConvertI16x8);
 
 1121          if (bundle_pnode->
offset() == 0) {
 
 1123                base_index, Simd128UnaryOp::Kind::kI16x8UConvertI8x16Low);
 
 1127                base_index, Simd128UnaryOp::Kind::kI16x8UConvertI8x16High);
 
 1130        i32x8_index = 
__ Simd256Unary(
 
 1131            i16x8_index, Simd256UnaryOp::Kind::kI32x8UConvertI16x8);
 
 1135        og_index = 
__ Simd256Unary(i32x8_index,
 
 1136                                   Simd256UnaryOp::Kind::kF32x8SConvertI32x8);
 
 1138        og_index = 
__ Simd256Unary(i32x8_index,
 
 1139                                   Simd256UnaryOp::Kind::kF32x8UConvertI32x8);
 
 
 1151    const Block* current_input_block = Asm().current_input_block();
 
 1152    std::stack<OpIndex> inputs;
 
 1154    inputs.push(op_index);
 
 1156    while (!inputs.empty()) {
 
 1158      if (visited.find(idx) != visited.end()) {
 
 1164      bool has_unvisited_inputs = 
false;
 
 1166        if (input > cur_index && visited.find(input) == visited.end()) {
 
 1168          has_unvisited_inputs = 
true;
 
 1172      if (!has_unvisited_inputs) {
 
 1174        visited.insert(idx);
 
 1177        if (idx == op_index) 
continue;
 
 1180        Asm().template VisitOpAndUpdateMapping<false>(idx, current_input_block);
 
 
 1185  template <
typename Op, 
typename Continuation>
 
 1188    std::array<OpIndex, 2> v;
 
 1196    for (
int i = 0; i < static_cast<int>(pnode->
nodes().size()); 
i++) {
 
 1198      if ((*og_index).valid() && cur_index == ig_index) {
 
 1202        v[
i] = 
__ template MapToNewGraph<true>(cur_index);
 
 1205      if (v[
i].valid()) 
continue;
 
 1207      if (cur_index != ig_index) {
 
 1210      const Op& op = Asm().input_graph().Get(cur_index).template 
Cast<Op>();
 
 1211      v[
i] = Continuation{
this}.ReduceInputGraph(cur_index, op);
 
 1213      if (cur_index == ig_index) {
 
 1218        __ CreateOldToNewMapping(cur_index, v[
i]);
 
 1222    OpIndex revec_index = 
__ SimdPack128To256(v[0], v[1]);
 
 
 1226  template <
typename Op, 
typename Continuation>
 
 1238            OpIndex reduced_index = 
__ template MapToNewGraph<true>(ig_index);
 
 1239            if (!reduced_index.
valid()) {
 
 1240              og_index = reduced_index =
 
 1241                  Continuation{
this}.ReduceInputGraph(ig_index, op);
 
 1244                __ SimdPack128To256(reduced_index, reduced_index);
 
 1259      for (
PackNode* pnode : *intersect_packnodes) {
 
 1260        if (!(pnode->RevectorizedNode()).valid()) {
 
 1267    if (og_index.
valid()) {
 
 1271    if (
__ template MapToNewGraph<true>(ig_index).valid()) {
 
 1277    return Continuation{
this}.ReduceInputGraph(ig_index, op);
 
 
 1282      Simd128UnaryOp::Kind simd128_kind) {
 
 1283    switch (simd128_kind) {
 
 1284#define UNOP_KIND_MAPPING(from, to)   \ 
 1285  case Simd128UnaryOp::Kind::k##from: \ 
 1286    return Simd256UnaryOp::Kind::k##to; 
 1288#undef UNOP_KIND_MAPPING 
 1290#define SIGN_EXTENSION_UNOP_KIND_MAPPING(from_1, to, from_2) \ 
 1291  case Simd128UnaryOp::Kind::k##from_1:                      \ 
 1292    return Simd256UnaryOp::Kind::k##to;                      \ 
 1293  case Simd128UnaryOp::Kind::k##from_2:                      \ 
 1294    return Simd256UnaryOp::Kind::k##to; 
 1296#undef SIGN_EXTENSION_UNOP_KIND_MAPPING 
 
 1304#define BINOP_KIND_MAPPING(from, to)  \ 
 1305  case Simd128BinopOp::Kind::k##from: \ 
 1306    return Simd256BinopOp::Kind::k##to; 
 1308#undef BINOP_KIND_MAPPING 
 1310#define SIGN_EXTENSION_BINOP_KIND_MAPPING(from_1, to, from_2) \ 
 1311  case Simd128BinopOp::Kind::k##from_1:                       \ 
 1312    return Simd256BinopOp::Kind::k##to;                       \ 
 1313  case Simd128BinopOp::Kind::k##from_2:                       \ 
 1314    return Simd256BinopOp::Kind::k##to; 
 1316#undef SIGN_EXTENSION_UNOP_KIND_MAPPING 
 
 1324#define SHIFT_KIND_MAPPING(from, to)  \ 
 1325  case Simd128ShiftOp::Kind::k##from: \ 
 1326    return Simd256ShiftOp::Kind::k##to; 
 1328#undef SHIFT_KIND_MAPPING 
 
 1335      Simd128TernaryOp::Kind simd128_kind) {
 
 1336    switch (simd128_kind) {
 
 1337#define TERNARY_KIND_MAPPING(from, to)  \ 
 1338  case Simd128TernaryOp::Kind::k##from: \ 
 1339    return Simd256TernaryOp::Kind::k##to; 
 1341#undef TERNARY_KIND_MAPPING 
 
 1348      Simd128LoadTransformOp::TransformKind simd128_kind) {
 
 1349    switch (simd128_kind) {
 
 1350#define TRANSFORM_KIND_MAPPING(from, to)               \ 
 1351  case Simd128LoadTransformOp::TransformKind::k##from: \ 
 1352    return Simd256LoadTransformOp::TransformKind::k##to; 
 1354#undef TRANSFORM_KIND_MAPPING 
 
 1361      Simd128SplatOp::Kind 
kind) {
 
 1363#define SPLAT_KIND_MAPPING(from, to)  \ 
 1364  case Simd128SplatOp::Kind::k##from: \ 
 1365    return Simd256SplatOp::Kind::k##to; 
 
 
#define REDUCE_INPUT_GRAPH(operation)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
bool Contains(OpIndex op_idx) const
bool is_sign_convert() const
uint8_t lane_size() const
bool is_sign_extract() const
BundlePackNode(Zone *zone, const NodeGroup &node_group, OpIndex base, int8_t offset, uint8_t lane_size, bool is_sign_extract, bool is_sign_convert)
ForcePackType force_pack_type() const
ForcePackNode(Zone *zone, const NodeGroup &node_group, ForcePackType type)
ForcePackType force_pack_type_
V8_INLINE const Operation & Get(OpIndex i) const
static constexpr MemoryRepresentation Simd256()
const OpIndex * end() const
bool operator==(const NodeGroup &other) const
OpIndex operator[](int i) const
bool operator!=(const NodeGroup &other) const
const OpIndex * begin() const
static constexpr int kSize
NodeGroup(OpIndex a, OpIndex b)
static constexpr OpIndex Invalid()
constexpr bool valid() const
const NodeGroup & nodes() const
bool IsShufflePackNode() const
V< Simd256 > revectorized_node_
ForcePackNode * AsForcePackNode()
bool IsForcePackNode() const
bool IsSame(const NodeGroup &node_group) const
void SetOperand(int index, PackNode *pnode)
ZoneVector< PackNode * > operands_
bool IsSame(const PackNode &other) const
ZoneVector< PackNode * >::size_type GetOperandsSize() const
bool IsBundlePackNode() const
PackNode * GetOperand(int index) const
void SetRevectorizedNode(V< Simd256 > node)
PackNode(Zone *zone, const NodeGroup &node_group, NodeType node_type=kDefault)
void Print(Graph *graph) const
ShufflePackNode * AsShufflePackNode()
V< Simd256 > RevectorizedNode() const
bool IsDefaultPackNode() const
BundlePackNode * AsBundlePackNode()
bool is_force_packing() const
static constexpr RegisterRepresentation Simd128()
static constexpr RegisterRepresentation Simd256()
PackNode * NewPackNodeAndRecurs(const NodeGroup &node_group, int start_index, int count, unsigned depth)
bool IsSideEffectFree(OpIndex first, OpIndex second)
PackNode * BuildTreeRec(const NodeGroup &node_group, unsigned depth)
void Print(const char *info)
SLPTree(Graph &graph, WasmRevecAnalyzer *analyzer, Zone *zone)
ZoneUnorderedMap< OpIndex, ZoneVector< PackNode * > > node_to_intersect_packnodes_
PackNode * GetPackNode(OpIndex node)
ZoneVector< PackNode * > * GetIntersectPackNodes(OpIndex node)
ShufflePackNode * Try256ShuffleMatchLoad8x8U(const NodeGroup &node_group, const uint8_t *shuffle0, const uint8_t *shuffle1)
ZoneUnorderedMap< OpIndex, PackNode * > node_to_packnode_
bool IsEqual(const OpIndex node0, const OpIndex node1)
WasmRevecAnalyzer * analyzer_
bool HasInputDependencies(const NodeGroup &node_group)
PackNode * NewPackNode(const NodeGroup &node_group)
bool CanBePacked(const NodeGroup &node_group)
ZoneUnorderedMap< OpIndex, ZoneVector< PackNode * > > & GetIntersectNodeMapping()
PackNode * NewForcePackNode(const NodeGroup &node_group, ForcePackNode::ForcePackType type, const Graph &graph)
static constexpr size_t RecursionMaxDepth
PackNode * NewIntersectPackNode(const NodeGroup &node_group)
BundlePackNode * NewBundlePackNode(const NodeGroup &node_group, OpIndex base, int8_t offset, uint8_t lane_size, bool is_sign_extract, bool is_sign_convert)
PackNode * BuildTree(const NodeGroup &roots)
bool TryMatchExtendIntToF32x4(const NodeGroup &node_group, ExtendIntToF32x4Info *info)
ZoneUnorderedMap< OpIndex, PackNode * > & GetNodeMapping()
ShufflePackNode * NewShufflePackNode(const NodeGroup &node_group, ShufflePackNode::SpecificInfo::Kind kind)
PackNode * NewCommutativePackNodeAndRecurs(const NodeGroup &node_group, unsigned depth)
std::optional< ExtendIntToF32x4Info > TryGetExtendIntToF32x4Info(OpIndex index)
void set_splat_index(uint8_t value)
ShufflePackNode(Zone *zone, const NodeGroup &node_group, SpecificInfo::Kind kind)
base::Vector< const OpIndex > uses(OpIndex index) const
PackNode * GetPackNode(const OpIndex ig_index)
WasmRevecAnalyzer(PipelineData *data, Zone *zone, Graph &graph)
void ProcessBlock(const Block &block)
bool ShouldReduce() const
const Operation & GetStartOperation(const PackNode *pnode, const OpIndex node, const Operation &op)
ZoneVector< std::pair< OpIndex, OpIndex > > store_seeds_
bool IsSupportedReduceSeed(const Operation &op)
ZoneVector< std::pair< OpIndex, OpIndex > > reduce_seeds_
base::Vector< const OpIndex > uses(OpIndex node)
void Print(const char *info)
ZoneUnorderedMap< OpIndex, ZoneVector< PackNode * > > revectorizable_intersect_node_
const OpIndex GetReducedInput(const PackNode *pnode, const int index=0)
ZoneVector< PackNode * > * GetIntersectPackNodes(const OpIndex node)
const wasm::WasmModule * module_
ZoneUnorderedMap< OpIndex, PackNode * > revectorizable_node_
void MergeSLPTree(SLPTree &slp_tree)
void ReduceInputsOfOp(OpIndex cur_index, OpIndex op_index)
OpIndex REDUCE_INPUT_GRAPH Simd128ReplaceLane(OpIndex ig_index, const Simd128ReplaceLaneOp &replace)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Splat(V< Simd128 > ig_index, const Simd128SplatOp &op)
OpIndex ReduceInputGraphOperation(OpIndex ig_index, const Op &op)
OpIndex REDUCE_INPUT_GRAPH Phi(OpIndex ig_index, const PhiOp &phi)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Shift(V< Simd128 > ig_index, const Simd128ShiftOp &op)
static Simd256TernaryOp::Kind GetSimd256TernaryKind(Simd128TernaryOp::Kind simd128_kind)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Constant(V< Simd128 > ig_index, const Simd128ConstantOp &constant_op)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128LoadTransform(V< Simd128 > ig_index, const Simd128LoadTransformOp &load_transform)
OpIndex REDUCE_INPUT_GRAPH Store(OpIndex ig_index, const StoreOp &store)
static Simd256LoadTransformOp::TransformKind Get256LoadTransformKindFrom128(Simd128LoadTransformOp::TransformKind simd128_kind)
static Simd256ShiftOp::Kind GetSimd256ShiftOpKind(Simd128ShiftOp::Kind kind)
OpIndex REDUCE_INPUT_GRAPH Load(OpIndex ig_index, const LoadOp &load)
OpIndex GetExtractOpIfNeeded(const PackNode *pnode, OpIndex ig_index, OpIndex og_index)
void ReduceForceOrIntersectPackNode(PackNode *pnode, const OpIndex ig_index, OpIndex *og_index)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Shuffle(V< Simd128 > ig_index, const Simd128ShuffleOp &op)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Ternary(V< Simd128 > ig_index, const Simd128TernaryOp &ternary)
static Simd256SplatOp::Kind Get256SplatOpKindFrom128(Simd128SplatOp::Kind kind)
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Unary(V< Simd128 > ig_index, const Simd128UnaryOp &unary)
void FixLoopPhi(const PhiOp &input_phi, OpIndex output_index, Block *output_graph_loop)
const wasm::WasmModule * module_
V< Simd128 > REDUCE_INPUT_GRAPH Simd128Binop(V< Simd128 > ig_index, const Simd128BinopOp &op)
WasmRevecAnalyzer analyzer_
static Simd256UnaryOp::Kind GetSimd256UnaryKind(Simd128UnaryOp::Kind simd128_kind)
static Simd256BinopOp::Kind GetSimd256BinOpKind(Simd128BinopOp::Kind kind)
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
std::optional< TNode< JSArray > > a
constexpr Vector< T > VectorOf(T *start, size_t size)
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
static const Operator * IntPtrConstant(CommonOperatorBuilder *common, intptr_t value)
bool TryCast(Tagged< From > value, Tagged< To > *out)
constexpr int kSimd128Size
bool Is(IndirectHandle< U > value)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats store(v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) DEFINE_GENERIC_IMPLICATION(trace_gc_object_stats
constexpr int kSimd256Size
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define NON_EXPORTED_BASE(code)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
base::Vector< const OpIndex > inputs() const
RegisterRepresentation rep
Simd128ExtractLaneOp::Kind extract_kind
ChangeOp::Kind change_kind
#define SIGN_EXTENSION_BINOP_KIND_MAPPING(from_1, to, from_2)
#define SHIFT_KIND_MAPPING(from, to)
#define SIMD256_BINOP_SIGN_EXTENSION_OP(V)
#define SIGN_EXTENSION_UNOP_KIND_MAPPING(from_1, to, from_2)
#define SIMD256_LOADTRANSFORM_OP(V)
#define SIMD256_SPLAT_OP(V)
#define SIMD256_UNARY_SIGN_EXTENSION_OP(V)
#define SPLAT_KIND_MAPPING(from, to)
#define TRANSFORM_KIND_MAPPING(from, to)
#define BINOP_KIND_MAPPING(from, to)
#define SIMD256_SHIFT_OP(V)
#define SIMD256_TERNARY_OP(V)
#define UNOP_KIND_MAPPING(from, to)
#define TERNARY_KIND_MAPPING(from, to)
#define SIMD256_BINOP_SIMPLE_OP(V)
#define SIMD256_UNARY_SIMPLE_OP(V)