brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 3abe638 Raw
95 lines · c
1// REQUIRES: m68k-registered-target2// RUN: %clang_cc1 -triple m68k -fsyntax-only -verify %s -DINVALID3// RUN: %clang_cc1 -triple m68k -fsyntax-only -verify %s4 5#ifdef INVALID6 7// Invalid constraint usages that can be blocked by frontend8 9void 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'}}14}15 16void 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'}}21}22 23void 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'}}28}29 30void 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'}}35}36 37void O() {38  // Valid only if it's 1639  static const int IncorrectVal = 18;40  asm ("" :: "O"(IncorrectVal)); // expected-error{{value '18' out of range for constraint 'O'}}41}42 43void 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'}}48}49 50void C0() {51  // Valid only if it's 052  static const int IncorrectVal = 1;53  asm ("" :: "C0"(IncorrectVal)); // expected-error{{value '1' out of range for constraint 'C0'}}54}55 56#else57// 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-diagnostics61 62void K() {63  asm ("" :: "K"(0x80));64}65 66void M() {67  asm ("" :: "M"(0x100));68}69void Ci() {70  asm ("" :: "Ci"(0));71}72 73void Cj() {74  asm ("" :: "Cj"(0x8000));75}76 77// Register constraints78void a(int x) {79  asm ("" :: "a"(x));80}81 82void d(int x) {83  asm ("" :: "d"(x));84}85 86// Memory constraints87void mem() {88  int x;89  asm ("" :: "m"(x));90  asm ("" :: "Q"(x));91  asm ("" :: "U"(x));92}93#endif94 95