xref: /llvm-project/clang/test/Driver/range.c (revision d9c4c312d81b4a2059d0ca2bb454c3452e52042e)
1 // Test range options for complex multiplication and division.
2 
3 // RUN: %clang -### -target x86_64 -fcx-limited-range -c %s 2>&1 \
4 // RUN:   | FileCheck --check-prefix=BASIC %s
5 
6 // RUN: %clang -### -target x86_64 -fno-cx-limited-range -c %s 2>&1 \
7 // RUN:   | FileCheck --check-prefix=FULL %s
8 
9 // RUN: %clang -### -target x86_64 -fcx-limited-range -fcx-fortran-rules \
10 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN1 %s
11 
12 // RUN: %clang -### -target x86_64 -fno-cx-limited-range -fcx-fortran-rules \
13 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN2 %s
14 
15 // RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-limited-range \
16 // RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
17 
18 // RUN: %clang -### -target x86_64 -fno-cx-limited-range -fcx-limited-range \
19 // RUN: -c %s 2>&1 | FileCheck --check-prefix=BASIC %s
20 
21 // RUN: %clang -### -target x86_64 -fno-cx-limited-range -fno-cx-fortran-rules \
22 // RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
23 
24 // RUN: %clang -### -target x86_64 -fno-cx-fortran-rules -fno-cx-limited-range \
25 // RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
26 
27 // RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-fortran-rules \
28 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN4 %s
29 
30 // RUN: %clang -### -target x86_64 -fcx-fortran-rules -c %s 2>&1 \
31 // RUN:   | FileCheck --check-prefix=IMPRVD %s
32 
33 // RUN: %clang -### -target x86_64 -fno-cx-fortran-rules -c %s 2>&1 \
34 // RUN:   | FileCheck --check-prefix=FULL %s
35 
36 // RUN: %clang -### -target x86_64 -fcx-fortran-rules -c %s 2>&1 \
37 // RUN:   -fno-cx-fortran-rules | FileCheck --check-prefix=FULL %s
38 
39 // RUN: %clang -### -target x86_64 -fcx-fortran-rules -fno-cx-limited-range \
40 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN3 %s
41 
42 // RUN: %clang -### -target x86_64 -fno-cx-fortran-rules -c %s 2>&1 \
43 // RUN:   | FileCheck  %s
44 
45 // RUN: %clang -### -target x86_64 -fcx-limited-range -fcx-fortran-rules \
46 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN1 %s
47 
48 // RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-fortran-rules \
49 // RUN: -c %s 2>&1 | FileCheck --check-prefix=WARN4 %s
50 
51 // RUN: %clang -### -target x86_64 -fcx-limited-range -fno-cx-limited-range \
52 // RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
53 
54 // RUN: %clang -### -target x86_64 -fcx-fortran-rules \
55 // RUN: -fcx-limited-range  -c %s 2>&1 \
56 // RUN:   | FileCheck --check-prefix=WARN20 %s
57 
58 // RUN: %clang -### -target x86_64 -ffast-math -c %s 2>&1 \
59 // RUN:   | FileCheck --check-prefix=BASIC %s
60 
61 // RUN: %clang -### -target x86_64 -ffast-math -fcx-limited-range -c %s 2>&1 \
62 // RUN:   | FileCheck --check-prefix=BASIC %s
63 
64 // RUN: %clang -### -target x86_64 -fcx-limited-range -ffast-math -c %s 2>&1 \
65 // RUN:   | FileCheck --check-prefix=BASIC %s
66 
67 // RUN: %clang -### -target x86_64 -ffast-math -fno-cx-limited-range \
68 // RUN: -c %s 2>&1 | FileCheck --check-prefix=FULL %s
69 
70 // RUN: not %clang -### -target x86_64 -fcomplex-arithmetic=foo -c %s 2>&1 \
71 // RUN:   | FileCheck --check-prefix=ERR %s
72 
73 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic -c %s 2>&1 \
74 // RUN:   | FileCheck --check-prefix=BASIC %s
75 
76 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=improved -c %s 2>&1 \
77 // RUN:   | FileCheck --check-prefix=IMPRVD %s
78 
79 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted -c %s 2>&1 \
80 // RUN:   | FileCheck --check-prefix=PRMTD %s
81 
82 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full -c %s 2>&1 \
83 // RUN:   | FileCheck --check-prefix=FULL %s
84 
85 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic \
86 // RUN: -fcx-limited-range -c %s 2>&1 \
87 // RUN:   | FileCheck --check-prefix=BASIC %s
88 
89 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic \
90 // RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
91 // RUN:   | FileCheck --check-prefix=IMPRVD %s
92 
93 // RUN: %clang -### -target x86_64 -fcx-limited-range \
94 // RUN: -fcomplex-arithmetic=improved -c %s 2>&1 \
95 // RUN:   | FileCheck --check-prefix=WARN6 %s
96 
97 // RUN: %clang -### -target x86_64 -fcx-fortran-rules \
98 // RUN: -fcomplex-arithmetic=basic -c %s 2>&1 \
99 // RUN:   | FileCheck --check-prefix=WARN7 %s
100 
101 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic \
102 // RUN: -fcomplex-arithmetic=full -c %s 2>&1 \
103 // RUN:   | FileCheck --check-prefix=FULL %s
104 
105 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic \
106 // RUN: -fcomplex-arithmetic=promoted -c %s 2>&1 \
107 // RUN:   | FileCheck --check-prefix=PRMTD %s
108 
109 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=improved \
110 // RUN: -fcomplex-arithmetic=basic  -c %s 2>&1 \
111 // RUN:   | FileCheck --check-prefix=BASIC %s
112 
113 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=improved \
114 // RUN: -fcomplex-arithmetic=full  -c %s 2>&1 \
115 // RUN:   | FileCheck --check-prefix=FULL %s
116 
117 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=improved \
118 // RUN: -fcomplex-arithmetic=promoted  -c %s 2>&1 \
119 // RUN:   | FileCheck --check-prefix=PRMTD %s
120 
121 
122 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
123 // RUN: -fcomplex-arithmetic=basic  -c %s 2>&1 \
124 // RUN:   | FileCheck --check-prefix=BASIC %s
125 
126 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
127 // RUN: -fcx-limited-range  -c %s 2>&1 \
128 // RUN:   | FileCheck --check-prefix=WARN14 %s
129 
130 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
131 // RUN: -fcomplex-arithmetic=improved  -c %s 2>&1 \
132 // RUN:   | FileCheck --check-prefix=IMPRVD %s
133 
134 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=promoted \
135 // RUN: -fcomplex-arithmetic=full  -c %s 2>&1 \
136 // RUN:   | FileCheck --check-prefix=FULL %s
137 
138 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
139 // RUN: -fcomplex-arithmetic=basic  -c %s 2>&1 \
140 // RUN:   | FileCheck --check-prefix=BASIC %s
141 
142 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
143 // RUN: -ffast-math  -c %s 2>&1 | FileCheck --check-prefix=WARN17 %s
144 
145 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
146 // RUN: -fcomplex-arithmetic=improved  -c %s 2>&1 \
147 // RUN:   | FileCheck --check-prefix=IMPRVD %s
148 
149 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=full \
150 // RUN: -fcomplex-arithmetic=promoted  -c %s 2>&1 \
151 // RUN:   | FileCheck --check-prefix=PRMTD %s
152 
153 // RUN: %clang -### -target x86_64 -ffast-math -c %s 2>&1 \
154 // RUN:   | FileCheck --check-prefix=BASIC %s
155 
156 // RUN: %clang -### -target x86_64 -ffast-math -fcx-limited-range -c %s 2>&1 \
157 // RUN:   | FileCheck --check-prefix=BASIC %s
158 
159 // RUN: %clang -### -target x86_64 -fcx-limited-range -ffast-math -c %s 2>&1 \
160 // RUN:   | FileCheck --check-prefix=BASIC %s
161 
162 // RUN: %clang -### -target x86_64 -ffast-math -fno-cx-limited-range -c %s \
163 // RUN:   2>&1 | FileCheck --check-prefix=FULL %s
164 
165 // RUN: %clang -### -target x86_64 -ffast-math -fcomplex-arithmetic=basic -c %s 2>&1 \
166 // RUN:   | FileCheck --check-prefix=BASIC %s
167 
168 // RUN: %clang -### -target x86_64 -fcomplex-arithmetic=basic -ffast-math -c %s 2>&1 \
169 // RUN:   | FileCheck --check-prefix=BASIC %s
170 
171 // RUN: %clang -### -Werror -target x86_64 -fcx-limited-range -c %s 2>&1 \
172 // RUN:   | FileCheck --check-prefix=BASIC %s
173 
174 // RUN: %clang -### -target x86_64 -ffast-math -fcomplex-arithmetic=full -c %s 2>&1 \
175 // RUN:   | FileCheck --check-prefix=FULL %s
176 
177 // RUN: %clang -### -target x86_64 -ffast-math -fcomplex-arithmetic=basic -c %s 2>&1 \
178 // RUN:   | FileCheck --check-prefix=BASIC %s
179 
180 // BASIC: -complex-range=basic
181 // FULL: -complex-range=full
182 // PRMTD: -complex-range=promoted
183 // BASIC-NOT: -complex-range=improved
184 // CHECK-NOT: -complex-range=basic
185 // IMPRVD: -complex-range=improved
186 // IMPRVD-NOT: -complex-range=basic
187 // CHECK-NOT: -complex-range=improved
188 
189 // WARN1: warning: overriding '-fcx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option]
190 // WARN2: warning: overriding '-fno-cx-limited-range' option with '-fcx-fortran-rules' [-Woverriding-option]
191 // WARN3: warning: overriding '-fcx-fortran-rules' option with '-fno-cx-limited-range' [-Woverriding-option]
192 // WARN4: warning: overriding '-fcx-limited-range' option with '-fno-cx-fortran-rules' [-Woverriding-option]
193 // WARN5: warning: overriding '-fcomplex-arithmetic=basic' option with '-fcomplex-arithmetic=improved' [-Woverriding-option]
194 // WARN6: warning: overriding '-fcx-limited-range' option with '-fcomplex-arithmetic=improved' [-Woverriding-option]
195 // WARN7: warning: overriding '-fcx-fortran-rules' option with '-fcomplex-arithmetic=basic' [-Woverriding-option]
196 // WARN14: overriding '-complex-range=promoted' option with '-fcx-limited-range' [-Woverriding-option]
197 // WARN17: warning: overriding '-fcomplex-arithmetic=full' option with '-fcomplex-arithmetic=basic' [-Woverriding-option]
198 // WARN20: warning: overriding '-fcx-fortran-rules' option with '-fcx-limited-range' [-Woverriding-option]
199 
200 // ERR: error: unsupported argument 'foo' to option '-fcomplex-arithmetic='
201