| 1 |
// PR target/88152 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-O2 -std=c++14 -fdump-tree-forwprop1" } |
| 4 |
// { dg-final { scan-tree-dump-times " (?:(?:<|>=) \{ 0\[, \]|>> (?:7|15|31|63))" 120 "forwprop1" } } |
| 5 |
|
| 6 |
template <typename T, int N> |
| 7 |
using V [[gnu::vector_size (sizeof (T) * N)]] = T; |
| 8 |
|
| 9 |
void *foo (); |
| 10 |
|
| 11 |
template <typename T, int N, T max, T maxp1> |
| 12 |
__attribute__((noipa)) void |
| 13 |
test_uns () |
| 14 |
{ |
| 15 |
V<T, N> *x = (V<T, N> *) foo (); |
| 16 |
x[1] = x[0] > max; |
| 17 |
x[3] = x[2] >= maxp1; |
| 18 |
x[5] = x[4] <= max; |
| 19 |
x[7] = x[6] < maxp1; |
| 20 |
} |
| 21 |
|
| 22 |
template <typename T, int N> |
| 23 |
__attribute__((noipa)) void |
| 24 |
test () |
| 25 |
{ |
| 26 |
V<T, N> *x = (V<T, N> *) foo (); |
| 27 |
x[1] = x[0] >= 0; |
| 28 |
x[3] = x[2] > -1; |
| 29 |
x[5] = x[4] < 0; |
| 30 |
x[7] = x[6] <= -1; |
| 31 |
} |
| 32 |
|
| 33 |
template <int N> |
| 34 |
__attribute__((noipa)) void |
| 35 |
tests () |
| 36 |
{ |
| 37 |
test_uns<unsigned char, N, __SCHAR_MAX__, 1U + __SCHAR_MAX__> (); |
| 38 |
test<signed char, N> (); |
| 39 |
test_uns<unsigned short int, N, __SHRT_MAX__, 1U + __SHRT_MAX__> (); |
| 40 |
test<short int, N> (); |
| 41 |
test_uns<unsigned int, N, __INT_MAX__, 1U + __INT_MAX__> (); |
| 42 |
test<int, N> (); |
| 43 |
test_uns<unsigned long int, N, __LONG_MAX__, 1UL + __LONG_MAX__> (); |
| 44 |
test<long int, N> (); |
| 45 |
test_uns<unsigned long long int, N, __LONG_LONG_MAX__, 1ULL + __LONG_LONG_MAX__> (); |
| 46 |
test<long long int, N> (); |
| 47 |
} |
| 48 |
|
| 49 |
void |
| 50 |
all_tests () |
| 51 |
{ |
| 52 |
tests<1> (); |
| 53 |
tests<2> (); |
| 54 |
tests<8> (); |
| 55 |
} |