[PATCH] D41659: Implementing missing trigonometric optimizations
ADIL ARUN DANGUI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 21:33:09 PST 2018
cs15btech11041 added a comment.
In https://reviews.llvm.org/D41659#965699, @davide wrote:
> Meta point: It's unclear to me whether this is something profitable to implement.
> Sure, you can probably take a textbook and implement all the possible identities written there, but, what's the point?
>
> I looked and it seems other compilers (most notably, GCC) don't implement at least the first transformation you implemented (I didn't bother to check the others).
> https://godbolt.org/g/kKP5PW
>
> tl;dr: what's your motivation?
Hi, thanks for the comments. the motivation for taking this up were two things.
First was missing optimization reported on bugzilla. However it mentions only the first optimization implemented. I have implemented for other similar cases as well.
https://bugs.llvm.org/show_bug.cgi?id=35602
Second, replacing two trigonometric operations with single trigonometric operation or with a mul/div instruction would save considerable clock cycles. It says trigonometric operations require almost five time the clock cycles needed by multiplication/division.Also to add we are reducing the code size. As one could see from the test cases, the number of instructions after transformations <= number of instructions before. And to that we are also saving clock cycles.
https://stackoverflow.com/questions/2479517/is-trigonometry-computationally-expensive
Repository:
rL LLVM
https://reviews.llvm.org/D41659
More information about the llvm-commits
mailing list