chromium/third_party/dawn/src/tint/lang/wgsl/ast/transform/builtin_polyfill_test.cc

// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/lang/wgsl/ast/transform/builtin_polyfill.h"

#include <utility>

#include "src/tint/lang/wgsl/ast/transform/direct_variable_access.h"
#include "src/tint/lang/wgsl/ast/transform/helper_test.h"

namespace tint::ast::transform {
namespace {

Level;

BuiltinPolyfillTest;

TEST_F(BuiltinPolyfillTest, ShouldRunEmptyModule) {}

TEST_F(BuiltinPolyfillTest, ShouldRun_OverrideCall) {}

TEST_F(BuiltinPolyfillTest, ShouldRun_OverrideBinary) {}

////////////////////////////////////////////////////////////////////////////////
// acosh
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillAcosh(Level level) {}

TEST_F(BuiltinPolyfillTest, ShouldRunAcosh) {}

TEST_F(BuiltinPolyfillTest, Acosh_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, Acosh_Full_f32) {}

TEST_F(BuiltinPolyfillTest, Acosh_Full_vec3_f32) {}

TEST_F(BuiltinPolyfillTest, Acosh_Range_f32) {}

TEST_F(BuiltinPolyfillTest, Acosh_Range_vec3_f32) {}

////////////////////////////////////////////////////////////////////////////////
// asinh
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillSinh() {}

TEST_F(BuiltinPolyfillTest, ShouldRunAsinh) {}

TEST_F(BuiltinPolyfillTest, Asinh_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, Asinh_f32) {}

TEST_F(BuiltinPolyfillTest, Asinh_vec3_f32) {}

////////////////////////////////////////////////////////////////////////////////
// atanh
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillAtanh(Level level) {}

TEST_F(BuiltinPolyfillTest, ShouldRunAtanh) {}

TEST_F(BuiltinPolyfillTest, Atanh_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, Atanh_Full_f32) {}

TEST_F(BuiltinPolyfillTest, Atanh_Full_vec3_f32) {}

TEST_F(BuiltinPolyfillTest, Atanh_Range_f32) {}

TEST_F(BuiltinPolyfillTest, Atanh_Range_vec3_f32) {}

////////////////////////////////////////////////////////////////////////////////
// bgra8unorm
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillBgra8unorm() {}

TEST_F(BuiltinPolyfillTest, ShouldRunBgra8unorm_StorageTextureVar) {}

TEST_F(BuiltinPolyfillTest, ShouldRunBgra8unorm_StorageTextureParam) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_StorageTextureVar) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_StorageTextureParam) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureLoad) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore_Param) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore_WithAtanh) {}

TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureLoadAndStore) {}

////////////////////////////////////////////////////////////////////////////////
// bitshiftModulo
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillBitshiftModulo() {}

TEST_F(BuiltinPolyfillTest, ShouldRunBitshiftModulo_shl_scalar) {}

TEST_F(BuiltinPolyfillTest, ShouldRunBitshiftModulo_shl_vector) {}

TEST_F(BuiltinPolyfillTest, ShouldRunBitshiftModulo_shr_scalar) {}

TEST_F(BuiltinPolyfillTest, ShouldRunBitshiftModulo_shr_vector) {}

TEST_F(BuiltinPolyfillTest, BitshiftModulo_shl_scalar) {}

TEST_F(BuiltinPolyfillTest, BitshiftModulo_shl_vector) {}

TEST_F(BuiltinPolyfillTest, BitshiftModulo_shr_scalar) {}

TEST_F(BuiltinPolyfillTest, BitshiftModulo_shr_vector) {}

////////////////////////////////////////////////////////////////////////////////
// clampInteger
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillClampInteger() {}

TEST_F(BuiltinPolyfillTest, ShouldRunClampInteger_i32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunClampInteger_u32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunClampInteger_f32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunClampInteger_f16) {}

TEST_F(BuiltinPolyfillTest, ClampInteger_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, ClampInteger_i32) {}

TEST_F(BuiltinPolyfillTest, ClampInteger_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, ClampInteger_u32) {}

TEST_F(BuiltinPolyfillTest, ClampInteger_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// conv_f32_to_iu32
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillConvF32ToIU32() {}

TEST_F(BuiltinPolyfillTest, ShouldRunConvF32ToI32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunConvF32ToU32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunConvVec3F32ToVec3I32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunConvVec3F32ToVec3U32) {}

TEST_F(BuiltinPolyfillTest, ConvF32ToI32) {}

TEST_F(BuiltinPolyfillTest, ConvF32ToU32) {}

TEST_F(BuiltinPolyfillTest, ConvVec3F32ToVec3I32) {}

TEST_F(BuiltinPolyfillTest, ConvVec3F32ToVec3U32) {}

////////////////////////////////////////////////////////////////////////////////
// countLeadingZeros
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillCountLeadingZeros() {}

TEST_F(BuiltinPolyfillTest, ShouldRunCountLeadingZeros) {}

TEST_F(BuiltinPolyfillTest, CountLeadingZeros_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, CountLeadingZeros_i32) {}

TEST_F(BuiltinPolyfillTest, CountLeadingZeros_u32) {}

TEST_F(BuiltinPolyfillTest, CountLeadingZeros_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, CountLeadingZeros_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// countTrailingZeros
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillCountTrailingZeros() {}

TEST_F(BuiltinPolyfillTest, ShouldRunCountTrailingZeros) {}

TEST_F(BuiltinPolyfillTest, CountTrailingZeros_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, CountTrailingZeros_i32) {}

TEST_F(BuiltinPolyfillTest, CountTrailingZeros_u32) {}

TEST_F(BuiltinPolyfillTest, CountTrailingZeros_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, CountTrailingZeros_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// extractBits
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillExtractBits(Level level) {}

TEST_F(BuiltinPolyfillTest, ShouldRunExtractBits) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Full_i32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Full_u32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Full_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Full_vec3_u32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Clamp_i32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Clamp_u32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Clamp_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, ExtractBits_Clamp_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// firstLeadingBit
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillFirstLeadingBit() {}

TEST_F(BuiltinPolyfillTest, ShouldRunFirstLeadingBit) {}

TEST_F(BuiltinPolyfillTest, FirstLeadingBit_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, FirstLeadingBit_i32) {}

TEST_F(BuiltinPolyfillTest, FirstLeadingBit_u32) {}

TEST_F(BuiltinPolyfillTest, FirstLeadingBit_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, FirstLeadingBit_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// firstTrailingBit
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillFirstTrailingBit() {}

TEST_F(BuiltinPolyfillTest, ShouldRunFirstTrailingBit) {}

TEST_F(BuiltinPolyfillTest, FirstTrailingBit_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, FirstTrailingBit_i32) {}

TEST_F(BuiltinPolyfillTest, FirstTrailingBit_u32) {}

TEST_F(BuiltinPolyfillTest, FirstTrailingBit_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, FirstTrailingBit_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// fwidthFine
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillFwidthFine() {}

TEST_F(BuiltinPolyfillTest, ShouldRunFwidthFine) {}

TEST_F(BuiltinPolyfillTest, FwidthFine_f32) {}

TEST_F(BuiltinPolyfillTest, FwidthFine_vec3_f32) {}

////////////////////////////////////////////////////////////////////////////////
// insertBits
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillInsertBits(Level level) {}

TEST_F(BuiltinPolyfillTest, ShouldRunInsertBits) {}

TEST_F(BuiltinPolyfillTest, InsertBits_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Full_i32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Full_u32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Full_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Full_vec3_u32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Clamp_i32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Clamp_u32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Clamp_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, InsertBits_Clamp_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// precise_float_mod
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillPreciseFloatMod() {}

TEST_F(BuiltinPolyfillTest, ShouldRunPreciseFloatMod) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_af_f32) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_f32_af) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_f32_f32) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_Overloads) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_vec3_af_f32) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_vec3_f32_af) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_vec3_f32_f32) {}

TEST_F(BuiltinPolyfillTest, PreciseFloatMod_vec3_f32_vec3_f32) {}

////////////////////////////////////////////////////////////////////////////////
// int_div_mod
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillIntDivMod() {}

TEST_F(BuiltinPolyfillTest, ShouldRunIntDiv) {}

TEST_F(BuiltinPolyfillTest, ShouldRunIntMod) {}

TEST_F(BuiltinPolyfillTest, IntDiv_ai_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_ai_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_i32_ai) {}

TEST_F(BuiltinPolyfillTest, IntMod_i32_ai) {}

TEST_F(BuiltinPolyfillTest, IntDiv_i32_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_i32_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_ai_u32) {}

TEST_F(BuiltinPolyfillTest, IntMod_ai_u32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_u32_ai) {}

TEST_F(BuiltinPolyfillTest, IntMod_u32_ai) {}

TEST_F(BuiltinPolyfillTest, IntDiv_u32_u32) {}

TEST_F(BuiltinPolyfillTest, IntMod_u32_u32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_ai_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_ai_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_i32_ai) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_i32_ai) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_i32_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_i32_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_u32_u32) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_u32_u32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_ai_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_ai_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_i32_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_i32_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_u32_vec3_u32) {}

TEST_F(BuiltinPolyfillTest, IntMod_u32_vec3_u32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_i32_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_i32_vec3_i32) {}

TEST_F(BuiltinPolyfillTest, IntDiv_vec3_u32_vec3_u32) {}

TEST_F(BuiltinPolyfillTest, IntMod_vec3_u32_vec3_u32) {}

////////////////////////////////////////////////////////////////////////////////
// reflect for vec2<f32>
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillReflectVec2F32() {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec2_f32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec2_f16) {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec3_f32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec3_f16) {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec4_f32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunReflect_vec4_f16) {}

TEST_F(BuiltinPolyfillTest, Reflect_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, Reflect_vec2_f32) {}

TEST_F(BuiltinPolyfillTest, Reflect_multiple_types) {}

////////////////////////////////////////////////////////////////////////////////
// saturate
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillSaturate() {}

TEST_F(BuiltinPolyfillTest, ShouldRunSaturate) {}

TEST_F(BuiltinPolyfillTest, Saturate_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, Saturate_f32) {}

TEST_F(BuiltinPolyfillTest, Saturate_f16) {}

TEST_F(BuiltinPolyfillTest, Saturate_vec3_f32) {}

TEST_F(BuiltinPolyfillTest, Saturate_vec3_f16) {}

////////////////////////////////////////////////////////////////////////////////
// sign_int
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillSignInt() {}

TEST_F(BuiltinPolyfillTest, ShouldRunSign_i32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunSign_f32) {}

TEST_F(BuiltinPolyfillTest, SignInt_ConstantExpression) {}

TEST_F(BuiltinPolyfillTest, SignInt_i32) {}

TEST_F(BuiltinPolyfillTest, SignInt_vec3_i32) {}

////////////////////////////////////////////////////////////////////////////////
// textureSampleBaseClampToEdge
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillTextureSampleBaseClampToEdge_2d_f32() {}

TEST_F(BuiltinPolyfillTest, ShouldRunTextureSampleBaseClampToEdge_2d_f32) {}

TEST_F(BuiltinPolyfillTest, ShouldRunTextureSampleBaseClampToEdge_external) {}

TEST_F(BuiltinPolyfillTest, TextureSampleBaseClampToEdge_2d_f32_f32) {}

////////////////////////////////////////////////////////////////////////////////
// workgroupUniformLoad
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillWorkgroupUniformLoad() {}

DataMap polyfillWorkgroupUniformLoadWithDirectVariableAccess() {}

TEST_F(BuiltinPolyfillTest, ShouldRunWorkgroupUniformLoad) {}

TEST_F(BuiltinPolyfillTest, WorkgroupUniformLoad_i32) {}

TEST_F(BuiltinPolyfillTest, WorkgroupUniformLoad_ComplexType) {}

TEST_F(BuiltinPolyfillTest, WorkgroupUniformLoad_AvoidDuplicateEnables) {}

TEST_F(BuiltinPolyfillTest, WorkgroupUniformLoad_DirectVariableAccess) {}

////////////////////////////////////////////////////////////////////////////////
// Built-in functions in packed_4x8_integer_dot_product
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillPacked4x8IntegerDotProduct() {}

TEST_F(BuiltinPolyfillTest, Dot4I8Packed) {}

TEST_F(BuiltinPolyfillTest, Dot4U8Packed) {}

TEST_F(BuiltinPolyfillTest, Pack4xI8) {}

TEST_F(BuiltinPolyfillTest, Pack4xU8) {}

TEST_F(BuiltinPolyfillTest, Pack4xI8Clamp) {}

TEST_F(BuiltinPolyfillTest, Pack4xU8Clamp) {}

TEST_F(BuiltinPolyfillTest, Unpack4xI8) {}

TEST_F(BuiltinPolyfillTest, Unpack4xU8) {}

////////////////////////////////////////////////////////////////////////////////
// Polyfill combinations
////////////////////////////////////////////////////////////////////////////////

TEST_F(BuiltinPolyfillTest, BitshiftAndModulo) {}

}  // namespace
}  // namespace tint::ast::transform