John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -Wno-unused-value -emit-llvm %s -o - | FileCheck %s |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 2 | |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 3 | // CHECK: @i = common global [[INT:i[0-9]+]] 0 |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 4 | volatile int i, j, k; |
| 5 | volatile int ar[5]; |
| 6 | volatile char c; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 7 | // CHECK: @ci = common global [[CINT:%.*]] zeroinitializer |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 8 | volatile _Complex int ci; |
| 9 | volatile struct S { |
| 10 | #ifdef __cplusplus |
| 11 | void operator =(volatile struct S&o) volatile; |
| 12 | #endif |
| 13 | int i; |
| 14 | } a, b; |
| 15 | |
| 16 | //void operator =(volatile struct S&o1, volatile struct S&o2) volatile; |
Daniel Dunbar | 23afaad | 2009-11-17 08:57:36 +0000 | [diff] [blame] | 17 | int printf(const char *, ...); |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 18 | |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 19 | |
| 20 | // Note that these test results are very much specific to C! |
| 21 | // Assignments in C++ yield l-values, not r-values, and the situations |
| 22 | // that do implicit lvalue-to-rvalue conversion are substantially |
| 23 | // reduced. |
| 24 | |
| 25 | // CHECK: define void @test() |
| 26 | void test() { |
| 27 | // CHECK: volatile load [[INT]]* @i |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 28 | i; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 29 | // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 30 | // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 31 | // CHECK-NEXT: sitofp [[INT]] |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 32 | (float)(ci); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 33 | // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 34 | // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 35 | (void)ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 36 | // CHECK-NEXT: bitcast |
| 37 | // CHECK-NEXT: memcpy |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 38 | (void)a; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 39 | // CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 40 | // CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 41 | // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 42 | // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 43 | (void)(ci=ci); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 44 | // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j |
| 45 | // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 46 | (void)(i=j); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 47 | // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 48 | // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 49 | // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 50 | // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 51 | // Not sure why they're ordered this way. |
| 52 | // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] |
| 53 | // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] |
| 54 | // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 55 | // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 56 | ci+=ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 57 | |
| 58 | // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 59 | // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 60 | // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 61 | // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 62 | // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]] |
| 63 | // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]] |
| 64 | // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 65 | // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 66 | // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0) |
| 67 | // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 68 | // These additions can be elided |
| 69 | // CHECK-NEXT: add [[INT]] [[R]], [[R2]] |
| 70 | // CHECK-NEXT: add [[INT]] [[I]], [[I2]] |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 71 | (ci += ci) + ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 72 | // CHECK-NEXT: call void asm |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 73 | asm("nop"); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 74 | // CHECK-NEXT: volatile load |
| 75 | // CHECK-NEXT: volatile load |
| 76 | // CHECK-NEXT: add nsw [[INT]] |
| 77 | // CHECK-NEXT: volatile store |
| 78 | // CHECK-NEXT: volatile load |
| 79 | // CHECK-NEXT: add nsw [[INT]] |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 80 | (i += j) + k; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 81 | // CHECK-NEXT: call void asm |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 82 | asm("nop"); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 83 | // CHECK-NEXT: volatile load |
| 84 | // CHECK-NEXT: volatile load |
| 85 | // CHECK-NEXT: add nsw [[INT]] |
| 86 | // CHECK-NEXT: volatile store |
| 87 | // CHECK-NEXT: add nsw [[INT]] |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 88 | (i += j) + 1; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 89 | // CHECK-NEXT: call void asm |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 90 | asm("nop"); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 91 | // CHECK-NEXT: volatile load |
| 92 | // CHECK-NEXT: volatile load |
| 93 | // CHECK-NEXT: volatile load |
| 94 | // CHECK-NEXT: volatile load |
| 95 | // CHECK-NEXT: add [[INT]] |
| 96 | // CHECK-NEXT: add [[INT]] |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 97 | ci+ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 98 | |
| 99 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 100 | __real i; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 101 | // CHECK-NEXT: volatile load |
| 102 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 103 | +ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 104 | // CHECK-NEXT: call void asm |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 105 | asm("nop"); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 106 | // CHECK-NEXT: volatile load |
| 107 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 108 | (void)(i=i); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 109 | // CHECK-NEXT: volatile load |
| 110 | // CHECK-NEXT: volatile store |
| 111 | // CHECK-NEXT: sitofp |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 112 | (float)(i=i); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 113 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 114 | (void)i; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 115 | // CHECK-NEXT: volatile load |
| 116 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 117 | i=i; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 118 | // CHECK-NEXT: volatile load |
| 119 | // CHECK-NEXT: volatile store |
| 120 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 121 | i=i=i; |
| 122 | #ifndef __cplusplus |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 123 | // CHECK-NEXT: volatile load |
| 124 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 125 | (void)__builtin_choose_expr(0, i=i, j=j); |
| 126 | #endif |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 127 | // CHECK-NEXT: volatile load |
| 128 | // CHECK-NEXT: icmp |
| 129 | // CHECK-NEXT: br i1 |
| 130 | // CHECK: volatile load |
| 131 | // CHECK-NEXT: volatile store |
| 132 | // CHECK-NEXT: br label |
| 133 | // CHECK: volatile load |
| 134 | // CHECK-NEXT: volatile store |
| 135 | // CHECK-NEXT: br label |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 136 | k ? (i=i) : (j=j); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 137 | // CHECK: phi |
| 138 | // CHECK-NEXT: volatile load |
| 139 | // CHECK-NEXT: volatile load |
| 140 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 141 | (void)(i,(i=i)); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 142 | // CHECK-NEXT: volatile load |
| 143 | // CHECK-NEXT: volatile store |
| 144 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 145 | i=i,i; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 146 | // CHECK-NEXT: volatile load |
| 147 | // CHECK-NEXT: volatile store |
| 148 | // CHECK-NEXT: volatile load |
| 149 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 150 | (i=j,k=j); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 151 | // CHECK-NEXT: volatile load |
| 152 | // CHECK-NEXT: volatile store |
| 153 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 154 | (i=j,k); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 155 | // CHECK-NEXT: volatile load |
| 156 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 157 | (i,j); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 158 | // CHECK-NEXT: volatile load |
| 159 | // CHECK-NEXT: trunc |
| 160 | // CHECK-NEXT: volatile store |
| 161 | // CHECK-NEXT: sext |
| 162 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 163 | i=c=k; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 164 | // CHECK-NEXT: volatile load |
| 165 | // CHECK-NEXT: volatile load |
| 166 | // CHECK-NEXT: add nsw [[INT]] |
| 167 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 168 | i+=k; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 169 | // CHECK-NEXT: volatile load |
| 170 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 171 | ci; |
| 172 | #ifndef __cplusplus |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 173 | // CHECK-NEXT: volatile load |
| 174 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 175 | (int)ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 176 | // CHECK-NEXT: volatile load |
| 177 | // CHECK-NEXT: volatile load |
| 178 | // CHECK-NEXT: icmp ne |
| 179 | // CHECK-NEXT: icmp ne |
| 180 | // CHECK-NEXT: or i1 |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 181 | (_Bool)ci; |
| 182 | #endif |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 183 | // CHECK-NEXT: volatile load |
| 184 | // CHECK-NEXT: volatile load |
| 185 | // CHECK-NEXT: volatile store |
| 186 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 187 | ci=ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 188 | // CHECK-NEXT: volatile load |
| 189 | // CHECK-NEXT: volatile load |
| 190 | // CHECK-NEXT: volatile store |
| 191 | // CHECK-NEXT: volatile store |
| 192 | // CHECK-NEXT: volatile store |
| 193 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 194 | ci=ci=ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 195 | // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 196 | // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
| 197 | // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1) |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 198 | __imag ci = __imag ci = __imag ci; |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 199 | // CHECK-NEXT: volatile load |
| 200 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 201 | __real (i = j); |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 202 | // CHECK-NEXT: volatile load |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 203 | __imag i; |
| 204 | |
| 205 | // ============================================================ |
Mike Stump | 46cd81f | 2009-05-29 16:24:13 +0000 | [diff] [blame] | 206 | // FIXME: Test cases we get wrong. |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 207 | |
Mike Stump | 2d3b36e | 2009-05-29 16:12:36 +0000 | [diff] [blame] | 208 | // A use. We load all of a into a copy of a, then load i. gcc forgets to do |
| 209 | // the assignment. |
Mike Stump | 46cd81f | 2009-05-29 16:24:13 +0000 | [diff] [blame] | 210 | // (a = a).i; |
Mike Stump | 2d3b36e | 2009-05-29 16:12:36 +0000 | [diff] [blame] | 211 | |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 212 | // ============================================================ |
| 213 | // Test cases where we intentionally differ from gcc, due to suspected bugs in |
| 214 | // gcc. |
| 215 | |
| 216 | // Not a use. gcc forgets to do the assignment. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 217 | // CHECK-NEXT: call void @llvm.memcpy{{.*}}, i1 true |
| 218 | // CHECK-NEXT: bitcast |
| 219 | // CHECK-NEXT: call void @llvm.memcpy{{.*}}, i1 true |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 220 | ((a=a),a); |
| 221 | |
| 222 | // Not a use. gcc gets this wrong, it doesn't emit the copy! |
| 223 | // (void)(a=a); |
| 224 | |
| 225 | // Not a use. gcc got this wrong in 4.2 and omitted the side effects |
| 226 | // entirely, but it is fixed in 4.4.0. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 227 | // CHECK-NEXT: volatile load |
| 228 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 229 | __imag (i = j); |
| 230 | |
| 231 | #ifndef __cplusplus |
| 232 | // A use of the real part |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 233 | // CHECK-NEXT: volatile load |
| 234 | // CHECK-NEXT: volatile load |
| 235 | // CHECK-NEXT: volatile store |
| 236 | // CHECK-NEXT: volatile store |
| 237 | // CHECK-NEXT: sitofp |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 238 | (float)(ci=ci); |
| 239 | // Not a use, bug? gcc treats this as not a use, that's probably a bug due to |
| 240 | // tree folding ignoring volatile. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 241 | // CHECK-NEXT: volatile load |
| 242 | // CHECK-NEXT: volatile load |
| 243 | // CHECK-NEXT: volatile store |
| 244 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 245 | (int)(ci=ci); |
| 246 | #endif |
| 247 | |
| 248 | // A use. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 249 | // CHECK-NEXT: volatile load |
| 250 | // CHECK-NEXT: volatile store |
| 251 | // CHECK-NEXT: sitofp |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 252 | (float)(i=i); |
| 253 | // A use. gcc treats this as not a use, that's probably a bug due to tree |
| 254 | // folding ignoring volatile. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 255 | // CHECK-NEXT: volatile load |
| 256 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 257 | (int)(i=i); |
| 258 | |
| 259 | // A use. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 260 | // CHECK-NEXT: volatile load |
| 261 | // CHECK-NEXT: volatile store |
| 262 | // CHECK-NEXT: sub |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 263 | -(i=j); |
| 264 | // A use. gcc treats this a not a use, that's probably a bug due to tree |
| 265 | // folding ignoring volatile. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 266 | // CHECK-NEXT: volatile load |
| 267 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 268 | +(i=k); |
| 269 | |
| 270 | // A use. gcc treats this a not a use, that's probably a bug due to tree |
| 271 | // folding ignoring volatile. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 272 | // CHECK-NEXT: volatile load |
| 273 | // CHECK-NEXT: volatile load |
| 274 | // CHECK-NEXT: volatile store |
| 275 | // CHECK-NEXT: volatile store |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 276 | __real (ci=ci); |
| 277 | |
| 278 | // A use. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 279 | // CHECK-NEXT: volatile load |
| 280 | // CHECK-NEXT: add |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 281 | i + 0; |
| 282 | // A use. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 283 | // CHECK-NEXT: volatile load |
| 284 | // CHECK-NEXT: volatile store |
| 285 | // CHECK-NEXT: volatile load |
| 286 | // CHECK-NEXT: add |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 287 | (i=j) + i; |
| 288 | // A use. gcc treats this as not a use, that's probably a bug due to tree |
| 289 | // folding ignoring volatile. |
John McCall | b418d74 | 2010-11-16 10:08:07 +0000 | [diff] [blame^] | 290 | // CHECK-NEXT: volatile load |
| 291 | // CHECK-NEXT: volatile store |
| 292 | // CHECK-NEXT: add |
Mike Stump | 7f79f9b | 2009-05-29 15:46:01 +0000 | [diff] [blame] | 293 | (i=j) + 0; |
| 294 | |
| 295 | #ifdef __cplusplus |
| 296 | (i,j)=k; |
| 297 | (j=k,i)=i; |
| 298 | struct { int x; } s, s1; |
| 299 | printf("s is at %p\n", &s); |
| 300 | printf("s is at %p\n", &(s = s1)); |
| 301 | printf("s.x is at %p\n", &((s = s1).x)); |
| 302 | #endif |
| 303 | } |