| 1 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 2 |
// RUN: -triple x86_64-linux-gnu \ |
| 3 |
// RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-PRGM |
| 4 |
|
| 5 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 6 |
// RUN: -triple x86_64-linux-gnu -freciprocal-math \ |
| 7 |
// RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-RECPR,CHECK-PRGM |
| 8 |
|
| 9 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 10 |
// RUN: -triple x86_64-linux-gnu -mreassociate \ |
| 11 |
// RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-PRGM |
| 12 |
|
| 13 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 14 |
// RUN: -triple x86_64-linux-gnu -fapprox-func \ |
| 15 |
// RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-FUNC,CHECK-PRGM |
| 16 |
|
| 17 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 18 |
// RUN: -triple x86_64-linux-gnu -freciprocal-math -mreassociate -verify \ |
| 19 |
// RUN: %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-RECPR,CHECK-PRGM |
| 20 |
|
| 21 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 22 |
// RUN: -triple x86_64-linux-gnu -freciprocal-math -mreassociate -fapprox-func \ |
| 23 |
// RUN: -verify %s 2>&1 \ |
| 24 |
// RUN: | FileCheck %s --check-prefixes=CHECK-FUNC,CHECK-ASSOC,CHECK-RECPR,CHECK-PRGM |
| 25 |
|
| 26 |
// RUN: not %clang_cc1 -fexperimental-strict-floating-point \ |
| 27 |
// RUN: -triple x86_64-linux-gnu -ffp-eval-method=source \ |
| 28 |
// RUN: -verify %s 2>&1 | FileCheck %s --check-prefixes=CHECK-FFP-OPT,CHECK-PRGM |
| 29 |
|
| 30 |
// expected-no-diagnostics |
| 31 |
|
| 32 |
float f1(float a, float b, float c) { |
| 33 |
a = b + c; |
| 34 |
return a * b + c; |
| 35 |
} |
| 36 |
|
| 37 |
float f2(float a, float b, float c) { |
| 38 |
// CHECK-FFP-OPT: option 'ffp-eval-method' cannot be used with '#pragma clang fp reassociate' |
| 39 |
#pragma clang fp reassociate(on) |
| 40 |
return (a + b) + c; |
| 41 |
} |
| 42 |
|
| 43 |
float f3(float a, float b, float c) { |
| 44 |
#pragma clang fp reassociate(off) |
| 45 |
return (a - b) - c; |
| 46 |
} |
| 47 |
|
| 48 |
float f4(float a, float b, float c) { |
| 49 |
#pragma clang fp eval_method(double) |
| 50 |
// CHECK-FUNC: '#pragma clang fp eval_method' cannot be used with option 'fapprox-func' |
| 51 |
// CHECK-ASSOC: '#pragma clang fp eval_method' cannot be used with option 'mreassociate' |
| 52 |
// CHECK-RECPR: '#pragma clang fp eval_method' cannot be used with option 'freciprocal' |
| 53 |
// CHECK-PRGM: '#pragma clang fp eval_method' cannot be used with '#pragma clang fp reassociate' |
| 54 |
#pragma clang fp reassociate(on) |
| 55 |
return (a * c) - (b * c); |
| 56 |
} |
| 57 |
|
| 58 |
float f4_reciprocal(float a, float b, float c) { |
| 59 |
#pragma clang fp eval_method(double) |
| 60 |
// CHECK-FUNC: '#pragma clang fp eval_method' cannot be used with option 'fapprox-func' |
| 61 |
// CHECK-ASSOC: '#pragma clang fp eval_method' cannot be used with option 'mreassociate' |
| 62 |
// CHECK-RECPR: '#pragma clang fp eval_method' cannot be used with option 'freciprocal' |
| 63 |
// CHECK-PRGM: '#pragma clang fp eval_method' cannot be used with '#pragma clang fp reciprocal' |
| 64 |
#pragma clang fp reciprocal(on) |
| 65 |
return (a * c) / (b * c); |
| 66 |
} |
| 67 |
|
| 68 |
float f4_reciprocal_reassociate(float a, float b, float c) { |
| 69 |
#pragma clang fp eval_method(double) |
| 70 |
// CHECK-FUNC: '#pragma clang fp eval_method' cannot be used with option 'fapprox-func' |
| 71 |
// CHECK-ASSOC: '#pragma clang fp eval_method' cannot be used with option 'mreassociate' |
| 72 |
// CHECK-RECPR: '#pragma clang fp eval_method' cannot be used with option 'freciprocal' |
| 73 |
// CHECK-PRGM: '#pragma clang fp eval_method' cannot be used with '#pragma clang fp reassociate' |
| 74 |
// CHECK-PRGM: '#pragma clang fp eval_method' cannot be used with '#pragma clang fp reciprocal' |
| 75 |
#pragma clang fp reciprocal(on) reassociate(on) |
| 76 |
return (a * c) / (b * c); |
| 77 |
} |
| 78 |
|
| 79 |
float f2_reciprocal(float a, float b, float c) { |
| 80 |
// CHECK-FFP-OPT: option 'ffp-eval-method' cannot be used with '#pragma clang fp reciprocal' |
| 81 |
#pragma clang fp reciprocal(on) |
| 82 |
return (a + b) / c; |
| 83 |
} |
| 84 |
|
| 85 |
float f3_reciprocal(float a, float b, float c) { |
| 86 |
#pragma clang fp reciprocal(off) |
| 87 |
return (a - b) / c; |
| 88 |
} |