2012-01-02 22:19:45 +08:00
|
|
|
// Test that the GCC fast-math floating point flags get lowered to the correct
|
|
|
|
// permutation of Clang frontend flags. This is non-trivial for a few reasons.
|
|
|
|
// First, the GCC flags have many different and surprising effects. Second,
|
|
|
|
// LLVM only supports three switches which is more coarse grained than GCC's
|
|
|
|
// support.
|
|
|
|
//
|
2012-04-27 12:36:27 +08:00
|
|
|
// Both of them use gcc driver for as.
|
2012-12-11 15:06:09 +08:00
|
|
|
// REQUIRES: clang-driver
|
2012-04-27 12:36:27 +08:00
|
|
|
//
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -fno-honor-infinities -c %s 2>&1 \
|
2013-12-23 16:50:43 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
|
2013-12-23 06:38:57 +08:00
|
|
|
// infinites [sic] is a supported alternative spelling of infinities.
|
|
|
|
// RUN: %clang -### -fno-honor-infinites -c %s 2>&1 \
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
|
|
|
|
// CHECK-NO-INFS: "-cc1"
|
|
|
|
// CHECK-NO-INFS: "-menable-no-infs"
|
|
|
|
//
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -fno-fast-math -fno-honor-infinities -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-INFS %s
|
|
|
|
// CHECK-NO-FAST-MATH-NO-INFS: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-NO-INFS: "-menable-no-infs"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-honor-infinities -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS-NO-FAST-MATH %s
|
|
|
|
// CHECK-NO-INFS-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-NO-INFS-NO-FAST-MATH-NOT: "-menable-no-infs"
|
|
|
|
//
|
2015-01-24 00:40:50 +08:00
|
|
|
// RUN: %clang -### -fno-signed-zeros -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-SIGNED-ZEROS %s
|
|
|
|
// CHECK-NO-SIGNED-ZEROS: "-cc1"
|
|
|
|
// CHECK-NO-SIGNED-ZEROS: "-fno-signed-zeros"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-fast-math -fno-signed-zeros -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS %s
|
|
|
|
// CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS: "-fno-signed-zeros"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-signed-zeros -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH %s
|
|
|
|
// CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH-NOT: "-fno-signed-zeros"
|
|
|
|
//
|
2015-04-09 23:03:23 +08:00
|
|
|
// RUN: %clang -### -freciprocal-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-RECIPROCAL-MATH %s
|
|
|
|
// CHECK-RECIPROCAL-MATH: "-cc1"
|
|
|
|
// CHECK-RECIPROCAL-MATH: "-freciprocal-math"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-fast-math -freciprocal-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-RECIPROCAL-MATH %s
|
|
|
|
// CHECK-NO-FAST-MATH-RECIPROCAL-MATH: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-RECIPROCAL-MATH: "-freciprocal-math"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -freciprocal-math -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-RECIPROCAL-MATH-NO-FAST-MATH %s
|
|
|
|
// CHECK-RECIPROCAL-MATH-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-RECIPROCAL-MATH-NO-FAST-MATH-NOT: "-freciprocal-math"
|
|
|
|
//
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -fno-honor-nans -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
|
|
|
|
// CHECK-NO-NANS: "-cc1"
|
|
|
|
// CHECK-NO-NANS: "-menable-no-nans"
|
|
|
|
//
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -fno-fast-math -fno-honor-nans -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-NANS %s
|
|
|
|
// CHECK-NO-FAST-MATH-NO-NANS: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-NO-NANS: "-menable-no-nans"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-honor-nans -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NANS-NO-FAST-MATH %s
|
|
|
|
// CHECK-NO-NANS-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-NO-NANS-NO-FAST-MATH-NOT: "-menable-no-nans"
|
|
|
|
//
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -fmath-errno -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
|
|
|
|
// CHECK-MATH-ERRNO: "-cc1"
|
|
|
|
// CHECK-MATH-ERRNO: "-fmath-errno"
|
|
|
|
//
|
2012-04-26 10:10:51 +08:00
|
|
|
// RUN: %clang -### -fmath-errno -fno-math-errno -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
2013-05-19 04:47:36 +08:00
|
|
|
// CHECK-NO-MATH-ERRNO: "-cc1"
|
|
|
|
// CHECK-NO-MATH-ERRNO-NOT: "-fmath-errno"
|
|
|
|
//
|
|
|
|
// Target defaults for -fmath-errno (reusing the above checks).
|
|
|
|
// RUN: %clang -### -target i686-unknown-linux -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
|
2012-04-26 10:10:51 +08:00
|
|
|
// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
2012-05-02 22:55:48 +08:00
|
|
|
// RUN: %clang -### -target x86_64-unknown-freebsd -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target x86_64-unknown-netbsd -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
2017-07-24 06:30:13 +08:00
|
|
|
// RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
2013-05-19 04:47:36 +08:00
|
|
|
//
|
|
|
|
// Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
|
|
|
|
// preserves the target default. Also check various flag set operations between
|
|
|
|
// the two flags. (Resuses above checks.)
|
|
|
|
// RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -fmath-errno -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target i686-unknown-linux -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target i686-unknown-linux -fno-math-errno -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target i686-apple-darwin -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -target i686-apple-darwin -fno-math-errno -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
|
|
|
// RUN: %clang -### -fno-fast-math -fno-math-errno -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
|
2012-04-26 10:10:51 +08:00
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-math-errno -fassociative-math -freciprocal-math \
|
|
|
|
// RUN: -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
|
|
|
|
// CHECK-UNSAFE-MATH: "-cc1"
|
|
|
|
// CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// CHECK-UNSAFE-MATH: "-mreassociate"
|
2012-01-02 22:19:45 +08:00
|
|
|
//
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
|
|
|
|
// RUN: -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-UNSAFE-MATH %s
|
|
|
|
// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-menable-unsafe-fp-math"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-mreassociate"
|
|
|
|
|
|
|
|
// The 2nd -fno-fast-math overrides -fassociative-math.
|
|
|
|
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
|
|
|
|
// RUN: -fno-fast-math -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH-NO-FAST-MATH %s
|
|
|
|
// CHECK-UNSAFE-MATH-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-UNSAFE-MATH-NO-FAST-MATH-NOT: "-menable-unsafe-fp-math"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// CHECK-UNSAFE-MATH-NO-FAST-MATH-NOT: "-mreassociate"
|
2012-09-26 06:03:25 +08:00
|
|
|
//
|
2012-01-02 22:19:45 +08:00
|
|
|
// Check that various umbrella flags also enable these frontend options.
|
|
|
|
// RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
|
|
|
|
// RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
|
2012-04-26 10:10:51 +08:00
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -fno-math-errno -c %s 2>&1 \
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
|
|
|
|
//
|
|
|
|
// One umbrella flag is *really* weird and also changes the semantics of the
|
|
|
|
// program by adding a special preprocessor macro. Check that the frontend flag
|
2017-03-15 22:03:32 +08:00
|
|
|
// modeling this semantic change is provided. Also check that the flag is not
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// present if any of the optimizations are disabled.
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
|
2017-03-15 22:03:32 +08:00
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -ffinite-math-only \
|
|
|
|
// RUN: -fno-math-errno -ffp-contract=fast -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
|
|
|
|
// RUN: %clang -### -fno-honor-infinities -fno-honor-nans -fno-math-errno \
|
|
|
|
// RUN: -fassociative-math -freciprocal-math -fno-signed-zeros \
|
|
|
|
// RUN: -fno-trapping-math -ffp-contract=fast -c %s 2>&1 \
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
|
|
|
|
// CHECK-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-FAST-MATH: "-ffast-math"
|
2017-03-15 22:03:32 +08:00
|
|
|
// CHECK-FAST-MATH: "-ffinite-math-only"
|
2012-01-02 22:19:45 +08:00
|
|
|
//
|
2012-09-26 06:03:25 +08:00
|
|
|
// RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
2017-03-15 22:03:32 +08:00
|
|
|
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH --check-prefix=CHECK-ASSOC-MATH %s
|
2012-09-26 06:03:25 +08:00
|
|
|
// CHECK-NO-FAST-MATH: "-cc1"
|
|
|
|
// CHECK-NO-FAST-MATH-NOT: "-ffast-math"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// CHECK-ASSOC-MATH-NOT: "-mreassociate"
|
2012-09-26 06:03:25 +08:00
|
|
|
//
|
2012-01-02 22:19:45 +08:00
|
|
|
// Check various means of disabling these flags, including disabling them after
|
|
|
|
// they've been enabled via an umbrella flag.
|
|
|
|
// RUN: %clang -### -fno-honor-infinities -fhonor-infinities -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -fhonor-infinities -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffast-math -fhonor-infinities -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
|
|
|
|
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
|
|
|
|
// CHECK-NO-NO-INFS: "-cc1"
|
|
|
|
// CHECK-NO-NO-INFS-NOT: "-menable-no-infs"
|
2017-03-15 22:03:32 +08:00
|
|
|
// CHECK-NO-NO-INFS-NOT: "-ffinite-math-only"
|
2012-01-02 22:19:45 +08:00
|
|
|
// CHECK-NO-NO-INFS: "-o"
|
|
|
|
//
|
|
|
|
// RUN: %clang -### -fno-honor-nans -fhonor-nans -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -fhonor-nans -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
|
|
|
|
// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
|
|
|
|
// RUN: %clang -### -ffast-math -fhonor-nans -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
|
|
|
|
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
|
|
|
|
// CHECK-NO-NO-NANS: "-cc1"
|
|
|
|
// CHECK-NO-NO-NANS-NOT: "-menable-no-nans"
|
2017-03-15 22:03:32 +08:00
|
|
|
// CHECK-NO-NO-NANS-NOT: "-ffinite-math-only"
|
2012-01-02 22:19:45 +08:00
|
|
|
// CHECK-NO-NO-NANS: "-o"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
|
|
|
// A later inverted option overrides an earlier option.
|
|
|
|
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
|
|
|
|
// RUN: -fno-trapping-math -fno-associative-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -fno-associative-math -c %s \
|
|
|
|
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s \
|
|
|
|
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -fsigned-zeros -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -ftrapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -funsafe-math-optimizations -fno-unsafe-math-optimizations \
|
|
|
|
// RUN: -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
2012-01-02 22:19:45 +08:00
|
|
|
// RUN: %clang -### -ffast-math -fno-reciprocal-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -fsigned-zeros -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -ftrapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
|
|
|
// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
2012-01-02 22:19:45 +08:00
|
|
|
// CHECK-NO-UNSAFE-MATH: "-cc1"
|
|
|
|
// CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
// CHECK-NO_UNSAFE-MATH-NOT: "-mreassociate"
|
2012-01-02 22:19:45 +08:00
|
|
|
// CHECK-NO-UNSAFE-MATH: "-o"
|
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
2017-12-17 00:11:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Reassociate is allowed because it does not require reciprocal-math.
|
|
|
|
|
|
|
|
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
|
|
|
|
// RUN: -fno-trapping-math -fno-reciprocal-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-REASSOC-NO-UNSAFE-MATH %s
|
|
|
|
|
|
|
|
// CHECK-REASSOC-NO-UNSAFE-MATH: "-cc1"
|
|
|
|
// CHECK-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
|
|
|
// CHECK-REASSOC-NO_UNSAFE-MATH: "-mreassociate"
|
|
|
|
// CHECK-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
|
|
|
// CHECK-REASSOC-NO-UNSAFE-MATH: "-o"
|
|
|
|
|
|
|
|
|
|
|
|
// In these runs, reassociate is not allowed because both no-signed-zeros and no-trapping-math are required.
|
|
|
|
|
|
|
|
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
|
|
|
|
// RUN: -fno-trapping-math -fsigned-zeros -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s
|
|
|
|
|
|
|
|
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
|
|
|
|
// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s
|
|
|
|
|
|
|
|
// CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-cc1"
|
|
|
|
// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
|
|
|
// CHECK-NO-REASSOC-NO_UNSAFE-MATH-NOT: "-mreassociate"
|
|
|
|
// CHECK-NO-REASSOC-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
|
|
|
|
// CHECK-NO-REASSOC-NO-UNSAFE-MATH: "-o"
|
|
|
|
|
|
|
|
|
2016-08-31 20:31:03 +08:00
|
|
|
// RUN: %clang -### -ftrapping-math -fno-trapping-math -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-TRAPPING-MATH %s
|
|
|
|
// CHECK-NO-TRAPPING-MATH: "-fno-trapping-math"
|
2018-04-27 22:22:48 +08:00
|
|
|
|
|
|
|
// This isn't fast-math, but the option is handled in the same place as other FP params.
|
2018-05-01 02:19:03 +08:00
|
|
|
// Last option wins, and strict behavior is assumed by default.
|
2018-04-27 22:22:48 +08:00
|
|
|
|
2018-05-01 02:19:03 +08:00
|
|
|
// RUN: %clang -### -fno-strict-float-cast-overflow -c %s 2>&1 \
|
2018-04-27 22:22:48 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FPOV-WORKAROUND %s
|
|
|
|
// CHECK-FPOV-WORKAROUND: "-cc1"
|
2018-05-01 02:19:03 +08:00
|
|
|
// CHECK-FPOV-WORKAROUND: "-fno-strict-float-cast-overflow"
|
2018-04-27 22:22:48 +08:00
|
|
|
|
|
|
|
// RUN: %clang -### -c %s 2>&1 \
|
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-FPOV-WORKAROUND-DEFAULT %s
|
|
|
|
// CHECK-FPOV-WORKAROUND-DEFAULT: "-cc1"
|
2018-05-01 02:19:03 +08:00
|
|
|
// CHECK-FPOV-WORKAROUND-DEFAULT-NOT: "strict-float-cast-overflow"
|
2018-04-27 22:22:48 +08:00
|
|
|
|
2018-05-01 02:19:03 +08:00
|
|
|
// RUN: %clang -### -fstrict-float-cast-overflow -c %s 2>&1 \
|
2018-04-27 22:22:48 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FPOV-WORKAROUND %s
|
|
|
|
// CHECK-NO-FPOV-WORKAROUND: "-cc1"
|
2018-05-01 02:19:03 +08:00
|
|
|
// CHECK-NO-FPOV-WORKAROUND-NOT: "strict-float-cast-overflow"
|
2018-04-27 22:22:48 +08:00
|
|
|
|
2018-05-01 02:19:03 +08:00
|
|
|
// RUN: %clang -### -fno-strict-float-cast-overflow -fstrict-float-cast-overflow -c %s 2>&1 \
|
2018-04-27 22:22:48 +08:00
|
|
|
// RUN: | FileCheck --check-prefix=CHECK-NO-FPOV-WORKAROUND-OVERRIDE %s
|
|
|
|
// CHECK-NO-FPOV-WORKAROUND-OVERRIDE: "-cc1"
|
2018-05-01 02:19:03 +08:00
|
|
|
// CHECK-NO-FPOV-WORKAROUND-OVERRIDE-NOT: "strict-float-cast-overflow"
|
2018-04-27 22:22:48 +08:00
|
|
|
|