blob: 0f37f4a34649eda69a15051fad288aedfd796549 [file] [log] [blame]
Chandler Carruth16e6bc22018-06-21 23:46:09 +00001// 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.
Chandler Carruthf34ffd52018-06-21 23:52:36 +00005// expected-no-diagnostics
Chandler Carruth16e6bc22018-06-21 23:46:09 +00006
7typedef short __v8hi __attribute__((__vector_size__(16)));
8
9template <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
17template __v8hi test<0>(__v8hi);
18template __v8hi test<1>(__v8hi);
19template __v8hi test<2>(__v8hi);
20template __v8hi test<3>(__v8hi);
21template __v8hi test<4>(__v8hi);
22template __v8hi test<5>(__v8hi);
23template __v8hi test<6>(__v8hi);
Chandler Carruthf34ffd52018-06-21 23:52:36 +000024template __v8hi test<7>(__v8hi);