[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / inline-asm-validate-m68k.c
blob3abe638324452ad7814d4420daa62e3cfeda0597
1 // REQUIRES: m68k-registered-target
2 // RUN: %clang_cc1 -triple m68k -fsyntax-only -verify %s -DINVALID
3 // RUN: %clang_cc1 -triple m68k -fsyntax-only -verify %s
5 #ifdef INVALID
7 // Invalid constraint usages that can be blocked by frontend
9 void I() {
10 static const int BelowMin = 0;
11 static const int AboveMax = 9;
12 asm ("" :: "I"(BelowMin)); // expected-error{{value '0' out of range for constraint 'I'}}
13 asm ("" :: "I"(AboveMax)); // expected-error{{value '9' out of range for constraint 'I'}}
16 void J() {
17 static const int BelowMin = -0x8001;
18 static const int AboveMax = 0x8000;
19 asm ("" :: "J"(BelowMin)); // expected-error{{value '-32769' out of range for constraint 'J'}}
20 asm ("" :: "J"(AboveMax)); // expected-error{{value '32768' out of range for constraint 'J'}}
23 void L() {
24 static const int BelowMin = -9;
25 static const int AboveMax = 0;
26 asm ("" :: "L"(BelowMin)); // expected-error{{value '-9' out of range for constraint 'L'}}
27 asm ("" :: "L"(AboveMax)); // expected-error{{value '0' out of range for constraint 'L'}}
30 void N() {
31 static const int BelowMin = 23;
32 static const int AboveMax = 32;
33 asm ("" :: "N"(BelowMin)); // expected-error{{value '23' out of range for constraint 'N'}}
34 asm ("" :: "N"(AboveMax)); // expected-error{{value '32' out of range for constraint 'N'}}
37 void O() {
38 // Valid only if it's 16
39 static const int IncorrectVal = 18;
40 asm ("" :: "O"(IncorrectVal)); // expected-error{{value '18' out of range for constraint 'O'}}
43 void P() {
44 static const int BelowMin = 7;
45 static const int AboveMax = 16;
46 asm ("" :: "P"(BelowMin)); // expected-error{{value '7' out of range for constraint 'P'}}
47 asm ("" :: "P"(AboveMax)); // expected-error{{value '16' out of range for constraint 'P'}}
50 void C0() {
51 // Valid only if it's 0
52 static const int IncorrectVal = 1;
53 asm ("" :: "C0"(IncorrectVal)); // expected-error{{value '1' out of range for constraint 'C0'}}
56 #else
57 // Valid constraint usages.
58 // Note that these constraints can not be fully validated by frontend.
59 // So we're only testing the availability of their letters here.
60 // expected-no-diagnostics
62 void K() {
63 asm ("" :: "K"(0x80));
66 void M() {
67 asm ("" :: "M"(0x100));
69 void Ci() {
70 asm ("" :: "Ci"(0));
73 void Cj() {
74 asm ("" :: "Cj"(0x8000));
77 // Register constraints
78 void a(int x) {
79 asm ("" :: "a"(x));
82 void d(int x) {
83 asm ("" :: "d"(x));
86 // Memory constraints
87 void mem() {
88 int x;
89 asm ("" :: "m"(x));
90 asm ("" :: "Q"(x));
91 asm ("" :: "U"(x));
93 #endif