<div dir="ltr"><div dir="ltr">On Tue, Jun 6, 2023 at 1:08 PM Umesh Kalappa via Gcc <<a href="mailto:gcc@gcc.gnu.org">gcc@gcc.gnu.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Segher ,<br>
<br>
>>What did you expect, what happened instead?<br>
For example the complex args are passed in GPR's for cexp in the case<br>
GCC and Clang uses caller memory .<br>
<br>
for reference : <a href="https://godbolt.org/z/MfMz3cTe7" rel="noreferrer" target="_blank">https://godbolt.org/z/MfMz3cTe7</a><br>
<br>
We have cross tools like some of libraries built using the GCC and<br>
some use Clang .<br>
<br>
We approached Clang developers on this behaviour (Why stack , not the<br>
FPR's registers like PPC64) and they are not going to change this<br>
behaviour, and asked us to refer back to GCC ,hence this email thread.<br>
<br>
Question is : Why does GCC choose to use GPR's here and have any<br>
reference to support this decision ?<br></blockquote><div><br></div><div>The use of GPRs to pass complex floating point arguments was an early implementation mistake -- the parameter passing code missed the enumeration of a type. The behavior cannot be changed and corrected without breaking the ABI.</div><div><br></div><div>I don't know what you mean by "support this decision". It was not intentionally chosen through careful performance analysis or type system design as the preferred method to pass complex floating point values. The initial implementation was wrong and not discovered until it was too late. The reference to support this is that one cannot break the ABI without causing chaos in the ecosystem.</div><div><br></div><div>Thanks, David</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thank you<br>
~Umesh<br>
<br>
<br>
<br>
On Tue, Jun 6, 2023 at 10:16 PM Segher Boessenkool<br>
<<a href="mailto:segher@kernel.crashing.org" target="_blank">segher@kernel.crashing.org</a>> wrote:<br>
><br>
> Hi!<br>
><br>
> On Tue, Jun 06, 2023 at 08:35:22PM +0530, Umesh Kalappa wrote:<br>
> > Hi Adnrew,<br>
> > Thank you for the quick response and for PPC64 too ,we do have<br>
> > mismatches in ABI b/w complex operations like<br>
> > <a href="https://godbolt.org/z/bjsYovx4c" rel="noreferrer" target="_blank">https://godbolt.org/z/bjsYovx4c</a> .<br>
> ><br>
> > Any reason why GCC chose to use GPR 's here ?<br>
><br>
> What did you expect, what happened instead? Why did you expect that,<br>
> and why then is it an error what did happen?<br>
><br>
> You used -O0. As long as the code works, all is fine. But unoptimised<br>
> code frequently is hard to read, please use -O2 instead?<br>
><br>
> As Andrew says, why did you use -m32 for GCC but -m64 for LLVM? It is<br>
> hard to compare those at all! 32-bit PowerPC Linux ABI (based on 32-bit<br>
> PowerPC ELF ABI from 1995, BE version) vs. 64-bit ELFv2 ABI from 2015<br>
> (LE version).<br>
><br>
><br>
> Segher<br>
</blockquote></div></div>