
compiler is allowed to use optimizations that allow reassociation and transformations that don’t guaranty accuracy. For example (x+y)+z is transformed into x+(y+z) . Although mathematically equivalent, these two expressions may not lead to the same final result due to errors of summation. Or x/x is transformed into 1.0 but x could be 0.0, INF or NaN. And so this transformation also may not lead to the same final result. Setting the eval method 'ffp-eval-method' or via '#pragma clang fp eval_method' in this mode, doesn’t have any effect. This patch adds code to warn the user of this. Differential Revision: https://reviews.llvm.org/D122155
30 lines
1.6 KiB
C
30 lines
1.6 KiB
C
// RUN: not %clang -Xclang -fexperimental-strict-floating-point \
|
|
// RUN: -Xclang -triple -Xclang x86_64-linux-gnu -fapprox-func \
|
|
// RUN: -Xclang -verify -ffp-eval-method=source %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefixes=CHECK-FUNC
|
|
|
|
// RUN: not %clang -Xclang -fexperimental-strict-floating-point \
|
|
// RUN: -Xclang -triple -Xclang x86_64-linux-gnu -Xclang -mreassociate \
|
|
// RUN: -ffp-eval-method=source -Xclang -verify %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefixes=CHECK-ASSOC
|
|
|
|
// RUN: not %clang -Xclang -fexperimental-strict-floating-point \
|
|
// RUN: -Xclang -triple -Xclang x86_64-linux-gnu -Xclang -freciprocal-math \
|
|
// RUN: -ffp-eval-method=source -Xclang -verify %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefixes=CHECK-RECPR
|
|
|
|
// RUN: not %clang -Xclang -fexperimental-strict-floating-point \
|
|
// RUN: -Xclang -triple -Xclang x86_64-linux-gnu -Xclang -freciprocal-math \
|
|
// RUN: -Xclang -mreassociate -ffp-eval-method=source -Xclang -verify %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-RECPR
|
|
|
|
// RUN: not %clang -Xclang -fexperimental-strict-floating-point \
|
|
// RUN: -Xclang -triple -Xclang x86_64-linux-gnu -Xclang -freciprocal-math \
|
|
// RUN: -Xclang -mreassociate -fapprox-func -ffp-eval-method=source \
|
|
// RUN: -Xclang -verify %s 2>&1 \
|
|
// RUN: | FileCheck %s --check-prefixes=CHECK-ASSOC,CHECK-RECPR,CHECK-FUNC
|
|
|
|
// CHECK-FUNC: (frontend): option 'ffp-eval-method' cannot be used with option 'fapprox-func'
|
|
// CHECK-ASSOC: (frontend): option 'ffp-eval-method' cannot be used with option 'mreassociate'
|
|
// CHECK-RECPR: (frontend): option 'ffp-eval-method' cannot be used with option 'freciprocal'
|