1 | // RUN: %clang_cc1 -ffreestanding -fms-compatibility -fms-compatibility-version=19 -verify %s -triple i686-windows-msvc -fms-extensions -DTEST_X86 |
2 | // RUN: %clang_cc1 -ffreestanding -fms-compatibility -fms-compatibility-version=19 -verify %s -triple x86_64-windows-msvc -fms-extensions -DTEST_X64 |
3 | // RUN: %clang_cc1 -ffreestanding -fms-compatibility -fms-compatibility-version=19 -verify %s -triple arm-windows-msvc -fms-extensions -DTEST_ARM |
4 | // RUN: %clang_cc1 -ffreestanding -fms-compatibility -fms-compatibility-version=19 -verify %s -triple thumbv7-windows-msvc -fms-extensions -DTEST_ARM |
5 | // RUN: %clang_cc1 -ffreestanding -fms-compatibility -fms-compatibility-version=19 -verify %s -triple aarch64-windows-msvc -fms-extensions -DTEST_ARM |
6 | |
7 | #include <intrin.h> |
8 | extern unsigned char sink; |
9 | |
10 | #ifdef TEST_X86 |
11 | void x86(long *bits, __int64 *bits64, long bitidx) { |
12 | sink = _bittest(bits, bitidx); |
13 | sink = _bittestandcomplement(bits, bitidx); |
14 | sink = _bittestandreset(bits, bitidx); |
15 | sink = _bittestandset(bits, bitidx); |
16 | sink = _interlockedbittestandreset(bits, bitidx); |
17 | sink = _interlockedbittestandset(bits, bitidx); |
18 | |
19 | sink = _bittest64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
20 | sink = _bittestandcomplement64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
21 | sink = _bittestandreset64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
22 | sink = _bittestandset64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
23 | sink = _interlockedbittestandreset64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
24 | sink = _interlockedbittestandset64(bits64, bitidx); // expected-error {{builtin is not supported on this target}} |
25 | |
26 | sink = _interlockedbittestandreset_acq(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
27 | sink = _interlockedbittestandreset_rel(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
28 | sink = _interlockedbittestandreset_nf(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
29 | sink = _interlockedbittestandset_acq(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
30 | sink = _interlockedbittestandset_rel(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
31 | sink = _interlockedbittestandset_nf(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
32 | } |
33 | #endif |
34 | |
35 | #ifdef TEST_X64 |
36 | void x64(long *bits, __int64 *bits64, long bitidx) { |
37 | sink = _bittest(bits, bitidx); |
38 | sink = _bittestandcomplement(bits, bitidx); |
39 | sink = _bittestandreset(bits, bitidx); |
40 | sink = _bittestandset(bits, bitidx); |
41 | sink = _interlockedbittestandreset(bits, bitidx); |
42 | sink = _interlockedbittestandset(bits, bitidx); |
43 | |
44 | sink = _bittest64(bits64, bitidx); |
45 | sink = _bittestandcomplement64(bits64, bitidx); |
46 | sink = _bittestandreset64(bits64, bitidx); |
47 | sink = _bittestandset64(bits64, bitidx); |
48 | sink = _interlockedbittestandreset64(bits64, bitidx); |
49 | sink = _interlockedbittestandset64(bits64, bitidx); |
50 | |
51 | sink = _interlockedbittestandreset_acq(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
52 | sink = _interlockedbittestandreset_rel(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
53 | sink = _interlockedbittestandreset_nf(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
54 | sink = _interlockedbittestandset_acq(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
55 | sink = _interlockedbittestandset_rel(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
56 | sink = _interlockedbittestandset_nf(bits, bitidx); // expected-error {{builtin is not supported on this target}} |
57 | } |
58 | #endif |
59 | |
60 | #ifdef TEST_ARM |
61 | // expected-no-diagnostics |
62 | void arm(long *bits, __int64 *bits64, long bitidx) { |
63 | sink = _bittest(bits, bitidx); |
64 | sink = _bittestandcomplement(bits, bitidx); |
65 | sink = _bittestandreset(bits, bitidx); |
66 | sink = _bittestandset(bits, bitidx); |
67 | sink = _interlockedbittestandreset(bits, bitidx); |
68 | sink = _interlockedbittestandset(bits, bitidx); |
69 | |
70 | sink = _bittest64(bits64, bitidx); |
71 | sink = _bittestandcomplement64(bits64, bitidx); |
72 | sink = _bittestandreset64(bits64, bitidx); |
73 | sink = _bittestandset64(bits64, bitidx); |
74 | sink = _interlockedbittestandreset64(bits64, bitidx); |
75 | sink = _interlockedbittestandset64(bits64, bitidx); |
76 | |
77 | sink = _interlockedbittestandreset_acq(bits, bitidx); |
78 | sink = _interlockedbittestandreset_rel(bits, bitidx); |
79 | sink = _interlockedbittestandreset_nf(bits, bitidx); |
80 | sink = _interlockedbittestandset_acq(bits, bitidx); |
81 | sink = _interlockedbittestandset_rel(bits, bitidx); |
82 | sink = _interlockedbittestandset_nf(bits, bitidx); |
83 | } |
84 | #endif |
85 | |