https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106322
--- Comment #16 from Mathieu Malaterre <malat at debian dot org> ---
Simplified version:
% cat demo.cc
#include "hwy/highway.h"
#include "hwy/tests/test_util-inl.h"
struct TestMulHigh {
template <typename T, class D>
void operator()(T /*unused*/, D d) {
const size_t N = 2;
hwy::AlignedFreeUniquePtr<short unsigned int []> in_lanes =
hwy::AllocateAligned<T>(N);
uint16_t expected_lanes[2];
for (size_t i = 0; i < N; ++i) {
in_lanes[i] = T(hwy::LimitsMax<T>() >> i);
}
expected_lanes[0] = 65534 ;
expected_lanes[1] = 16383 ;
hwy::N_EMU128::Vec128<uint16_t, 2> v = Load(d, in_lanes.get());
HWY_ASSERT_VEC_EQ(d, in_lanes.get(), v);
hwy::N_EMU128::Vec128<uint16_t, 2> actual = MulHigh(v, v);
HWY_ASSERT_VEC_EQ(d, expected_lanes, actual);
}
};
int main()
{
TestMulHigh()(uint16_t(), hwy::N_EMU128::FixedTag<uint16_t, 2>());
}
Working:
% g++ -O2 -fno-tree-vectorize -o demo demo.cc -lhwy -lhwy_test
Not working:
% g++ -O2 -o demo demo.cc -lhwy -lhwy_test
With:
% apt-cache policy libhwy-dev
libhwy-dev:
Installed: 1.0.0-5
Candidate: 1.0.0-5
Version table:
*** 1.0.0-5 500
500 http://deb.debian.org/debian sid/main i386 Packages
100 /var/lib/dpkg/status