4
4
void I (int i , int j ) {
5
5
static const int BelowMin = -1 ;
6
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
7
__asm__("xorl %0,%2"
11
8
: "=r" (i )
12
9
: "0" (i ), "I" (BelowMin )); // expected-error{{value '-1' out of range for constraint 'I'}}
@@ -21,9 +18,6 @@ void I(int i, int j) {
21
18
void J (int i , int j ) {
22
19
static const int BelowMin = -1 ;
23
20
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
21
__asm__("xorl %0,%2"
28
22
: "=r" (i )
29
23
: "0" (i ), "J" (BelowMin )); // expected-error{{value '-1' out of range for constraint 'J'}}
@@ -38,9 +32,6 @@ void J(int i, int j) {
38
32
void K (int i , int j ) {
39
33
static const int BelowMin = -129 ;
40
34
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
35
__asm__("xorl %0,%2"
45
36
: "=r" (i )
46
37
: "0" (i ), "K" (BelowMin )); // expected-error{{value '-129' out of range for constraint 'K'}}
@@ -60,9 +51,6 @@ void L(int i, int j) {
60
51
static const int Valid1 = 0xff ;
61
52
static const int Valid2 = 0xffff ;
62
53
static const int Valid3 = 0xffffffff ;
63
- __asm__("xorl %0,%2"
64
- : "=r" (i )
65
- : "0" (i ), "L" (j )); // expected-error{{constraint 'L' expects an integer constant expression}}
66
54
__asm__("xorl %0,%2"
67
55
: "=r" (i )
68
56
: "0" (i ), "L" (Invalid1 )); // expected-error{{value '1' out of range for constraint 'L'}}
@@ -89,9 +77,6 @@ void L(int i, int j) {
89
77
void M (int i , int j ) {
90
78
static const int BelowMin = -1 ;
91
79
static const int AboveMax = 4 ;
92
- __asm__("xorl %0,%2"
93
- : "=r" (i )
94
- : "0" (i ), "M" (j )); // expected-error{{constraint 'M' expects an integer constant expression}}
95
80
__asm__("xorl %0,%2"
96
81
: "=r" (i )
97
82
: "0" (i ), "M" (BelowMin )); // expected-error{{value '-1' out of range for constraint 'M'}}
@@ -106,9 +91,6 @@ void M(int i, int j) {
106
91
void N (int i , int j ) {
107
92
static const int BelowMin = -1 ;
108
93
static const int AboveMax = 256 ;
109
- __asm__("xorl %0,%2"
110
- : "=r" (i )
111
- : "0" (i ), "N" (j )); // expected-error{{constraint 'N' expects an integer constant expression}}
112
94
__asm__("xorl %0,%2"
113
95
: "=r" (i )
114
96
: "0" (i ), "N" (BelowMin )); // expected-error{{value '-1' out of range for constraint 'N'}}
@@ -123,9 +105,6 @@ void N(int i, int j) {
123
105
void O (int i , int j ) {
124
106
static const int BelowMin = -1 ;
125
107
static const int AboveMax = 128 ;
126
- __asm__("xorl %0,%2"
127
- : "=r" (i )
128
- : "0" (i ), "O" (j )); // expected-error{{constraint 'O' expects an integer constant expression}}
129
108
__asm__("xorl %0,%2"
130
109
: "=r" (i )
131
110
: "0" (i ), "O" (BelowMin )); // expected-error{{value '-1' out of range for constraint 'O'}}
@@ -146,10 +125,6 @@ void pr40890(void) {
146
125
__asm__ __volatile__("\n#define S_A abcd%0\n" : : "n" (& ((struct s * )0 )-> a ));
147
126
// This offset-from-null pointer can be used as an integer constant expression.
148
127
__asm__ __volatile__("\n#define S_B abcd%0\n" : : "n" (& ((struct s * )0 )-> b ));
149
- // This pointer cannot be used as an integer constant expression.
150
- __asm__ __volatile__("\n#define GLOBAL_A abcd%0\n" : : "n" (& s .a )); // expected-error{{constraint 'n' expects an integer constant expression}}
151
- // Floating-point is also not okay.
152
- __asm__ __volatile__("\n#define PI abcd%0\n" : : "n" (3.14f )); // expected-error{{constraint 'n' expects an integer constant expression}}
153
128
#ifdef AMD64
154
129
// This arbitrary pointer is fine.
155
130
__asm__ __volatile__("\n#define BEEF abcd%0\n" : : "n" ((int * )0xdeadbeeeeeef ));
0 commit comments