1 // { dg-do compile }
2 // { dg-additional-options "-Wno-psabi" }
3
4 class AssertionResult {
5 bool success_;
6 };
7
8 AssertionResult AssertionSuccess();
9
10 template <typename T1>
EXPECT_EQ(const T1 & expected,const T1 & actual)11 AssertionResult EXPECT_EQ(const T1& expected, const T1& actual) {
12 if (expected == actual) {
13 return AssertionSuccess();
14 }
15 return AssertionSuccess();
16 }
17
18 struct uuid
19 {
20 unsigned char data[16];
21 };
22
23 bool operator== (uuid const& lhs, uuid const& rhs);
24
25 typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
26 typedef int __v4si __attribute__ ((__vector_size__ (16)));
27 typedef char __v16qi __attribute__ ((__vector_size__ (16)));
28 typedef long long __m128i_u __attribute__ ((__vector_size__ (16), __may_alias__, __aligned__ (1)));
29
30 int foo (__v16qi);
31
32 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_loadu_si128(__m128i_u const * __P)33 _mm_loadu_si128 (__m128i_u const *__P)
34 {
35 return *__P;
36 }
37 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_cmpeq_epi32(__m128i __A,__m128i __B)38 _mm_cmpeq_epi32 (__m128i __A, __m128i __B)
39 {
40 return (__m128i) ((__v4si)__A == (__v4si)__B);
41 }
42 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_movemask_epi8(__m128i __A)43 _mm_movemask_epi8 (__m128i __A)
44 {
45 return foo ((__v16qi)__A);
46 }
47
48
load_unaligned_si128(const unsigned char * p)49 __m128i load_unaligned_si128(const unsigned char* p)
50 {
51 return _mm_loadu_si128(reinterpret_cast< const __m128i* >(p));
52 }
53
54 inline bool operator== (uuid const& lhs, uuid const& rhs)
55 {
56 __m128i mm_left = load_unaligned_si128(lhs.data);
57 __m128i mm_right = load_unaligned_si128(rhs.data);
58
59 __m128i mm_cmp = _mm_cmpeq_epi32(mm_left, mm_right);
60
61 return _mm_movemask_epi8(mm_cmp) == 0xFFFF;
62 }
63
crash_gcc7()64 void crash_gcc7()
65 {
66 static const uuid u = uuid();
67 EXPECT_EQ(u, u);
68 }
69