<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #000000'><br><hr id="zwchr"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Tim Shen" <timshen@google.com><br><b>To: </b>"Hal Finkel" <hfinkel@anl.gov><br><b>Cc: </b>resistor@mac.com, "Fiona Glaser" <escha@apple.com>, "Stephen Canon" <scanon@apple.com>, "Eric Christopher" <echristo@gmail.com>, llvm-dev@lists.llvm.org<br><b>Sent: </b>Monday, October 3, 2016 3:52:12 PM<br><b>Subject: </b>Re: [PPC, APFloat] Add full PPCDoubleDouble to APFloat<br><br><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 3, 2016 at 1:02 PM Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_msg"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt; color: rgb(0, 0, 0);" class="gmail_msg"><span style="font-size: 10pt;">There might be some tradeoff here between performance and maintainability.</span><br></div></div></blockquote><div><br></div><div>I don't think that it's a tradeoff. We can have both. For example:</div><div><br></div><div>struct IEEEPayload {<br> union Significand { integerPart part; integerPart *parts; } significand;<br> int exponent;</div><div> int category : 3;</div><div> int sign : 1;<br>};</div><div><br></div><div>struct PPCDoubleDoublePayload {</div><div> struct {</div><div> int exponent1, exponent2;</div><div> integerPart significands[]; // flexible array member, or llvm::TrailingObjects instead.</div><div> } *heapdata;</div><div><div> int category : 3;<br></div><div> int sign : 2;<br></div></div><div>};</div><div><br></div><div>class APFloat {</div><div> fltSemantics *semantics;</div><div> union {</div><div> IEEEPayload ieee;</div><div> PPCDoubleDoublePayload ppc;</div><div> } payload;</div><div>};</div><div><br></div><div>It's just an example of how we can use the same shallow space.</div><div><br></div><div id="DWT11056">My previous point is that, I want to build an internal abstraction in the hope to reduce technical debt and maintenance burden, but I\we need to do it correctly.</div></div></div></blockquote>That looks good to me (using llvm::TrailingObjects seems a bit cleaner than the trailing array).<br><br> -Hal<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_quote"><div></div><div> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_msg"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt; color: rgb(0, 0, 0);" class="gmail_msg">APFloat already isn't *fast*, so I'm not super worried about introducing some extra checks inside the functions, but I'm more worried about increasing the size of the APFloat object itself, because we might have *a lot* of these in memory at once. As a result, I'd prefer a solution that did not increase the size of the base APFloat object (because then everyone pays a price for this and most people won't use it).<br class="gmail_msg"><br class="gmail_msg">Thanks again,<br class="gmail_msg">Hal<br class="gmail_msg"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"></div><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br class="gmail_msg">
Thanks again,<br class="gmail_msg">
Hal<br class="gmail_msg">
<br class="gmail_msg">
<hr id="m_-2075687675377365430zwchr" class="gmail_msg"></blockquote></div></div></blockquote></div></div><div class="gmail_msg"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt; color: rgb(0, 0, 0);" class="gmail_msg"><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br class="gmail_msg">
> From: "Tim Shen" <<a href="mailto:timshen@google.com" class="gmail_msg" target="_blank">timshen@google.com</a>><br class="gmail_msg">
> To: <a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
> Cc: <a href="mailto:resistor@mac.com" class="gmail_msg" target="_blank">resistor@mac.com</a>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" class="gmail_msg" target="_blank">hfinkel@anl.gov</a>>, "Fiona Glaser" <<a href="mailto:escha@apple.com" class="gmail_msg" target="_blank">escha@apple.com</a>>, "Stephen Canon"<br class="gmail_msg">
> <<a href="mailto:scanon@apple.com" class="gmail_msg" target="_blank">scanon@apple.com</a>>, "Eric Christopher" <<a href="mailto:echristo@gmail.com" class="gmail_msg" target="_blank">echristo@gmail.com</a>><br class="gmail_msg">
> Sent: Friday, September 30, 2016 4:43:12 PM<br class="gmail_msg">
> Subject: [PPC, APFloat] Add full PPCDoubleDouble to APFloat<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> I have found some internal test failures due to the wrong constant<br class="gmail_msg">
> folding on ppc_fp128.<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> As documented in APFloat::PPCDoubleDouble, APFloat doesn't support<br class="gmail_msg">
> PowerPC double-double correctly <<br class="gmail_msg">
> <a href="https://github.com/llvm-mirror/llvm/blob/492acdd450bcdf9837494d6da029ed064f14fc33/lib/Support/APFloat.cpp#L74" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/llvm-mirror/llvm/blob/492acdd450bcdf9837494d6da029ed064f14fc33/lib/Support/APFloat.cpp#L74</a><br class="gmail_msg">
> >.<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> To support this, we need to add a second tuple of (sign, exponent,<br class="gmail_msg">
> significand) to APFloat. I wonder where should I start to change, so<br class="gmail_msg">
> that it's less hacky? I certainly expect refactoring to come. :)<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> Thanks!<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Hal Finkel<br class="gmail_msg">
Lead, Compiler Technology and Programming Languages<br class="gmail_msg">
Leadership Computing Facility<br class="gmail_msg">
Argonne National Laboratory<br class="gmail_msg">
</blockquote></div></div></blockquote></div></div><div class="gmail_msg"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt; color: rgb(0, 0, 0);" class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg">-- <br class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg"></span>Hal Finkel<br class="gmail_msg">Lead, Compiler Technology and Programming Languages<br class="gmail_msg">Leadership Computing Facility<br class="gmail_msg">Argonne National Laboratory<span class="gmail_msg"></span><br class="gmail_msg"></div></div></div></blockquote></div></div>
</blockquote><br><br><br>-- <br><div><span name="x"></span>Hal Finkel<br>Lead, Compiler Technology and Programming Languages<br>Leadership Computing Facility<br>Argonne National Laboratory<span name="x"></span><br></div></div></body></html>