Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -9,42 +9,41 @@
#include "main.h"
template<typename Scalar>
void test_first_aligned_helper(Scalar *array, int size)
{
template <typename Scalar>
void test_first_aligned_helper(Scalar *array, int size) {
const int packet_size = sizeof(Scalar) * internal::packet_traits<Scalar>::size;
VERIFY(((size_t(array) + sizeof(Scalar) * internal::first_default_aligned(array, size)) % packet_size) == 0);
}
template<typename Scalar>
void test_none_aligned_helper(Scalar *array, int size)
{
template <typename Scalar>
void test_none_aligned_helper(Scalar *array, int size) {
EIGEN_UNUSED_VARIABLE(array);
EIGEN_UNUSED_VARIABLE(size);
VERIFY(internal::packet_traits<Scalar>::size == 1 || internal::first_default_aligned(array, size) == size);
}
struct some_non_vectorizable_type { float x; };
struct some_non_vectorizable_type {
float x;
};
EIGEN_DECLARE_TEST(first_aligned)
{
EIGEN_DECLARE_TEST(first_aligned) {
EIGEN_ALIGN16 float array_float[100];
test_first_aligned_helper(array_float, 50);
test_first_aligned_helper(array_float+1, 50);
test_first_aligned_helper(array_float+2, 50);
test_first_aligned_helper(array_float+3, 50);
test_first_aligned_helper(array_float+4, 50);
test_first_aligned_helper(array_float+5, 50);
test_first_aligned_helper(array_float + 1, 50);
test_first_aligned_helper(array_float + 2, 50);
test_first_aligned_helper(array_float + 3, 50);
test_first_aligned_helper(array_float + 4, 50);
test_first_aligned_helper(array_float + 5, 50);
EIGEN_ALIGN16 double array_double[100];
test_first_aligned_helper(array_double, 50);
test_first_aligned_helper(array_double+1, 50);
test_first_aligned_helper(array_double+2, 50);
double *array_double_plus_4_bytes = (double*)(std::uintptr_t(array_double)+4);
test_first_aligned_helper(array_double + 1, 50);
test_first_aligned_helper(array_double + 2, 50);
double *array_double_plus_4_bytes = (double *)(std::uintptr_t(array_double) + 4);
test_none_aligned_helper(array_double_plus_4_bytes, 50);
test_none_aligned_helper(array_double_plus_4_bytes+1, 50);
test_none_aligned_helper(array_double_plus_4_bytes + 1, 50);
some_non_vectorizable_type array_nonvec[100];
test_first_aligned_helper(array_nonvec, 100);
test_none_aligned_helper(array_nonvec, 100);