[LLVMdev] X86 rcp instruction generated

Chakraborty, Soham Soham.Chakraborty at amd.com
Wed Nov 14 22:49:13 PST 2012


Hi,

We have implemented the rcp instruction generation for X86 target architecture. We have introduced a flag -fp-rcp flag which controls the generatation of X86 rcp instruction generation.
We have observed minor effects on precision and hence hve put these transformations under the mentioned flag.
Note that -fp-rcp is only enabled with -enable-unsafe-fp-math flag presently.
Moreover we have achieved some derived optimizations along with rsqrt generations.
Following is the details of the -fp-rcp flag along with its values and enabled optimizations.

  -fp-rcp
    =off                                  -   No rcp
    =on                                   -   y/x => y * rcp(x)  // Standard
    =fda                               -    Standard, Derive FMA i.e. y/x +z => y * rcp(x) + z => vfmaddss y rcp(x) z.
                                                  This is termed as FDA(Fused Division Accumulate)

Sending the code patch(on llvm svn revision 167927), text description and testcases attached with this mail. Please review.

Future enhance plans are as follows.

TODO:
1. Enable vector rsqrt generation.
2. Generate different variations of FDA i.e. FMSUB, FNMSUB,FNMADD instruction generations as required.


Best Regards,
soham


"The search for truth is more precious than its possession."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121115/7a8b9f33/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcp_167927.patch
Type: application/octet-stream
Size: 10348 bytes
Desc: rcp_167927.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121115/7a8b9f33/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rcp-description.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121115/7a8b9f33/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcp-fda.ll
Type: application/octet-stream
Size: 4788 bytes
Desc: rcp-fda.ll
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121115/7a8b9f33/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcp-on.ll
Type: application/octet-stream
Size: 4253 bytes
Desc: rcp-on.ll
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121115/7a8b9f33/attachment-0002.obj>


More information about the llvm-dev mailing list