Plant an inline version of "((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))" instead.
Details
Diff Detail
Event Timeline
Looks good to me, with some nits. However it seems that we do not use the fast math flags anywhere else in Clang codegen, so it would be good to clarify if it is OK to use it here.
lib/CodeGen/CGExprComplex.cpp | ||
---|---|---|
768 | Maybe we should update the comment that we do a similar simplification for floats with fast math enabled as for integers? | |
773 | Would the following structure be slightly easier to read? if (RHSi) { if (FMF.isFast()) { simplify } else {libcall} } | |
800 | This is basically the same as the simplification for integers, unfortunate that we have to duplicate it (because of different instructions). |
lib/CodeGen/CGExprComplex.cpp | ||
---|---|---|
773 | Probably subjective but in this instance I preferred the look with fewer nested conditionals. |
Maybe we should update the comment that we do a similar simplification for floats with fast math enabled as for integers?