Debian Codegraph @

gcc/testsuite/g++.dg/ext/constexpr-pr93549.C

raw
1 // PR c++/93549
2 // { dg-do compile { target c++17 } }
3 // { dg-options "-O2 -Wno-psabi -w" }
4
5 struct simd {
6 using shortx8 [[gnu::vector_size(16)]] = short;
7 shortx8 data;
8 constexpr simd (short x) : data{x, x, x, x, x, x, x, x} {}
9 constexpr friend unsigned operator== (simd lhs, simd rhs)
10 {
11 shortx8 tmp = lhs.data == rhs.data;
12 using ushort = unsigned short;
13 auto bools = tmp ? ushort(1) : ushort(0);
14 unsigned bits = 0;
15 for (int i = 0; i < 8; ++i)
16 bits |= bools[i] << i;
17 return bits;
18 }
19 };
20
21 auto
22 foo ()
23 {
24 constexpr auto tmp = simd(1) == simd(2);
25 return tmp;
26 }