#include "src/compiler/turboshaft/assembler.h"
#include "src/compiler/turboshaft/loop-unrolling-reducer.h"
#include "test/unittests/compiler/turboshaft/reducer-test.h"
namespace v8::internal::compiler::turboshaft {
#include "src/compiler/turboshaft/define-assembler-macros.inc"
class LoopUnrollingAnalyzerTest : public ReducerTest { … };
template <typename T>
class LoopUnrollingAnalyzerTestWithParam
: public LoopUnrollingAnalyzerTest,
public ::testing::WithParamInterface<T> { … };
size_t CountLoops(const Graph& graph) { … }
const Block& GetFirstLoop(const Graph& graph) { … }
#define BUILTIN_CMP_LIST(V) …
#define CMP_GREATER_THAN_LIST(V) …
#define CMP_LIST(V) …
enum class Cmp { … };
std::ostream& operator<<(std::ostream& os, const Cmp& cmp) { … }
bool IsGreaterThan(Cmp cmp) { … }
Cmp GreaterThanToLessThan(Cmp cmp, ConstOrV<Word32>* left,
ConstOrV<Word32>* right) { … }
#define NO_OVERFLOW_BINOP_LIST(V) …
#define OVERFLOW_CHECKED_BINOP_LIST(V) …
#define BINOP_LIST(V) …
enum class Binop { … };
std::ostream& operator<<(std::ostream& os, const Binop& binop) { … }
V<Word32> EmitCmp(TestInstance& test_instance, Cmp cmp, ConstOrV<Word32> left,
ConstOrV<Word32> right) { … }
V<Word32> EmitBinop(TestInstance& test_instance, Binop binop,
ConstOrV<Word32> left, ConstOrV<Word32> right) { … }
struct BoundedLoop { … };
std::ostream& operator<<(std::ostream& os, const BoundedLoop& loop) { … }
static const BoundedLoop kSmallBoundedLoops[] = …;
static const BoundedLoop kLargeBoundedLoops[] = …;
static const BoundedLoop kUnderOverflowBoundedLoops[] = …;
LoopUnrollingAnalyzerSmallLoopTest;
TEST_P(LoopUnrollingAnalyzerSmallLoopTest, ExactLoopIterCount) { … }
INSTANTIATE_TEST_SUITE_P(…);
LoopUnrollingAnalyzerLargeLoopTest;
TEST_P(LoopUnrollingAnalyzerLargeLoopTest, LargeLoopIterCount) { … }
INSTANTIATE_TEST_SUITE_P(…);
LoopUnrollingAnalyzerOverflowTest;
TEST_P(LoopUnrollingAnalyzerOverflowTest, LargeLoopIterCount) { … }
INSTANTIATE_TEST_SUITE_P(…);
#include "src/compiler/turboshaft/undef-assembler-macros.inc"
}