chromium/v8/test/cctest/wasm/test-run-wasm-relaxed-simd.cc

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <type_traits>

#include "src/base/overflowing-math.h"
#include "src/base/safe_conversions.h"
#include "src/codegen/cpu-features.h"
#include "src/common/globals.h"
#include "src/wasm/compilation-environment.h"
#include "test/cctest/cctest.h"
#include "test/cctest/wasm/wasm-run-utils.h"
#include "test/cctest/wasm/wasm-simd-utils.h"
#include "test/common/wasm/flag-utils.h"
#include "test/common/wasm/wasm-macro-gen.h"

namespace v8::internal::wasm {

// Only used for qfma and qfms tests below.

// FMOperation holds the params (a, b, c) for a Multiply-Add or
// Multiply-Subtract operation, and the expected result if the operation was
// fused, rounded only once for the entire operation, or unfused, rounded after
// multiply and again after add/subtract.
template <typename T>
struct FMOperation {};

// large_n is large number that overflows T when multiplied by itself, this is a
// useful constant to test fused/unfused behavior.
large_n;

large_n;

large_n;

// Fused Multiply-Add performs a * b + c.
qfma_array;

template <typename T>
static constexpr base::Vector<const FMOperation<T>> qfma_vector() {}

// Fused Multiply-Subtract performs -(a * b) + c.
qfms_array;

template <typename T>
static constexpr base::Vector<const FMOperation<T>> qfms_vector() {}

bool ExpectFused(TestExecutionTier tier) {}

WASM_EXEC_TEST(F32x4Qfma) {}

WASM_EXEC_TEST(F32x4Qfms) {}

WASM_EXEC_TEST(F64x2Qfma) {}

WASM_EXEC_TEST(F64x2Qfms) {}

TEST(RunWasm_RegressFmaReg_liftoff) {}

namespace {
// Helper to convert an array of T into an array of uint8_t to be used a v128
// constants.
template <typename T, size_t N = kSimd128Size / sizeof(T)>
std::array<uint8_t, kSimd128Size> as_uint8(const T* src) {}

template <typename T, int kElems>
void RelaxedLaneSelectTest(TestExecutionTier execution_tier, const T v1[kElems],
                           const T v2[kElems], const T s[kElems],
                           const T expected[kElems], WasmOpcode laneselect) {}

}  // namespace

WASM_EXEC_TEST(I8x16RelaxedLaneSelect) {}

WASM_EXEC_TEST(I16x8RelaxedLaneSelect) {}

WASM_EXEC_TEST(I32x4RelaxedLaneSelect) {}

WASM_EXEC_TEST(I64x2RelaxedLaneSelect) {}

WASM_EXEC_TEST(F32x4RelaxedMin) {}

WASM_EXEC_TEST(F32x4RelaxedMax) {}

WASM_EXEC_TEST(F64x2RelaxedMin) {}

WASM_EXEC_TEST(F64x2RelaxedMax) {}

namespace {
// For relaxed trunc instructions, don't test out of range values.
// FloatType comes later so caller can rely on template argument deduction and
// just pass IntType.
template <typename IntType, typename FloatType>
typename std::enable_if<std::is_floating_point<FloatType>::value, bool>::type
ShouldSkipTestingConstant(FloatType x) {}

template <typename IntType, typename FloatType>
void IntRelaxedTruncFloatTest(TestExecutionTier execution_tier,
                              WasmOpcode trunc_op, WasmOpcode splat_op) {}
}  // namespace

WASM_EXEC_TEST(I32x4RelaxedTruncF64x2SZero) {}

WASM_EXEC_TEST(I32x4RelaxedTruncF64x2UZero) {}

WASM_EXEC_TEST(I32x4RelaxedTruncF32x4S) {}

WASM_EXEC_TEST(I32x4RelaxedTruncF32x4U) {}

WASM_EXEC_TEST(I8x16RelaxedSwizzle) {}

WASM_EXEC_TEST(I16x8RelaxedQ15MulRS) {}

WASM_EXEC_TEST(I16x8DotI8x16I7x16S) {}

WASM_EXEC_TEST(I32x4DotI8x16I7x16AddS) {}

#ifdef V8_ENABLE_WASM_SIMD256_REVEC
TEST(RunWasm_F32x8Qfma_turbofan) {}

TEST(RunWasm_F32x8Qfms_turbofan) {}

TEST(RunWasm_F64x4Qfma_turbofan) {}

TEST(RunWasm_F64x4Qfms_turbofan) {}

template <typename T, int kElems>
void RelaxedLaneSelectRevecTest(const T l1[kElems], const T l2[kElems],
                                const T r1[kElems], const T r2[kElems],
                                const T s1[kElems], const T s2[kElems],
                                const T expected[2 * kElems],
                                WasmOpcode laneselect) {}

TEST(RunWasm_I64x4RelaxedLaneSelect) {}

TEST(RunWasm_I32x8RelaxedLaneSelect) {}

TEST(RunWasm_I16x16RelaxedLaneSelect) {}

TEST(RunWasm_I8x32RelaxedLaneSelect) {}

TEST(RunWasm_I32x8DotI8x32I7x32AddS) {}

TEST(RunWasm_I16x16DotI8x32I7x32S) {}

TEST(RunWasmTurbofan_F32x8RelaxedMin) {}

TEST(RunWasmTurbofan_F32x8RelaxedMax) {}

TEST(RunWasmTurbofan_F64x4RelaxedMin) {}

TEST(RunWasmTurbofan_F64x4RelaxedMax) {}

#endif  // V8_ENABLE_WASM_SIMD256_REVEC

}  // namespace v8::internal::wasm