| 1 |
// Test that the GCC fast-math floating point flags get lowered to the correct |
| 2 |
// permutation of Clang frontend flags. This is non-trivial for a few reasons. |
| 3 |
// First, the GCC flags have many different and surprising effects. Second, |
| 4 |
// LLVM only supports three switches which is more coarse grained than GCC's |
| 5 |
// support. |
| 6 |
// |
| 7 |
// Both of them use gcc driver for as. |
| 8 |
// |
| 9 |
// RUN: %clang -### -fno-honor-infinities -c %s 2>&1 \ |
| 10 |
// RUN: | FileCheck --check-prefixes=CHECK,NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 11 |
// infinites [sic] is a supported alternative spelling of infinities. |
| 12 |
// RUN: %clang -### -fno-honor-infinites -c %s 2>&1 \ |
| 13 |
// RUN: | FileCheck --check-prefixes=CHECK,NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 14 |
// |
| 15 |
// RUN: %clang -### -fno-fast-math -fno-honor-infinities -c %s 2>&1 \ |
| 16 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 17 |
// |
| 18 |
// RUN: %clang -### -fno-honor-infinities -fno-fast-math -c %s 2>&1 \ |
| 19 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 20 |
// |
| 21 |
// RUN: %clang -### -fno-signed-zeros -c %s 2>&1 \ |
| 22 |
// RUN: | FileCheck --check-prefixes=CHECK,NSZ,NOROUNDING %s |
| 23 |
// |
| 24 |
// RUN: %clang -### -fno-fast-math -fno-signed-zeros -c %s 2>&1 \ |
| 25 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NSZ %s |
| 26 |
// |
| 27 |
// RUN: %clang -### -fno-signed-zeros -fno-fast-math -c %s 2>&1 \ |
| 28 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NSZ,NOROUNDING %s |
| 29 |
// |
| 30 |
// RUN: %clang -### -freciprocal-math -c %s 2>&1 \ |
| 31 |
// RUN: | FileCheck --check-prefixes=CHECK,ARCP,NOROUNDING %s |
| 32 |
// |
| 33 |
// RUN: %clang -### -fno-fast-math -freciprocal-math -c %s 2>&1 \ |
| 34 |
// RUN: | FileCheck --check-prefixes=CHECK,ARCP,NOROUNDING %s |
| 35 |
// |
| 36 |
// RUN: %clang -### -freciprocal-math -fno-fast-math -c %s 2>&1 \ |
| 37 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ARCP,NOROUNDING %s |
| 38 |
// |
| 39 |
// RUN: %clang -### -fno-honor-nans -c %s 2>&1 \ |
| 40 |
// RUN: | FileCheck --check-prefixes=CHECK,NNAN,NO-NINF,NO-FINITE-ONLY,NOROUNDING %s |
| 41 |
// |
| 42 |
// RUN: %clang -### -fno-fast-math -fno-honor-nans -c %s 2>&1 \ |
| 43 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NNAN,NO-NINF,NO-FINITE-ONLY,NOROUNDING %s |
| 44 |
// |
| 45 |
// RUN: %clang -### -fno-honor-nans -fno-fast-math -c %s 2>&1 \ |
| 46 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NNAN,NO-NINF,NO-FINITE-ONLY,NOROUNDING %s |
| 47 |
// |
| 48 |
// RUN: %clang -### -ffast-math -fno-approx-func -c %s 2>&1 \ |
| 49 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NINF,NNAN,FINITE-ONLY,NSZ,ARCP,NO-AFN,NO-ERRNO,NOROUNDING %s |
| 50 |
// |
| 51 |
// RUN: %clang -### -fno-approx-func -ffast-math -c %s 2>&1 \ |
| 52 |
// RUN: | FileCheck --check-prefixes=CHECK,FAST,NINF,NNAN,FINITE-ONLY,NSZ,ARCP,AFN,NO-ERRNO,NOROUNDING %s |
| 53 |
// |
| 54 |
// RUN: %clang -### -fapprox-func -c %s 2>&1 \ |
| 55 |
// RUN: | FileCheck --check-prefixes=CHECK,AFN %s |
| 56 |
// |
| 57 |
// RUN: %clang -### -fno-fast-math -fapprox-func -c %s 2>&1 \ |
| 58 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,AFN,NOROUNDING %s |
| 59 |
// |
| 60 |
// RUN: %clang -### -fapprox-func -fno-fast-math -c %s 2>&1 \ |
| 61 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-AFN %s |
| 62 |
// |
| 63 |
// RUN: %clang -### -fmath-errno -c %s 2>&1 \ |
| 64 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,ERRNO %s |
| 65 |
// |
| 66 |
// RUN: %clang -### -fmath-errno -fno-math-errno -c %s 2>&1 \ |
| 67 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 68 |
// |
| 69 |
// Target defaults for -fmath-errno (reusing the above checks). |
| 70 |
// RUN: %clang -### --target=i686-unknown-linux -c %s 2>&1 \ |
| 71 |
// RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s |
| 72 |
// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \ |
| 73 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 74 |
// RUN: %clang -### --target=x86_64-unknown-freebsd -c %s 2>&1 \ |
| 75 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 76 |
// RUN: %clang -### --target=x86_64-unknown-netbsd -c %s 2>&1 \ |
| 77 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 78 |
// RUN: %clang -### --target=x86_64-unknown-openbsd -c %s 2>&1 \ |
| 79 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 80 |
// RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \ |
| 81 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 82 |
// RUN: %clang -### --target=x86_64-unknown-dragonfly -c %s 2>&1 \ |
| 83 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 84 |
// RUN: %clang -### --target=x86_64-fuchsia -c %s 2>&1 \ |
| 85 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 86 |
// RUN: %clang -### --target=x86_64-linux-android -c %s 2>&1 \ |
| 87 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 88 |
// RUN: %clang -### --target=x86_64-linux-musl -c %s 2>&1 \ |
| 89 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 90 |
// RUN: %clang -### --target=amdgcn-amd-amdhsa -nogpuinc -nogpulib -c %s 2>&1 \ |
| 91 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 92 |
// RUN: %clang -### --target=amdgcn-amd-amdpal -c %s 2>&1 \ |
| 93 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 94 |
// RUN: %clang -### --target=amdgcn-mesa-mesa3d -c %s 2>&1 \ |
| 95 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 96 |
// |
| 97 |
// Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely |
| 98 |
// preserves the target default. Also check various flag set operations between |
| 99 |
// the two flags. (Resuses above checks.) |
| 100 |
// RUN: %clang -### -ffast-math -c %s 2>&1 \ |
| 101 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 102 |
// RUN: %clang -### -fmath-errno -ffast-math -c %s 2>&1 \ |
| 103 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 104 |
// RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \ |
| 105 |
// RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s |
| 106 |
// RUN: %clang -### --target=i686-unknown-linux -fno-fast-math -c %s 2>&1 \ |
| 107 |
// RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s |
| 108 |
// RUN: %clang -### --target=i686-unknown-linux -fno-math-errno -fno-fast-math -c %s 2>&1 \ |
| 109 |
// RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s |
| 110 |
// RUN: %clang -### -target i686-apple-darwin -fno-fast-math -c %s 2>&1 \ |
| 111 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 112 |
// RUN: %clang -### -target i686-apple-darwin -fno-math-errno -fno-fast-math -c %s 2>&1 \ |
| 113 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 114 |
// RUN: %clang -### -fno-fast-math -fno-math-errno -c %s 2>&1 \ |
| 115 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s |
| 116 |
// |
| 117 |
// RUN: %clang -### -fno-math-errno -fassociative-math -freciprocal-math \ |
| 118 |
// RUN: -fno-signed-zeros -fno-trapping-math -fapprox-func -c %s 2>&1 \ |
| 119 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO,UNSAFE,ARCP,NSZ,NO-TRAPPING,REASSOC %s |
| 120 |
// |
| 121 |
// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \ |
| 122 |
// RUN: -fno-signed-zeros -fno-trapping-math -fapprox-func -c %s 2>&1 \ |
| 123 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO,UNSAFE,ARCP,NSZ,NO-TRAPPING,REASSOC %s |
| 124 |
|
| 125 |
// The 2nd -fno-fast-math overrides -fassociative-math. |
| 126 |
|
| 127 |
// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \ |
| 128 |
// RUN: -fno-fast-math -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \ |
| 129 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,NO-REASSOC,NO-ARCP,NSZ,NO-TRAPPING %s |
| 130 |
// |
| 131 |
// Check that various umbrella flags also enable these frontend options. |
| 132 |
// RUN: %clang -### -ffast-math -c %s 2>&1 \ |
| 133 |
// RUN: | FileCheck --check-prefixes=CHECK,FAST,NINF,NNAN,FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 134 |
// RUN: %clang -### -ffinite-math-only -c %s 2>&1 \ |
| 135 |
// RUN: | FileCheck --check-prefixes=CHECK,NINF,NNAN,FINITE-ONLY %s |
| 136 |
// RUN: %clang -### -funsafe-math-optimizations -fno-math-errno -c %s 2>&1 \ |
| 137 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NNAN,NO-NINF,NO-FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 138 |
// |
| 139 |
// One umbrella flag is *really* weird and also changes the semantics of the |
| 140 |
// program by adding a special preprocessor macro. Check that the frontend flag |
| 141 |
// modeling this semantic change is provided. Also check that the flag is not |
| 142 |
// present if any of the optimizations are disabled. |
| 143 |
// RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \ |
| 144 |
// RUN: | FileCheck --check-prefixes=CHECK,FAST,NINF,NNAN,FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 145 |
// RUN: %clang -### -funsafe-math-optimizations -ffinite-math-only \ |
| 146 |
// RUN: -fno-math-errno -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \ |
| 147 |
// RUN: | FileCheck --check-prefixes=CHECK,FAST,NINF,NNAN,FINITE-ONLY,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 148 |
// RUN: %clang -### -fno-honor-infinities -fno-honor-nans -fno-math-errno \ |
| 149 |
// RUN: -fassociative-math -freciprocal-math -fno-signed-zeros -fapprox-func \ |
| 150 |
// RUN: -fno-trapping-math -ffp-contract=fast -fno-rounding-math -c %s 2>&1 \ |
| 151 |
// RUN: | FileCheck --check-prefixes=CHECK,FAST,NINF,NNAN,FINITE-ONLY,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 152 |
// |
| 153 |
// RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \ |
| 154 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NINF,NO-NNAN,NO-FINITE-ONLY,NO-REASSOC,NO-NSZ,NO-ARCP,NO-AFN,NOROUNDING %s |
| 155 |
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \ |
| 156 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NINF,NO-NNAN,NO-FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NOROUNDING %s |
| 157 |
|
| 158 |
// FIXME: This case leaves nnan and ninf. That seems wrong! |
| 159 |
// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 160 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NINF,NNAN,FINITE-ONLY,NO-REASSOC,NO-NSZ,NO-ARCP,NO-AFN,NOROUNDING,NO-TRAPPING %s |
| 161 |
// RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \ |
| 162 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NINF,NNAN,FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,ERRNO,NOROUNDING %s |
| 163 |
// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \ |
| 164 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NINF,NNAN,FINITE-ONLY,NO-REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 165 |
// |
| 166 |
// Check various means of disabling these flags, including disabling them after |
| 167 |
// they've been enabled via an umbrella flag. |
| 168 |
// RUN: %clang -### -fno-honor-infinities -fhonor-infinities -c %s 2>&1 \ |
| 169 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 170 |
// RUN: %clang -### -ffinite-math-only -fhonor-infinities -c %s 2>&1 \ |
| 171 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NNAN,NO-FINITE-ONLY %s |
| 172 |
// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \ |
| 173 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 174 |
// RUN: %clang -### -ffast-math -fhonor-infinities -c %s 2>&1 \ |
| 175 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NINF,NNAN,NO-FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 176 |
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \ |
| 177 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-NINF,NO-NNAN,NO-FINITE-ONLY,REASSOC,NSZ,ARCP,AFN,CONTRACT-FAST,NO-ERRNO,NOROUNDING %s |
| 178 |
// |
| 179 |
// RUN: %clang -### -fno-honor-nans -fhonor-nans -c %s 2>&1 \ |
| 180 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 181 |
// RUN: %clang -### -ffinite-math-only -fhonor-nans -c %s 2>&1 \ |
| 182 |
// RUN: | FileCheck --check-prefixes=CHECK,NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 183 |
// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \ |
| 184 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 185 |
// RUN: %clang -### -ffast-math -fhonor-nans -c %s 2>&1 \ |
| 186 |
// RUN: | FileCheck --check-prefixes=CHECK,NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 187 |
// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \ |
| 188 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-NINF,NO-NNAN,NO-FINITE-ONLY %s |
| 189 |
|
| 190 |
// A later inverted option overrides an earlier option. |
| 191 |
|
| 192 |
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 193 |
// RUN: -fno-trapping-math -fno-associative-math -c %s 2>&1 \ |
| 194 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-REASSOC,ARCP,NSZ,NO-TRAPPING %s |
| 195 |
|
| 196 |
// RUN: %clang -### -funsafe-math-optimizations -fno-associative-math -c %s 2>&1 \ |
| 197 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,NO-REASSOC,ARCP,NSZ,AFN %s |
| 198 |
|
| 199 |
// RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s 2>&1 \ |
| 200 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,REASSOC,NO-ARCP,NSZ,AFN %s |
| 201 |
|
| 202 |
// reassoc requires nsz |
| 203 |
// RUN: %clang -### -funsafe-math-optimizations -fsigned-zeros -c %s 2>&1 \ |
| 204 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,NO-REASSOC,ARCP,NO-NSZ,AFN %s |
| 205 |
|
| 206 |
// FIXME: Shouldn't trapping math disable all unsafe math? |
| 207 |
// RUN: %clang -### -funsafe-math-optimizations -ftrapping-math -c %s 2>&1 \ |
| 208 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,ARCP,NSZ,AFN,TRAPPING %s |
| 209 |
|
| 210 |
// RUN: %clang -### -funsafe-math-optimizations -fno-unsafe-math-optimizations \ |
| 211 |
// RUN: -c %s 2>&1 \ |
| 212 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,NO-REASSOC,NO-ARCP,NO-NSZ,NO-AFN,NO-TRAPPING %s |
| 213 |
// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \ |
| 214 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-UNSAFE,NO-REASSOC,ARCP,NSZ,AFN %s |
| 215 |
|
| 216 |
// RUN: %clang -### -ffast-math -fno-reciprocal-math -c %s 2>&1 \ |
| 217 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-UNSAFE,NNAN,NINF,FINITE-ONLY,REASSOC,NO-ARCP,CONTRACT-FAST,NSZ,AFN %s |
| 218 |
|
| 219 |
// reassoc requires nsz |
| 220 |
// RUN: %clang -### -ffast-math -fsigned-zeros -c %s 2>&1 \ |
| 221 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-UNSAFE,NNAN,NINF,FINITE-ONLY,NO-REASSOC,ARCP,CONTRACT-FAST,NO-NSZ,AFN %s |
| 222 |
|
| 223 |
// FIXME: Shouldn't trapping math disable unsafe math? |
| 224 |
// RUN: %clang -### -ffast-math -ftrapping-math -c %s 2>&1 \ |
| 225 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-UNSAFE,ARCP,NSZ,AFN,TRAPPING %s |
| 226 |
|
| 227 |
// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 228 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-FAST,NO-UNSAFE,NO-ARCP,NO-NSZ,NO-AFN,NO-TRAPPING %s |
| 229 |
|
| 230 |
// Reassociate is allowed because it does not require reciprocal-math. |
| 231 |
|
| 232 |
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 233 |
// RUN: -fno-trapping-math -fno-reciprocal-math -c %s 2>&1 \ |
| 234 |
// RUN: | FileCheck --check-prefixes=CHECK,REASSOC,NO-ARCP,NSZ,NO-TRAPPING %s |
| 235 |
|
| 236 |
|
| 237 |
// In these runs, reassociate is not allowed because both no-signed-zeros and no-trapping-math are required. |
| 238 |
|
| 239 |
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 240 |
// RUN: -fno-trapping-math -fsigned-zeros -c %s 2>&1 \ |
| 241 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-REASSOC,ARCP,NO-NSZ,NO-TRAPPING %s |
| 242 |
|
| 243 |
// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ |
| 244 |
// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ |
| 245 |
// RUN: | FileCheck --check-prefixes=CHECK,NO-REASSOC,ARCP,NSZ,TRAPPING %s |
| 246 |
|
| 247 |
// The checks below allow stringing together prefixes to select the expected |
| 248 |
// set of cc1 options for any combination of floating-point options. |
| 249 |
// This is based on the assumption that the order of the flags when rendered |
| 250 |
// is stable, so the negative checks only need to appear where the option would |
| 251 |
// appear if used. |
| 252 |
|
| 253 |
// start marker |
| 254 |
// CHECK: "-cc1" |
| 255 |
|
| 256 |
// NO-NINF-NOT: "-menable-no-infs" |
| 257 |
// NINF-SAME: "-menable-no-infs" |
| 258 |
|
| 259 |
// NO-NNAN-NOT: "-menable-no-nans" |
| 260 |
// NNAN-SAME: "-menable-no-nans" |
| 261 |
|
| 262 |
// NO-AFN-NOT: "-fapprox-func" |
| 263 |
// AFN-SAME: "-fapprox-func" |
| 264 |
|
| 265 |
// NO-ERRNO-NOT: "-fmath-errno" |
| 266 |
// ERRNO-SAME: "-fmath-errno" |
| 267 |
|
| 268 |
// NO-UNSAFE-NOT: "-funsafe-math-optimizations" |
| 269 |
// UNSAFE-SAME: "-funsafe-math-optimizations" |
| 270 |
|
| 271 |
// NO-NSZ-NOT: "-fno-signed-zeros" |
| 272 |
// NSZ-SAME: "-fno-signed-zeros" |
| 273 |
|
| 274 |
// NO-REASSOC-NOT: "-mreassociate" |
| 275 |
// REASSOC-SAME: "-mreassociate" |
| 276 |
|
| 277 |
// NO-ARCP-NOT: "-freciprocal-math" |
| 278 |
// ARCP-SAME: "-freciprocal-math" |
| 279 |
|
| 280 |
// NO-DENORM-NOT: "-fdenormal-fp-math" |
| 281 |
// DENORM-IEEE-SAME: "-fdenormal-fp-math=ieee,ieee" |
| 282 |
// DENORM-PS-SAME: "-fdenormal-fp-math=preserve-sign,preserve-sign" |
| 283 |
// DENORM-PZ-SAME: "-fdenormal-fp-math=positive-zero,positive-zero" |
| 284 |
|
| 285 |
// NO-CONTRACT-NOT: "-ffp-contract" |
| 286 |
// CONTRACT-OFF-SAME: "-ffp-contract=off" |
| 287 |
// CONTRACT-ON-SAME: "-ffp-contract=on" |
| 288 |
// CONTRACT-FAST-SAME: "-ffp-contract=fast" |
| 289 |
|
| 290 |
// This one is odd because -frounding-math is the default |
| 291 |
// NO-NOROUNDING-NOT: "-fno-rounding-math" |
| 292 |
// NOROUNDING-SAME: "-fno-rounding-math" |
| 293 |
|
| 294 |
// NO-TRAPPING-NOT: "-ffp-exception-behavior=strict" |
| 295 |
// NO-TRAPPING-NOT: "-ffp-exception-behavior=maytrap" |
| 296 |
// TRAPPING-SAME: "-ffp-exception-behavior=strict" |
| 297 |
|
| 298 |
// NO-FAST-NOT: "-ffast-math" |
| 299 |
// FAST-SAME: "-ffast-math" |
| 300 |
|
| 301 |
// NO-FINITE-ONLY-NOT: "-ffinite-math-only" |
| 302 |
// FINITE-ONLY-SAME: "-ffinite-math-only" |
| 303 |
|
| 304 |
// NO-CX-RANGE-NOT: "-complex-range" |
| 305 |
// CX-RANGE-FULL-SAME: "-complex-range=full" |
| 306 |
// CX-RANGE-PROMO-SAME: "-complex-range=promoted" |
| 307 |
// CX-RANGE-IMPRO-SAME: "-complex-range=improved" |
| 308 |
// CX-RANGE-BASIC-SAME: "-complex-range=basic" |
| 309 |
|
| 310 |
// end marker |
| 311 |
// CHECK-SAME: "-o" |
| 312 |
|
| 313 |
|
| 314 |
// This isn't fast-math, but the option is handled in the same place as other FP params. |
| 315 |
// Last option wins, and strict behavior is assumed by default. |
| 316 |
|
| 317 |
// RUN: %clang -### -fno-strict-float-cast-overflow -c %s 2>&1 \ |
| 318 |
// RUN: | FileCheck --check-prefix=CHECK-FPOV-WORKAROUND %s |
| 319 |
// CHECK-FPOV-WORKAROUND: "-cc1" |
| 320 |
// CHECK-FPOV-WORKAROUND: "-fno-strict-float-cast-overflow" |
| 321 |
|
| 322 |
// RUN: %clang -### -c %s 2>&1 \ |
| 323 |
// RUN: | FileCheck --check-prefix=CHECK-FPOV-WORKAROUND-DEFAULT %s |
| 324 |
// CHECK-FPOV-WORKAROUND-DEFAULT: "-cc1" |
| 325 |
// CHECK-FPOV-WORKAROUND-DEFAULT-NOT: "strict-float-cast-overflow" |
| 326 |
|
| 327 |
// RUN: %clang -### -fstrict-float-cast-overflow -c %s 2>&1 \ |
| 328 |
// RUN: | FileCheck --check-prefix=CHECK-NO-FPOV-WORKAROUND %s |
| 329 |
// CHECK-NO-FPOV-WORKAROUND: "-cc1" |
| 330 |
// CHECK-NO-FPOV-WORKAROUND-NOT: "strict-float-cast-overflow" |
| 331 |
|
| 332 |
// RUN: %clang -### -fno-strict-float-cast-overflow -fstrict-float-cast-overflow -c %s 2>&1 \ |
| 333 |
// RUN: | FileCheck --check-prefix=CHECK-NO-FPOV-WORKAROUND-OVERRIDE %s |
| 334 |
// CHECK-NO-FPOV-WORKAROUND-OVERRIDE: "-cc1" |
| 335 |
// CHECK-NO-FPOV-WORKAROUND-OVERRIDE-NOT: "strict-float-cast-overflow" |
| 336 |
|