| 1 |
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s |
| 2 |
// |
| 3 |
// Ensure that when we use builtins in C++ code with templates that compute the |
| 4 |
// valid immediate, the dead code with the invalid immediate doesn't error. |
| 5 |
// expected-no-diagnostics |
| 6 |
|
| 7 |
typedef short __v8hi __attribute__((__vector_size__(16))); |
| 8 |
|
| 9 |
template <int Imm> |
| 10 |
__v8hi test(__v8hi a) { |
| 11 |
if (Imm < 4) |
| 12 |
return __builtin_ia32_pshuflw(a, 0x55 * Imm); |
| 13 |
else |
| 14 |
return __builtin_ia32_pshuflw(a, 0x55 * (Imm - 4)); |
| 15 |
} |
| 16 |
|
| 17 |
template __v8hi test<0>(__v8hi); |
| 18 |
template __v8hi test<1>(__v8hi); |
| 19 |
template __v8hi test<2>(__v8hi); |
| 20 |
template __v8hi test<3>(__v8hi); |
| 21 |
template __v8hi test<4>(__v8hi); |
| 22 |
template __v8hi test<5>(__v8hi); |
| 23 |
template __v8hi test<6>(__v8hi); |
| 24 |
template __v8hi test<7>(__v8hi); |