| 1 |
// Test that -ffp-contract is set to the right value when combined with |
| 2 |
// the options -ffast-math, -fno-fast-math, funsafe-math-optimizations, |
| 3 |
// fno-unsafe-math-optimizations. |
| 4 |
|
| 5 |
// ffast-math, fno-fast-math |
| 6 |
// RUN: %clang -### -ffast-math -c %s 2>&1 \ |
| 7 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 8 |
// CHECK-FPC-FAST: "-ffp-contract=fast" |
| 9 |
|
| 10 |
// RUN: %clang -### -fno-fast-math -c %s 2>&1 \ |
| 11 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 12 |
|
| 13 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=on -c %s 2>&1 \ |
| 14 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 15 |
// CHECK-FPC-ON: "-ffp-contract=on" |
| 16 |
|
| 17 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=off -c %s 2>&1 \ |
| 18 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 19 |
// CHECK-FPC-OFF: "-ffp-contract=off" |
| 20 |
|
| 21 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=fast -c %s 2>&1 \ |
| 22 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 23 |
|
| 24 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=fast-honor-pragmas -c %s 2>&1 \ |
| 25 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST-HONOR %s |
| 26 |
// CHECK-FPC-FAST-HONOR: "-ffp-contract=fast-honor-pragmas" |
| 27 |
|
| 28 |
// RUN: %clang -### -Werror -ffp-contract=fast -ffast-math -c %s 2>&1 \ |
| 29 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 30 |
// RUN: %clang -### -Werror -ffp-contract=on -ffast-math -c %s 2>&1 \ |
| 31 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 32 |
// RUN: %clang -### -Werror -ffp-contract=off -ffast-math -c %s 2>&1 \ |
| 33 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 34 |
|
| 35 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-fast-math -c %s 2>&1 \ |
| 36 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 37 |
// RUN: %clang -### -Werror -ffp-contract=on -fno-fast-math -c %s 2>&1 \ |
| 38 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 39 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-fast-math -c %s 2>&1 \ |
| 40 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 41 |
|
| 42 |
|
| 43 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=fast -ffp-contract=on -c %s 2>&1 \ |
| 44 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 45 |
|
| 46 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=on -ffp-contract=off -c %s 2>&1 \ |
| 47 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 48 |
|
| 49 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=on -ffp-contract=fast -c %s 2>&1 \ |
| 50 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 51 |
|
| 52 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=off -ffp-contract=on -c %s 2>&1 \ |
| 53 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 54 |
|
| 55 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=off -ffp-contract=fast \ |
| 56 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 57 |
|
| 58 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=on -fno-fast-math -c %s 2>&1 \ |
| 59 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 60 |
|
| 61 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=off -fno-fast-math -c %s 2>&1 \ |
| 62 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 63 |
|
| 64 |
// RUN: %clang -### -Werror -ffast-math -ffp-contract=fast -fno-fast-math -c %s 2>&1 \ |
| 65 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 66 |
|
| 67 |
// RUN: %clang -### -Werror -ffast-math -fno-fast-math -c %s 2>&1 \ |
| 68 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 69 |
|
| 70 |
// RUN: %clang -### -Werror -fno-fast-math -ffast-math -c %s 2>&1 \ |
| 71 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 72 |
|
| 73 |
// RUN: %clang -### -Werror -fno-fast-math -ffp-contract=on -c %s 2>&1 \ |
| 74 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 75 |
|
| 76 |
// RUN: %clang -### -Werror -fno-fast-math -ffp-contract=off -c %s 2>&1 \ |
| 77 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 78 |
|
| 79 |
// RUN: %clang -### -Werror -fno-fast-math -ffp-contract=fast -c %s 2>&1 \ |
| 80 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 81 |
|
| 82 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-fast-math -ffp-contract=on \ |
| 83 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 84 |
|
| 85 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-fast-math -ffp-contract=off \ |
| 86 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 87 |
|
| 88 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-fast-math -ffp-contract=fast \ |
| 89 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 90 |
|
| 91 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-fast-math -ffp-contract=on \ |
| 92 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 93 |
|
| 94 |
// RUN: %clang -### -Werror -ffp-contract=on -ffast-math -c %s 2>&1 \ |
| 95 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 96 |
|
| 97 |
// RUN: %clang -### -Werror -ffp-contract=off -ffast-math -c %s 2>&1 \ |
| 98 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 99 |
|
| 100 |
// RUN: %clang -### -Werror -ffp-contract=fast -ffast-math -c %s 2>&1 \ |
| 101 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 102 |
|
| 103 |
// RUN: %clang -### -Werror -ffp-contract=on -ffast-math -fno-fast-math -c %s 2>&1 \ |
| 104 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 105 |
|
| 106 |
// RUN: %clang -### -Werror -ffp-contract=off -ffast-math -fno-fast-math -c %s 2>&1 \ |
| 107 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 108 |
|
| 109 |
// RUN: %clang -### -Werror -ffp-contract=fast -ffast-math -fno-fast-math -c %s 2>&1 \ |
| 110 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 111 |
|
| 112 |
// RUN: %clang -### -Werror -fno-fast-math -ffast-math -ffp-contract=fast \ |
| 113 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 114 |
|
| 115 |
// RUN: %clang -### -Werror -fno-fast-math -ffast-math -ffp-contract=on \ |
| 116 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 117 |
|
| 118 |
// RUN: %clang -### -Werror -fno-fast-math -ffast-math -ffp-contract=off \ |
| 119 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 120 |
|
| 121 |
// funsafe-math-optimizations, fno-unsafe-math-optimizations |
| 122 |
// RUN: %clang -### -funsafe-math-optimizations -c %s 2>&1 \ |
| 123 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 124 |
|
| 125 |
// RUN: %clang -### -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 126 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 127 |
|
| 128 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=on -c %s 2>&1 \ |
| 129 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 130 |
|
| 131 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=off -c %s 2>&1 \ |
| 132 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 133 |
|
| 134 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=fast -c %s 2>&1 \ |
| 135 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 136 |
|
| 137 |
// RUN: %clang -### -Werror -ffp-contract=fast -funsafe-math-optimizations -c %s 2>&1 \ |
| 138 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 139 |
// RUN: %clang -### -Werror -ffp-contract=on -funsafe-math-optimizations -c %s 2>&1 \ |
| 140 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 141 |
// RUN: %clang -### -Werror -ffp-contract=off -funsafe-math-optimizations -c %s 2>&1 \ |
| 142 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 143 |
|
| 144 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-unsafe-math-optimizations -c \ |
| 145 |
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 146 |
// RUN: %clang -### -Werror -ffp-contract=on -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 147 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 148 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 149 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 150 |
|
| 151 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=fast \ |
| 152 |
// RUN: -ffp-contract=on -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 153 |
|
| 154 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=on \ |
| 155 |
// RUN: -ffp-contract=off -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 156 |
|
| 157 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=on \ |
| 158 |
// RUN: -ffp-contract=fast -c %s 2>&1 \ |
| 159 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 160 |
|
| 161 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=off \ |
| 162 |
// RUN: -ffp-contract=on -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 163 |
|
| 164 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=off \ |
| 165 |
// RUN: -ffp-contract=fast \ |
| 166 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 167 |
|
| 168 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=on \ |
| 169 |
// RUN: -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 170 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 171 |
|
| 172 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=off \ |
| 173 |
// RUN: -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 174 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 175 |
|
| 176 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -ffp-contract=fast \ |
| 177 |
// RUN: -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 178 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 179 |
|
| 180 |
// RUN: %clang -### -Werror -funsafe-math-optimizations -fno-unsafe-math-optimizations \ |
| 181 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 182 |
|
| 183 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -funsafe-math-optimizations \ |
| 184 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 185 |
|
| 186 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -ffp-contract=on -c %s 2>&1 \ |
| 187 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 188 |
|
| 189 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -ffp-contract=off -c %s 2>&1 \ |
| 190 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 191 |
|
| 192 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -ffp-contract=fast -c %s 2>&1 \ |
| 193 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 194 |
|
| 195 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-unsafe-math-optimizations \ |
| 196 |
// RUN: -ffp-contract=on \ |
| 197 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 198 |
|
| 199 |
// RUN: %clang -### -Werror -ffp-contract=fast -fno-unsafe-math-optimizations \ |
| 200 |
// RUN: -ffp-contract=off \ |
| 201 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 202 |
|
| 203 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-unsafe-math-optimizations \ |
| 204 |
// RUN: -ffp-contract=fast \ |
| 205 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 206 |
|
| 207 |
// RUN: %clang -### -Werror -ffp-contract=off -fno-unsafe-math-optimizations \ |
| 208 |
// RUN: -ffp-contract=on -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 209 |
|
| 210 |
// RUN: %clang -### -Werror -ffp-contract=on -funsafe-math-optimizations -c %s 2>&1 \ |
| 211 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 212 |
|
| 213 |
// RUN: %clang -### -Werror -ffp-contract=off -funsafe-math-optimizations -c %s 2>&1 \ |
| 214 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 215 |
|
| 216 |
// RUN: %clang -### -Werror -ffp-contract=fast -funsafe-math-optimizations -c %s 2>&1 \ |
| 217 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 218 |
|
| 219 |
// RUN: %clang -### -Werror -ffp-contract=on -funsafe-math-optimizations -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 220 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 221 |
|
| 222 |
// RUN: %clang -### -Werror -ffp-contract=off -funsafe-math-optimizations -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 223 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 224 |
|
| 225 |
// RUN: %clang -### -Werror -ffp-contract=fast -funsafe-math-optimizations -fno-unsafe-math-optimizations -c %s 2>&1 \ |
| 226 |
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 227 |
|
| 228 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -funsafe-math-optimizations \ |
| 229 |
// RUN: -ffp-contract=fast \ |
| 230 |
// RUN: -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-FAST %s |
| 231 |
|
| 232 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -funsafe-math-optimizations \ |
| 233 |
// RUN: -ffp-contract=on -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-ON %s |
| 234 |
|
| 235 |
// RUN: %clang -### -Werror -fno-unsafe-math-optimizations -funsafe-math-optimizations \ |
| 236 |
// RUN: -ffp-contract=off -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s |
| 237 |
|