Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGen/fp-floatcontrol-stack.cpp @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 0572611fdcc8 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
210 // Rule: precise must be enabled | 210 // Rule: precise must be enabled |
211 #pragma float_control(except, on) | 211 #pragma float_control(except, on) |
212 #endif | 212 #endif |
213 float y(); | 213 float y(); |
214 class ON { | 214 class ON { |
215 // Settings for top level class initializer revert to command line | 215 // Settings for top level class initializer use program source setting. |
216 // source pragma's do not pertain. | |
217 float z = 2 + y() * 7; | 216 float z = 2 + y() * 7; |
218 //CHECK-LABEL: define {{.*}} void @_ZN2ONC2Ev{{.*}} | 217 //CHECK-LABEL: define {{.*}} void @_ZN2ONC2Ev{{.*}} |
219 #if DEFAULT | 218 #if DEFAULT |
220 //CHECK-DDEFAULT: call float {{.*}}llvm.fmuladd | 219 //CHECK-DDEFAULT: call float {{.*}}llvm.fmuladd |
221 #endif | 220 #endif |
222 #if EBSTRICT | 221 #if EBSTRICT |
223 //Currently, same as default [command line options not considered] | 222 //Currently, same as default [command line options not considered] |
224 //CHECK-DEBSTRICT: call float {{.*}}llvm.fmuladd | 223 //CHECK-DEBSTRICT: call float {{.*}}llvm.fmuladd |
225 #endif | 224 #endif |
226 #if NOHONOR | 225 #if NOHONOR |
227 //CHECK-NOHONOR: call nnan ninf float @llvm.fmuladd{{.*}} | 226 //CHECK-NOHONOR: call float {{.*}}llvm.fmuladd |
228 #endif | 227 #endif |
229 #if FAST | 228 #if FAST |
230 //CHECK-FAST: fmul fast float | 229 //CHECK-FAST: float {{.*}}llvm.fmuladd{{.*}} |
231 //CHECK-FAST: fadd fast float | |
232 #endif | 230 #endif |
233 }; | 231 }; |
234 ON on; | 232 ON on; |
235 #pragma float_control(except, off) | 233 #pragma float_control(except, off) |
236 class OFF { | 234 class OFF { |
237 float w = 2 + y() * 7; | 235 float w = 2 + y() * 7; |
238 //CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}} | 236 //CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}} |
239 #if DEFAULT | 237 //CHECK: call float {{.*}}llvm.fmuladd |
240 //CHECK-DDEFAULT: call float {{.*}}llvm.fmuladd | |
241 #endif | |
242 #if EBSTRICT | |
243 //CHECK-DEBSTRICT: call float {{.*}}llvm.fmuladd | |
244 #endif | |
245 #if NOHONOR | |
246 //CHECK-NOHONOR: call nnan ninf float @llvm.fmuladd{{.*}} | |
247 #endif | |
248 #if FAST | |
249 //CHECK-FAST: fmul fast float | |
250 //CHECK-FAST: fadd fast float | |
251 #endif | |
252 }; | 238 }; |
253 OFF off; | 239 OFF off; |
240 | |
241 #pragma clang fp reassociate(on) | |
242 struct MyComplex { | |
243 float xx; | |
244 float yy; | |
245 MyComplex(float x, float y) { | |
246 xx = x; | |
247 yy = y; | |
248 } | |
249 MyComplex() {} | |
250 const MyComplex operator+(const MyComplex other) const { | |
251 //CHECK-LABEL: define {{.*}} @_ZNK9MyComplexplES_ | |
252 //CHECK: fadd reassoc float | |
253 //CHECK: fadd reassoc float | |
254 return MyComplex(xx + other.xx, yy + other.yy); | |
255 } | |
256 }; | |
257 MyComplex useAdd() { | |
258 MyComplex a (1, 3); | |
259 MyComplex b (2, 4); | |
260 return a + b; | |
261 } |