| 1 |
! Test for correct forwarding of fast-math flags from the compiler driver to the |
| 2 |
! frontend driver |
| 3 |
|
| 4 |
! -Ofast => -ffast-math -O3 -fstack-arrays |
| 5 |
! RUN: %flang -Ofast -fsyntax-only -### %s -o %t 2>&1 \ |
| 6 |
! RUN: | FileCheck --check-prefix=CHECK-OFAST %s |
| 7 |
! CHECK-OFAST: -fc1 |
| 8 |
! CHECK-OFAST-SAME: -ffast-math |
| 9 |
! CHECK-OFAST-SAME: -fstack-arrays |
| 10 |
! CHECK-OFAST-SAME: -O3 |
| 11 |
|
| 12 |
! RUN: %flang -fstack-arrays -fsyntax-only -### %s -o %t 2>&1 \ |
| 13 |
! RUN: | FileCheck --check-prefix=CHECK-STACK-ARRAYS %s |
| 14 |
! CHECK-STACK-ARRAYS: -fc1 |
| 15 |
! CHECK-STACK-ARRAYS-SAME: -fstack-arrays |
| 16 |
|
| 17 |
! -Ofast -fno-fast-math => -O3 -fstack-arrays |
| 18 |
! RUN: %flang -Ofast -fno-fast-math -fsyntax-only -### %s -o %t 2>&1 \ |
| 19 |
! RUN: | FileCheck --check-prefix=CHECK-OFAST-NO-FAST %s |
| 20 |
! CHECK-OFAST-NO-FAST: -fc1 |
| 21 |
! CHECK-OFAST-NO-FAST-NOT: -ffast-math |
| 22 |
! CHECK-OFAST-NO-FAST-SAME: -fstack-arrays |
| 23 |
! CHECK-OFAST-NO-FAST-SAME: -O3 |
| 24 |
|
| 25 |
! -Ofast -fno-stack-arrays -> -O3 -ffast-math |
| 26 |
! RUN: %flang -Ofast -fno-stack-arrays -fsyntax-only -### %s -o %t 2>&1 \ |
| 27 |
! RUN: | FileCheck --check-prefix=CHECK-OFAST-NO-SA %s |
| 28 |
! CHECK-OFAST-NO-SA: -fc1 |
| 29 |
! CHECK-OFAST-NO-SA-SAME: -ffast-math |
| 30 |
! CHECK-OFAST-NO-SA-NOT: -fstack-arrays |
| 31 |
! CHECK-OFAST-NO-SA-SAME: -O3 |
| 32 |
|
| 33 |
! -ffast-math => -ffast-math |
| 34 |
! RUN: %flang -ffast-math -fsyntax-only -### %s -o %t 2>&1 \ |
| 35 |
! RUN: | FileCheck --check-prefix=CHECK-FFAST %s |
| 36 |
! CHECK-FFAST: -fc1 |
| 37 |
! CHECK-FFAST-SAME: -ffast-math |
| 38 |
|
| 39 |
! (component flags) => -ffast-math |
| 40 |
! RUN: %flang -fsyntax-only -### %s -o %t \ |
| 41 |
! RUN: -fno-honor-infinities \ |
| 42 |
! RUN: -fno-honor-nans \ |
| 43 |
! RUN: -fassociative-math \ |
| 44 |
! RUN: -freciprocal-math \ |
| 45 |
! RUN: -fapprox-func \ |
| 46 |
! RUN: -fno-signed-zeros \ |
| 47 |
! RUN: -ffp-contract=fast \ |
| 48 |
! RUN: 2>&1 | FileCheck --check-prefix=CHECK-FROM-COMPS %s |
| 49 |
! CHECK-FROM-COMPS: -fc1 |
| 50 |
! CHECK-FROM-COMPS-SAME: -ffast-math |
| 51 |
|
| 52 |
! -ffast-math (followed by an alteration) => (component flags) |
| 53 |
! RUN: %flang -ffast-math -fhonor-infinities -fsyntax-only -### %s -o %t 2>&1 \ |
| 54 |
! RUN: | FileCheck --check-prefix=CHECK-TO-COMPS %s |
| 55 |
! CHECK-TO-COMPS: -fc1 |
| 56 |
! CHECK-TO-COMPS-SAME: -ffp-contract=fast |
| 57 |
! CHECK-TO-COMPS-SAME: -menable-no-nans |
| 58 |
! CHECK-TO-COMPS-SAME: -fapprox-func |
| 59 |
! CHECK-TO-COMPS-SAME: -fno-signed-zeros |
| 60 |
! CHECK-TO-COMPS-SAME: -mreassociate |
| 61 |
! CHECK-TO-COMPS-SAME: -freciprocal-math |
| 62 |
|
| 63 |
! Check that -fno-fast-math doesn't clobber -ffp-contract |
| 64 |
! RUN: %flang -ffp-contract=off -fno-fast-math -fsyntax-only -### %s -o %t 2>&1 \ |
| 65 |
! RUN: | FileCheck --check-prefix=CHECK-CONTRACT %s |
| 66 |
! CHECK-CONTRACT: -fc1 |
| 67 |
! CHECK-CONTRACT-SAME: -ffp-contract=off |
| 68 |
|
| 69 |
! Check that -ffast-math causes us to link to crtfastmath.o |
| 70 |
! UNSUPPORTED: system-windows |
| 71 |
! UNSUPPORTED: target=powerpc{{.*}} |
| 72 |
! RUN: %flang -ffast-math -### %s -o %t 2>&1 \ |
| 73 |
! RUN: --target=x86_64-unknown-linux -no-pie \ |
| 74 |
! RUN: --sysroot=%S/../../../clang/test/Driver/Inputs/basic_linux_tree \ |
| 75 |
! RUN: | FileCheck --check-prefix=CHECK-CRT %s |
| 76 |
! CHECK-CRT: {{crtbegin.?\.o}} |
| 77 |
! CHECK-CRT-SAME: crtfastmath.o |
| 78 |
! CHECK-CRT-SAME: {{crtend.?\.o}} |