#include <limits>
#include "src/codegen/assembler.h"
#include "src/common/globals.h"
#include "src/compiler/backend/instruction-codes.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node-matchers.h"
#include "src/objects/objects-inl.h"
#include "test/unittests/compiler/backend/instruction-selector-unittest.h"
#if V8_ENABLE_WEBASSEMBLY
#include "src/wasm/simd-shuffle.h"
#endif
namespace v8 {
namespace internal {
namespace compiler {
TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) { … }
TEST_F(InstructionSelectorTest, ChangeInt32ToInt64WithParameter) { … }
TEST_F(InstructionSelectorTest, ChangeUint32ToFloat64WithParameter) { … }
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64WithParameter) { … }
TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) { … }
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithParameter) { … }
TEST_F(InstructionSelectorTest, SelectWord32) { … }
TEST_F(InstructionSelectorTest, SelectWord64) { … }
namespace {
struct LoadWithToInt64Extension { … };
std::ostream& operator<<(std::ostream& os,
const LoadWithToInt64Extension& i32toi64) { … }
static const LoadWithToInt64Extension kLoadWithToInt64Extensions[] = …;
InstructionSelectorChangeInt32ToInt64Test;
TEST_P(InstructionSelectorChangeInt32ToInt64Test, ChangeInt32ToInt64WithLoad) { … }
}
INSTANTIATE_TEST_SUITE_P(…);
namespace {
struct MemoryAccess { … };
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) { … }
static const MemoryAccess kMemoryAccesses[] = …;
InstructionSelectorMemoryAccessTest;
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) { … }
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) { … }
}
INSTANTIATE_TEST_SUITE_P(…);
namespace {
Constructor;
struct BinaryOperation { … };
std::ostream& operator<<(std::ostream& os, const BinaryOperation& bop) { … }
const BinaryOperation kWord32BinaryOperations[] = …;
InstructionSelectorChangeUint32ToUint64Test;
TEST_P(InstructionSelectorChangeUint32ToUint64Test, ChangeUint32ToUint64) { … }
}
INSTANTIATE_TEST_SUITE_P(…);
namespace {
template <typename T>
struct MachInst { … };
MachInst2;
const MachInst2 kCanElideChangeUint32ToUint64[] = {
{&RawMachineAssembler::Word32And, "Word32And", kX64And32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Or, "Word32Or", kX64Or32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Xor, "Word32Xor", kX64Xor32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shl, "Word32Shl", kX64Shl32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shr, "Word32Shr", kX64Shr32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Sar, "Word32Sar", kX64Sar32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Ror, "Word32Ror", kX64Ror32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Equal, "Word32Equal", kX64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Int32Add, "Int32Add", kX64Lea32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Sub, "Int32Sub", kX64Sub32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Mul, "Int32Mul", kX64Imul32,
MachineType::Int32()},
{&RawMachineAssembler::Int32MulHigh, "Int32MulHigh", kX64ImulHigh32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Div, "Int32Div", kX64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kX64Cmp32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
kX64Cmp32, MachineType::Int32()},
{&RawMachineAssembler::Int32Mod, "Int32Mod", kX64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Uint32Div, "Uint32Div", kX64Udiv32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kX64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
kX64Cmp32, MachineType::Uint32()},
{&RawMachineAssembler::Uint32Mod, "Uint32Mod", kX64Udiv32,
MachineType::Uint32()},
};
InstructionSelectorElidedChangeUint32ToUint64Test;
TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) { … }
}
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) { … }
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) { … }
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shr) { … }
TEST_F(InstructionSelectorTest, Int32AddWithInt32ParametersLea) { … }
TEST_F(InstructionSelectorTest, Int32AddConstantAsLeaSingle) { … }
TEST_F(InstructionSelectorTest, Int32AddConstantAsAdd) { … }
TEST_F(InstructionSelectorTest, Int32AddConstantAsLeaDouble) { … }
TEST_F(InstructionSelectorTest, Int32AddCommutedConstantAsLeaSingle) { … }
TEST_F(InstructionSelectorTest, Int32AddCommutedConstantAsLeaDouble) { … }
TEST_F(InstructionSelectorTest, Int32AddSimpleAsAdd) { … }
TEST_F(InstructionSelectorTest, Int32AddSimpleAsLea) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2Mul) { … }
TEST_F(InstructionSelectorTest, Int32AddCommutedScaled2Mul) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2Shl) { … }
TEST_F(InstructionSelectorTest, Int32AddCommutedScaled2Shl) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled4Mul) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled4Shl) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled8Mul) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled8Shl) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle1) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle2) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle3) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle4) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2MulWithConstantShuffle5) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2ShlWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled4MulWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled4ShlWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled8MulWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled8ShlWithConstant) { … }
TEST_F(InstructionSelectorTest, Int32SubConstantAsSub) { … }
TEST_F(InstructionSelectorTest, Int32SubConstantAsLea) { … }
TEST_F(InstructionSelectorTest, Int32AddScaled2Other) { … }
TEST_F(InstructionSelectorTest, Int32AddMinNegativeDisplacement) { … }
TEST_F(InstructionSelectorTest, Int32MulWithInt32MulWithParameters) { … }
TEST_F(InstructionSelectorTest, Int32MulHigh) { … }
TEST_F(InstructionSelectorTest, Uint32MulHigh) { … }
TEST_F(InstructionSelectorTest, Int32Mul2BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Mul3BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Mul4BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Mul5BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Mul8BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Mul9BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Shl1BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Shl2BecomesLea) { … }
TEST_F(InstructionSelectorTest, Int32Shl4BecomesLea) { … }
TEST_F(InstructionSelectorTest, LoadCmp32) { … }
TEST_F(InstructionSelectorTest, LoadAnd32) { … }
TEST_F(InstructionSelectorTest, LoadOr32) { … }
TEST_F(InstructionSelectorTest, LoadXor32) { … }
TEST_F(InstructionSelectorTest, LoadAdd32) { … }
TEST_F(InstructionSelectorTest, LoadSub32) { … }
TEST_F(InstructionSelectorTest, LoadAnd64) { … }
TEST_F(InstructionSelectorTest, LoadOr64) { … }
TEST_F(InstructionSelectorTest, LoadXor64) { … }
TEST_F(InstructionSelectorTest, LoadAdd64) { … }
TEST_F(InstructionSelectorTest, LoadSub64) { … }
TEST_F(InstructionSelectorTest, Float32Abs) { … }
TEST_F(InstructionSelectorTest, Float64Abs) { … }
TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { … }
TEST_F(InstructionSelectorTest, Float32BinopArithmeticWithLoad) { … }
TEST_F(InstructionSelectorTest, Float64BinopArithmeticWithLoad) { … }
TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) { … }
TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) { … }
TEST_F(InstructionSelectorTest, Word32AndWith0xFF) { … }
TEST_F(InstructionSelectorTest, Word64AndWith0xFFFFFFFF) { … }
TEST_F(InstructionSelectorTest, Word64AndWith0xFFFF) { … }
TEST_F(InstructionSelectorTest, Word64AndWith0xFF) { … }
TEST_F(InstructionSelectorTest, Word64AndWithInt64FitsUint32) { … }
TEST_F(InstructionSelectorTest, Word64AndWithInt64DontFitsUint32) { … }
TEST_F(InstructionSelectorTest, Word32AndWith0xFFFF) { … }
TEST_F(InstructionSelectorTest, Word32Clz) { … }
TEST_F(InstructionSelectorTest, LoadAndWord64ShiftRight32) { … }
#if V8_ENABLE_WEBASSEMBLY
TEST_F(InstructionSelectorTest, SIMDSplatZero) { … }
struct ArchShuffle { … };
static constexpr ArchShuffle kArchShuffles[] = …;
InstructionSelectorSIMDArchShuffleTest;
TEST_P(InstructionSelectorSIMDArchShuffleTest, SIMDArchShuffle) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct ArchShuffle256 { … };
static constexpr ArchShuffle256 kArchShuffles256[] = …;
InstructionSelectorSIMDArchShuffle256Test;
TEST_P(InstructionSelectorSIMDArchShuffle256Test, SIMDArchShuffle256) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct ShuffleWithZeroInput { … };
static constexpr ShuffleWithZeroInput kShuffleWithZeroInput[] = …;
InstructionSelectorSIMDShuffleWithZeroInputTest;
TEST_P(InstructionSelectorSIMDShuffleWithZeroInputTest,
SIMDShuffleWithZeroInputTest) { … }
INSTANTIATE_TEST_SUITE_P(…);
struct SwizzleConstants { … };
static constexpr SwizzleConstants kSwizzleConstants[] = …;
InstructionSelectorSIMDSwizzleConstantTest;
TEST_P(InstructionSelectorSIMDSwizzleConstantTest, SimdSwizzleConstant) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(InstructionSelectorTest, F64x2PromoteLowF32x4WithS128Load64Zero) { … }
#endif
}
}
}