<div dir="ltr">To be clear, what I plan to change is for the following C code:<div><br><div><div>  long double foo1(long double x) { return x * x; }</div><div>  long double _Complex foo2(long double _Complex x) { return x * x; }</div><div><br></div><div>on x86_64, when long double is mapped to f128, current LLVM IR:</div><div><br></div><div>   define x86_fp80 @foo1(fp128 %x) </div><div>   define { x86_fp80, x86_fp80 } @foo2({ fp128, fp128 }* byval align 16 %x)</div><div><br></div><div>to be changed to match gcc, and new LLVM IR:</div><div><br></div><div>  define fp128 @foo1(fp128 %x)</div><div>  define void @foo2({ fp128, fp128 }* noalias sret %agg.result, { fp128, fp128 }* byval align 16 %x)</div><div><br></div><div>I added a long double _Complex bug at</div><div><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24111&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=mSEvAAjvIPw2xTVBe6-6RjoHNJaQvdunkMWIQ7LN4Bw&s=bpAO_ahFgdIBOFQYkEe6R2eEQKX--v0QNSrF8YWJZ-k&e=">https://llvm.org/bugs/show_bug.cgi?id=24111</a><br></div><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 15, 2015 at 9:42 AM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jul 15, 2015 at 9:01 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Jul 13, 2015 at 12:33 PM, Chih-hung Hsieh <span dir="ltr"><<a href="mailto:chh@google.com" target="_blank">chh@google.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>I found that long double complex (with two f128 values) also have calling convention compatibility problem with gcc and can be fixed similarly.</div><div>My current patch does change quite a few places in type legalizing pass and some other optimizations related to f128 or i128 values. A few changes in the softening of floating point types to keep some f128 typed IR and convert some f128 opcode to library function calls.</div><div><br></div><div>Has anyone tried this approach or have other solution?</div></div></blockquote><div><br></div></span><div>It sounds like you're on the right track for the low-level part of this.</div><div><br></div><div>The responsibility of matching platform ABI calling conventions is sort of split across clang and LLVM. I think the way to get the calling convention right is to change Clang to use x86_fp80 as the LLVM type for parameter and return types, with some extra coercions inserted before calls and in function prologues.</div><div><br></div><div>The mangling will need a separate change as it doesn't look at LLVM IR.</div></div></div></div></blockquote><div><br></div></div></div><div>I think you'll want to implement "useFloat128ManglingForLongDouble" for the mangling change.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div>