1 // RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s 3 4 void I(int i, int j) { 5 static const int BelowMin = -1; 6 static const int AboveMax = 32; 7 __asm__("xorl %0,%2" 8 : "=r"(i) 9 : "0"(i), "I"(j)); // expected-error{{constraint 'I' expects an integer constant expression}} 10 __asm__("xorl %0,%2" 11 : "=r"(i) 12 : "0"(i), "I"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'I'}} 13 __asm__("xorl %0,%2" 14 : "=r"(i) 15 : "0"(i), "I"(AboveMax)); // expected-error{{value '32' out of range for constraint 'I'}} 16 __asm__("xorl %0,%2" 17 : "=r"(i) 18 : "0"(i), "I"(16)); // expected-no-error 19 } 20 21 void J(int i, int j) { 22 static const int BelowMin = -1; 23 static const int AboveMax = 64; 24 __asm__("xorl %0,%2" 25 : "=r"(i) 26 : "0"(i), "J"(j)); // expected-error{{constraint 'J' expects an integer constant expression}} 27 __asm__("xorl %0,%2" 28 : "=r"(i) 29 : "0"(i), "J"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'J'}} 30 __asm__("xorl %0,%2" 31 : "=r"(i) 32 : "0"(i), "J"(AboveMax)); // expected-error{{value '64' out of range for constraint 'J'}} 33 __asm__("xorl %0,%2" 34 : "=r"(i) 35 : "0"(i), "J"(32)); // expected-no-error 36 } 37 38 void K(int i, int j) { 39 static const int BelowMin = -129; 40 static const int AboveMax = 128; 41 __asm__("xorl %0,%2" 42 : "=r"(i) 43 : "0"(i), "K"(j)); // expected-error{{constraint 'K' expects an integer constant expression}} 44 __asm__("xorl %0,%2" 45 : "=r"(i) 46 : "0"(i), "K"(BelowMin)); // expected-error{{value '-129' out of range for constraint 'K'}} 47 __asm__("xorl %0,%2" 48 : "=r"(i) 49 : "0"(i), "K"(AboveMax)); // expected-error{{value '128' out of range for constraint 'K'}} 50 __asm__("xorl %0,%2" 51 : "=r"(i) 52 : "0"(i), "K"(96)); // expected-no-error 53 } 54 55 void M(int i, int j) { 56 static const int BelowMin = -1; 57 static const int AboveMax = 4; 58 __asm__("xorl %0,%2" 59 : "=r"(i) 60 : "0"(i), "M"(j)); // expected-error{{constraint 'M' expects an integer constant expression}} 61 __asm__("xorl %0,%2" 62 : "=r"(i) 63 : "0"(i), "M"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'M'}} 64 __asm__("xorl %0,%2" 65 : "=r"(i) 66 : "0"(i), "M"(AboveMax)); // expected-error{{value '4' out of range for constraint 'M'}} 67 __asm__("xorl %0,%2" 68 : "=r"(i) 69 : "0"(i), "M"(2)); // expected-no-error 70 } 71 72 void N(int i, int j) { 73 static const int BelowMin = -1; 74 static const int AboveMax = 256; 75 __asm__("xorl %0,%2" 76 : "=r"(i) 77 : "0"(i), "N"(j)); // expected-error{{constraint 'N' expects an integer constant expression}} 78 __asm__("xorl %0,%2" 79 : "=r"(i) 80 : "0"(i), "N"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'N'}} 81 __asm__("xorl %0,%2" 82 : "=r"(i) 83 : "0"(i), "N"(AboveMax)); // expected-error{{value '256' out of range for constraint 'N'}} 84 __asm__("xorl %0,%2" 85 : "=r"(i) 86 : "0"(i), "N"(128)); // expected-no-error 87 } 88 89 void O(int i, int j) { 90 static const int BelowMin = -1; 91 static const int AboveMax = 128; 92 __asm__("xorl %0,%2" 93 : "=r"(i) 94 : "0"(i), "O"(j)); // expected-error{{constraint 'O' expects an integer constant expression}} 95 __asm__("xorl %0,%2" 96 : "=r"(i) 97 : "0"(i), "O"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'O'}} 98 __asm__("xorl %0,%2" 99 : "=r"(i) 100 : "0"(i), "O"(AboveMax)); // expected-error{{value '128' out of range for constraint 'O'}} 101 __asm__("xorl %0,%2" 102 : "=r"(i) 103 : "0"(i), "O"(64)); // expected-no-error 104 } 105 106