1 // Test that incompatible combinations of -ffp-model= options
2 // and other floating point options get a warning diagnostic.
3 //
4 
5 // RUN: %clang -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \
6 // RUN:   | FileCheck --check-prefix=WARN %s
7 // WARN: warning: overriding '-ffp-model=fast' option with '-ffp-contract=off' [-Woverriding-t-option]
8 
9 // RUN: %clang -### -ffp-model=fast -ffp-contract=on -c %s 2>&1 \
10 // RUN:   | FileCheck --check-prefix=WARN1 %s
11 // WARN1: warning: overriding '-ffp-model=fast' option with '-ffp-contract=on' [-Woverriding-t-option]
12 
13 // RUN: %clang -### -ffp-model=strict -fassociative-math -c %s 2>&1 \
14 // RUN:   | FileCheck --check-prefix=WARN2 %s
15 // WARN2: warning: overriding '-ffp-model=strict' option with '-fassociative-math' [-Woverriding-t-option]
16 
17 // RUN: %clang -### -ffp-model=strict -ffast-math -c %s 2>&1 \
18 // RUN:   | FileCheck --check-prefix=WARN3 %s
19 // WARN3: warning: overriding '-ffp-model=strict' option with '-ffast-math' [-Woverriding-t-option]
20 
21 // RUN: %clang -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \
22 // RUN:   | FileCheck --check-prefix=WARN4 %s
23 // WARN4: warning: overriding '-ffp-model=strict' option with '-ffinite-math-only' [-Woverriding-t-option]
24 
25 // RUN: %clang -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
26 // RUN:   | FileCheck --check-prefix=WARN5 %s
27 // WARN5: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
28 
29 // RUN: %clang -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
30 // RUN:   | FileCheck --check-prefix=WARN7 %s
31 // WARN7: warning: overriding '-ffp-model=strict' option with '-ffp-contract=on' [-Woverriding-t-option]
32 
33 // RUN: %clang -### -ffp-model=strict -fno-honor-infinities -c %s 2>&1 \
34 // RUN:   | FileCheck --check-prefix=WARN8 %s
35 // WARN8: warning: overriding '-ffp-model=strict' option with '-fno-honor-infinities' [-Woverriding-t-option]
36 
37 // RUN: %clang -### -ffp-model=strict -fno-honor-nans -c %s 2>&1 \
38 // RUN:   | FileCheck --check-prefix=WARN9 %s
39 // WARN9: warning: overriding '-ffp-model=strict' option with '-fno-honor-nans' [-Woverriding-t-option]
40 
41 // RUN: %clang -### -ffp-model=strict -fno-rounding-math -c %s 2>&1 \
42 // RUN:   | FileCheck --check-prefix=WARNa %s
43 // WARNa: warning: overriding '-ffp-model=strict' option with '-fno-rounding-math' [-Woverriding-t-option]
44 
45 // RUN: %clang -### -ffp-model=strict -fno-signed-zeros -c %s 2>&1 \
46 // RUN:   | FileCheck --check-prefix=WARNb %s
47 // WARNb: warning: overriding '-ffp-model=strict' option with '-fno-signed-zeros' [-Woverriding-t-option]
48 
49 // RUN: %clang -### -ffp-model=strict -fno-trapping-math -c %s 2>&1 \
50 // RUN:   | FileCheck --check-prefix=WARNc %s
51 // WARNc: warning: overriding '-ffp-model=strict' option with '-fno-trapping-math' [-Woverriding-t-option]
52 
53 // RUN: %clang -### -ffp-model=strict -freciprocal-math -c %s 2>&1 \
54 // RUN:   | FileCheck --check-prefix=WARNd %s
55 // WARNd: warning: overriding '-ffp-model=strict' option with '-freciprocal-math' [-Woverriding-t-option]
56 
57 // RUN: %clang -### -ffp-model=strict -funsafe-math-optimizations -c %s 2>&1 \
58 // RUN:   | FileCheck --check-prefix=WARNe %s
59 // WARNe: warning: overriding '-ffp-model=strict' option with '-funsafe-math-optimizations' [-Woverriding-t-option]
60 
61 // RUN: %clang -### -ffp-model=strict -Ofast -c %s 2>&1 \
62 // RUN:   | FileCheck --check-prefix=WARNf %s
63 // WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option]
64 
65 // RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
66 // RUN:   | FileCheck --check-prefix=WARN10 %s
67 // WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option]
68 
69 // RUN: %clang -### -c %s 2>&1 \
70 // RUN:   | FileCheck --check-prefix=CHECK-NOROUND %s
71 // CHECK-NOROUND: "-cc1"
72 // CHECK-NOROUND: "-fno-rounding-math"
73 
74 // RUN: %clang -### -frounding-math -c %s 2>&1 \
75 // RUN:   | FileCheck --check-prefix=CHECK-ROUND --implicit-check-not ffp-exception-behavior=strict %s
76 // CHECK-ROUND: "-cc1"
77 // CHECK-ROUND: "-frounding-math"
78 
79 // RUN: %clang -### -ftrapping-math -c %s 2>&1 \
80 // RUN:   | FileCheck --check-prefix=CHECK-TRAP %s
81 // CHECK-TRAP: "-cc1"
82 // CHECK-TRAP: "-ffp-exception-behavior=strict"
83 
84 // RUN: %clang -### -nostdinc -ffp-model=fast -c %s 2>&1 \
85 // RUN:   | FileCheck --check-prefix=CHECK-FPM-FAST %s
86 // CHECK-FPM-FAST: "-cc1"
87 // CHECK-FPM-FAST: "-menable-no-infs"
88 // CHECK-FPM-FAST: "-menable-no-nans"
89 // CHECK-FPM-FAST: "-menable-unsafe-fp-math"
90 // CHECK-FPM-FAST: "-fno-signed-zeros"
91 // CHECK-FPM-FAST: "-mreassociate"
92 // CHECK-FPM-FAST: "-freciprocal-math"
93 // CHECK-FPM-FAST: "-ffp-contract=fast"
94 // CHECK-FPM-FAST: "-fno-rounding-math"
95 // CHECK-FPM-FAST: "-ffast-math"
96 // CHECK-FPM-FAST: "-ffinite-math-only"
97 
98 // RUN: %clang -### -nostdinc -ffp-model=precise -c %s 2>&1 \
99 // RUN:   | FileCheck --check-prefix=CHECK-FPM-PRECISE %s
100 // CHECK-FPM-PRECISE: "-cc1"
101 // CHECK-FPM-PRECISE: "-ffp-contract=on"
102 // CHECK-FPM-PRECISE: "-fno-rounding-math"
103 
104 // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
105 // RUN:   | FileCheck --check-prefix=CHECK-FPM-STRICT %s
106 // CHECK-FPM-STRICT: "-cc1"
107 // CHECK-FPM-STRICT: "-frounding-math"
108 // CHECK-FPM-STRICT: "-ffp-exception-behavior=strict"
109 
110 
111 // RUN: %clang -### -nostdinc -ffp-exception-behavior=strict -c %s 2>&1 \
112 // RUN:   | FileCheck --check-prefix=CHECK-FEB-STRICT %s
113 // CHECK-FEB-STRICT: "-cc1"
114 // CHECK-FEB-STRICT: "-fno-rounding-math"
115 // CHECK-FEB-STRICT: "-ffp-exception-behavior=strict"
116 
117 // RUN: %clang -### -nostdinc -ffp-exception-behavior=maytrap -c %s 2>&1 \
118 // RUN:   | FileCheck --check-prefix=CHECK-FEB-MAYTRAP %s
119 // CHECK-FEB-MAYTRAP: "-cc1"
120 // CHECK-FEB-MAYTRAP: "-fno-rounding-math"
121 // CHECK-FEB-MAYTRAP: "-ffp-exception-behavior=maytrap"
122 
123 // RUN: %clang -### -nostdinc -ffp-exception-behavior=ignore -c %s 2>&1 \
124 // RUN:   | FileCheck --check-prefix=CHECK-FEB-IGNORE %s
125 // CHECK-FEB-IGNORE: "-cc1"
126 // CHECK-FEB-IGNORE: "-fno-rounding-math"
127 // CHECK-FEB-IGNORE: "-ffp-exception-behavior=ignore"
128 
129