|
121 | 121 | // RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
|
122 | 122 | // CHECK-UNSAFE-MATH: "-cc1"
|
123 | 123 | // CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math"
|
| 124 | +// CHECK-UNSAFE-MATH: "-mreassociate" |
124 | 125 | //
|
125 | 126 | // RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
|
126 | 127 | // RUN: -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
|
127 | 128 | // RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-UNSAFE-MATH %s
|
128 | 129 | // CHECK-NO-FAST-MATH-UNSAFE-MATH: "-cc1"
|
129 | 130 | // CHECK-NO-FAST-MATH-UNSAFE-MATH: "-menable-unsafe-fp-math"
|
130 |
| -// |
| 131 | +// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-mreassociate" |
| 132 | + |
| 133 | +// The 2nd -fno-fast-math overrides -fassociative-math. |
| 134 | + |
131 | 135 | // RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
|
132 | 136 | // RUN: -fno-fast-math -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
|
133 | 137 | // RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH-NO-FAST-MATH %s
|
134 | 138 | // CHECK-UNSAFE-MATH-NO-FAST-MATH: "-cc1"
|
135 | 139 | // CHECK-UNSAFE-MATH-NO-FAST-MATH-NOT: "-menable-unsafe-fp-math"
|
| 140 | +// CHECK-UNSAFE-MATH-NO-FAST-MATH-NOT: "-mreassociate" |
136 | 141 | //
|
137 | 142 | // Check that various umbrella flags also enable these frontend options.
|
138 | 143 | // RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
151 | 156 | // One umbrella flag is *really* weird and also changes the semantics of the
|
152 | 157 | // program by adding a special preprocessor macro. Check that the frontend flag
|
153 | 158 | // modeling this semantic change is provided. Also check that the flag is not
|
154 |
| -// present if any of the optimization is disabled. |
| 159 | +// present if any of the optimizations are disabled. |
155 | 160 | // RUN: %clang -### -ffast-math -c %s 2>&1 \
|
156 | 161 | // RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
|
157 | 162 | // RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
|
|
175 | 180 | // RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
176 | 181 | // RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \
|
177 | 182 | // RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
| 183 | +// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \ |
| 184 | +// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH --check-prefix=CHECK-ASSOC-MATH %s |
178 | 185 | // CHECK-NO-FAST-MATH: "-cc1"
|
179 | 186 | // CHECK-NO-FAST-MATH-NOT: "-ffast-math"
|
| 187 | +// CHECK-ASSOC-MATH-NOT: "-mreassociate" |
180 | 188 | //
|
181 | 189 | // Check various means of disabling these flags, including disabling them after
|
182 | 190 | // they've been enabled via an umbrella flag.
|
|
209 | 217 | // CHECK-NO-NO-NANS-NOT: "-menable-no-nans"
|
210 | 218 | // CHECK-NO-NO-NANS-NOT: "-ffinite-math-only"
|
211 | 219 | // CHECK-NO-NO-NANS: "-o"
|
212 |
| -// |
| 220 | + |
| 221 | +// A later inverted option overrides an earlier option. |
| 222 | + |
213 | 223 | // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
|
214 | 224 | // RUN: -fno-trapping-math -fno-associative-math -c %s 2>&1 \
|
215 | 225 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
216 |
| -// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
217 |
| -// RUN: -fno-trapping-math -fno-reciprocal-math -c %s 2>&1 \ |
218 |
| -// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s |
219 |
| -// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
220 |
| -// RUN: -fno-trapping-math -fsigned-zeros -c %s 2>&1 \ |
221 |
| -// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s |
222 |
| -// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
223 |
| -// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ |
224 |
| -// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s |
| 226 | + |
225 | 227 | // RUN: %clang -### -funsafe-math-optimizations -fno-associative-math -c %s \
|
226 | 228 | // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
| 229 | + |
227 | 230 | // RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s \
|
228 | 231 | // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
229 | 232 | // RUN: %clang -### -funsafe-math-optimizations -fsigned-zeros -c %s 2>&1 \
|
|
235 | 238 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
236 | 239 | // RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \
|
237 | 240 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
| 241 | + |
238 | 242 | // RUN: %clang -### -ffast-math -fno-reciprocal-math -c %s 2>&1 \
|
239 | 243 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
240 | 244 | // RUN: %clang -### -ffast-math -fsigned-zeros -c %s 2>&1 \
|
|
243 | 247 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
244 | 248 | // RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \
|
245 | 249 | // RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
| 250 | + |
246 | 251 | // CHECK-NO-UNSAFE-MATH: "-cc1"
|
247 | 252 | // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
| 253 | +// CHECK-NO_UNSAFE-MATH-NOT: "-mreassociate" |
248 | 254 | // CHECK-NO-UNSAFE-MATH: "-o"
|
249 |
| -// |
| 255 | + |
| 256 | + |
| 257 | +// Reassociate is allowed because it does not require reciprocal-math. |
| 258 | + |
| 259 | +// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 260 | +// RUN: -fno-trapping-math -fno-reciprocal-math -c %s 2>&1 \ |
| 261 | +// RUN: | FileCheck --check-prefix=CHECK-REASSOC-NO-UNSAFE-MATH %s |
| 262 | + |
| 263 | +// CHECK-REASSOC-NO-UNSAFE-MATH: "-cc1" |
| 264 | +// CHECK-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math" |
| 265 | +// CHECK-REASSOC-NO_UNSAFE-MATH: "-mreassociate" |
| 266 | +// CHECK-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math" |
| 267 | +// CHECK-REASSOC-NO-UNSAFE-MATH: "-o" |
| 268 | + |
| 269 | + |
| 270 | +// In these runs, reassociate is not allowed because both no-signed-zeros and no-trapping-math are required. |
| 271 | + |
| 272 | +// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 273 | +// RUN: -fno-trapping-math -fsigned-zeros -c %s 2>&1 \ |
| 274 | +// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s |
| 275 | + |
| 276 | +// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 277 | +// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ |
| 278 | +// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s |
| 279 | + |
| 280 | +// CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-cc1" |
| 281 | +// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math" |
| 282 | +// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-mreassociate" |
| 283 | +// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math" |
| 284 | +// CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-o" |
| 285 | + |
| 286 | + |
250 | 287 | // RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
|
251 | 288 | // RUN: | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
|
252 | 289 | // CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
|
0 commit comments