re PR c++/67184 (Missed optimization with C++11 final specifier)
[official-gcc.git] / gcc / testsuite / g++.dg / other / vector-compare.C
blob77b0f5153ca1231b506629ecec8b7be199749c85
1 /* { dg-do compile { target c++11 } } */
2 /* { dg-options "-Wall -Wno-tautological-compare" } */
4 // Check that we can compare vector types that really are the same through
5 // typedefs.
7 typedef float v4f __attribute__((vector_size(4*sizeof(float))));
9 template <class T> void eat (T&&) {}
11 template <class T, int n>
12 struct Vec
14   typedef T type __attribute__((vector_size(4*sizeof(T))));
16   template <class U>
17   static void fun (type const& t, U& u) { eat (t > u); }
20 long long
21 f (v4f *x, v4f const *y)
23   return ((*x < *y) | (*x <= *y))[2];
26 int main ()
28   v4f x = {0,1,2,3};
29   Vec<const volatile float,4>::type f = {-1,5,2,3.1};
30   auto c = (x == f) == (x >= x);
31   eat (c[3]);
32   Vec<const volatile float,4>::fun (f, x);
33   Vec<const volatile float,4>::fun (x, f);
34   Vec<const volatile float,4>::fun (f, f);
35   Vec<const volatile float,4>::fun (x, x);