<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 5:39 PM, Morrison, Michael <span dir="ltr"><<a href="mailto:Michael_Morrison@playstation.sony.com" target="_blank">Michael_Morrison@playstation.sony.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">As some of you know, we at Sony Computer Entertainment America have been working on various aspects of LLVM, including Clang and its toolchain.  As part of our work, we have created documentation for our customers about using Clang, and
 we would like to share the fruits of our work with the Clang and LLVM communities.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">As our first documentation submission, we plan to provide our *CPU Intrinsics Guide*, which documents the Clang intrinsics for x86intrin.h, along with several builtin and sync types.  I've included a sample of what we document for one of
 the intrinsics below.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Our question for the community is:  what documentation format is most helpful and desired for this information?  We currently have two main possibilities in mind (with three variants for the first option):<u></u><u></u></p>

<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">1) Add the documentation for each intrinsic to the header file:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">- 1a) Using Doxygen tagging.  One benefit of this approach is that the documentation is available for the developer within a code-development/editing system.  One potential difficulty with this approach is that the intrinsics header file
 becomes much larger, which could increase compile times.</p></div></div></blockquote><div><br></div><div>As Eli mentioned, it would be nice to get some performance numbers.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">- 1b) Using Microsoft's annotation grammar.  We might be able to contain this annotation grammar within Doxygen tagging that deviates somewhat from the LLVM Doxygen style.  This approach allows us to generate XML output for the Microsoft
 Visual Studio Tooltip class.  The benefit of this approach is that the documentation is available for the developer within Visual Studio, without his or her having to open the specific header file.  Like option (1a), one potential difficulty with this approach
 is that the intrinsics header file becomes much larger, which could increase compile times.</p></div></div></blockquote><div><br></div><div>Is generating MSVS Tooltip XML output a hard requirement for your use case? If so, can you estimate how much effort it is to convert to that format given each of these options? My suspicion is that keeping this info in reST or even just a structured XML file converted to reST with a Sphinx plugin for docs generation will be the easiest solution; in both cases, it should be a fairly straightforward Python script to slurp in the file and spit out XML (the `docutils` library that Sphinx is based on and that reads in the reST has a nice XML-based internal representation of the reST document).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">- 1c) Using TblGen to maintain both the intrinsics definitions and their documentation, from which we generate the header file with both.  With this approach, we could implement either option (1a), (1b), or both, and have a single point
 of maintenance.  This option has the same benefits and drawbacks as (1a) and (1b).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">2) Add the documentation in reST and Sphynx format (to match existing Clang and LLVM documentation) to the Clang Web site.  The main benefit of this approach is that the documentation is available to anyone on the Web.<u></u><u></u></p>

<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thus, we come to you today to ask your opinion on which approach we should take.  We're open to providing one or more of the formats, as desired, or considering a different option that one of you might make.</p>
</div></div></blockquote><div><br></div><div>In what format is the documentation currently?</div><div><br></div><div>-- Sean Silva</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Sample intrinsic documentation (ASCII formatted for forum viewing)<u></u><u></u></p>
<p class="MsoNormal">-------------------------------<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">_mm256_round_ps<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">SYNOPSIS<u></u><u></u></p>
<p class="MsoNormal">#include <x86intrin.h><u></u><u></u></p>
<p class="MsoNormal">__m256 _mm256_round_ps(__m256 v, const int m);<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">INSTRUCTION<u></u><u></u></p>
<p class="MsoNormal">VROUNDPS<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">DESCRIPTION<u></u><u></u></p>
<p class="MsoNormal">Rounds the values stored in a packed 256-bit vector [8 x float] as specified by the byte operand. The source values are rounded to integer values and returned as floating point values.<u></u><u></u></p>

<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">PARAMETERS<u></u><u></u></p>
<p class="MsoNormal">v              A 256-bit vector of [8 x float] values.<u></u><u></u></p>
<p class="MsoNormal">m            An immediate byte operand specifying how the rounding is to be performed.<u></u><u></u></p>
<p class="MsoNormal">                Bits [7:4] are reserved.<u></u><u></u></p>
<p class="MsoNormal">                Bit [3] is a precision exception value:<u></u><u></u></p>
<p class="MsoNormal">                                0: A normal PE exception is used<u></u><u></u></p>
<p class="MsoNormal">                                1: The PE field is not updated<u></u><u></u></p>
<p class="MsoNormal">                Bit [2] is a rounding control source:<u></u><u></u></p>
<p class="MsoNormal">                                0: MXCSR:RC<u></u><u></u></p>
<p class="MsoNormal">                                1: Use the RC field value<u></u><u></u></p>
<p class="MsoNormal">                Bit [1:0] contain the rounding control definition:<u></u><u></u></p>
<p class="MsoNormal">                                00: Nearest<u></u><u></u></p>
<p class="MsoNormal">                                01: Downward (toward negative infinity)<u></u><u></u></p>
<p class="MsoNormal">                                10: Upward (toward positive infinity)<u></u><u></u></p>
<p class="MsoNormal">                                11: Truncated<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">RETURNS<u></u><u></u></p>
<p class="MsoNormal">A 256-bit vector of [8 x float] containing the rounded values.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-------------------------------<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Helv","sans-serif";color:purple">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Helv","sans-serif";color:purple">Michael<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt;font-family:"Cambria Math","serif"">$B"$(B</span><span style="font-size:14.0pt;font-family:"Arial","sans-serif"">$B!{(B</span><span style="font-size:14.0pt;font-family:"Helv","sans-serif"">$B!_(B</span><span style="font-size:14.0pt;font-family:"Arial","sans-serif"">$B""(B</span><span style="font-size:14.0pt;font-family:"Tms Rmn","serif"">
</span><span style="font-size:12.0pt;font-family:"Tms Rmn","serif"">   </span><span style="font-size:12.0pt;font-family:"MS Mincho"">$B$*Hh$lMM$G$9(B</span><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>