From 776960024585b907acc4abc3c59aef605941bb75 Mon Sep 17 00:00:00 2001 From: Francesco Mazzoli Date: Fri, 24 Jan 2020 11:06:36 +0100 Subject: [PATCH] add some static checks for packet-picking logic --- test/vectorization_logic.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/vectorization_logic.cpp b/test/vectorization_logic.cpp index 4bf3b3db2..ad1954d53 100644 --- a/test/vectorization_logic.cpp +++ b/test/vectorization_logic.cpp @@ -266,7 +266,38 @@ struct vectorization_logic VERIFY(test_redux(VectorX(10), LinearVectorizedTraversal,NoUnrolling)); + + // Some static checks for packet-picking -- see + // for context. + + // Any multiple of the packet size itself will result in the normal packet + STATIC_CHECK(( + internal::is_same::type, PacketType>::value + )); + STATIC_CHECK(( + internal::is_same::type, PacketType>::value + )); + STATIC_CHECK(( + internal::is_same::type, PacketType>::value + )); + // Moreover, situations where the size is _not_ a multiple but picking the full packet + // is convenient will also work, but only with unaligned vectorize + STATIC_CHECK(( + !(EIGEN_UNALIGNED_VECTORIZE || PacketSize == HalfPacketSize) || + internal::is_same::type, PacketType>::value + )); + STATIC_CHECK(( + !(EIGEN_UNALIGNED_VECTORIZE || PacketSize == HalfPacketSize) || + internal::is_same::type, PacketType>::value + )); + // In situations where the picking the full-packet would be detrimental the half-packet + // is chosen. + STATIC_CHECK(( + !(PacketSize > 2) || + internal::is_same::type, HalfPacketType>::value + )); } + }; template struct vectorization_logic