math_brute_force: Factor out GetUnaryKernel and GetBinaryKernel (#1525)

Use common functions to create the kernel source code for testing
1-argument and 2-argument math builtins.  This reduces code duplication.

Use appropriate patterns to initialise variables to their full bit
widths.  For example, `0xdead` was previously used to initialise 32-bit
integers, while now a larger number spanning all bytes is used.

Co-authored-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Co-authored-by: Marco Antognini <marco.antognini@arm.com>
This commit is contained in:
Sven van Haastregt
2022-11-01 20:08:36 +00:00
committed by GitHub
parent 44fe72c2b9
commit 63274f97b7
24 changed files with 529 additions and 1754 deletions

View File

@@ -37,12 +37,29 @@ enum class ParameterType
{
Float,
Double,
Int,
UInt,
Long,
ULong,
};
// Return kernel name suffixed with vector size.
std::string GetKernelName(int vector_size_index);
// Generate kernel code for the given builtin function/operator.
std::string GetUnaryKernel(const std::string &kernel_name, const char *builtin,
ParameterType retType, ParameterType type1,
int vector_size_index);
std::string GetUnaryKernel(const std::string &kernel_name, const char *builtin,
ParameterType retType1, ParameterType retType2,
ParameterType type1, int vector_size_index);
std::string GetBinaryKernel(const std::string &kernel_name, const char *builtin,
ParameterType retType, ParameterType type1,
ParameterType type2, int vector_size_index);
std::string GetBinaryKernel(const std::string &kernel_name, const char *builtin,
ParameterType retType1, ParameterType retType2,
ParameterType type1, ParameterType type2,
int vector_size_index);
std::string GetTernaryKernel(const std::string &kernel_name,
const char *builtin, ParameterType retType,
ParameterType type1, ParameterType type2,