<div dir="ltr">Please find enclosed an updated patch containing a test showing the difference in the generated IR.<br>Tom<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 16, 2014 at 3:25 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you write a test showing the difference is the generated IR? Look<br>
at the tests i clang/test/CodeGen for examples.<br>
<div><div class="h5"><br>
On 16 June 2014 13:46, Thomas Jablin <<a href="mailto:tjablin@gmail.com">tjablin@gmail.com</a>> wrote:<br>
> Hi,<br>
> Please find enclosed a patch to resolve PR20018. According to the x86-64<br>
> ABI, structures with both floating point and integer members are split<br>
> between floating-point and general purpose registers, and consecutive 32-bit<br>
> floats can be packed into a single floating point register. In variadic<br>
> functions, clang writes out the state of the GP registers and FP registers<br>
> to different regions in memory. A bug in the TargetInfo logic is causing<br>
> llvm to try to read floating point arguments from the FP region of the<br>
> stack. Specifically:<br>
><br>
> 02593     llvm::Value *RegLoAddr = TyLo->isFloatingPointTy() ? FPAddr :<br>
> GPAddr;<br>
> 02594     llvm::Value *RegHiAddr = TyLo->isFloatingPointTy() ? GPAddr :<br>
> FPAddr;<br>
><br>
> Are checking if TyLo is a floating point type, however, two consecutive<br>
> floating point fields will be represented as an floating point vector.<br>
> Consequently, the correct code should be:<br>
><br>
> 02593    llvm::Value *RegLoAddr = TyLo->isFPOrFPVectorTy() ? FPAddr :<br>
> GPAddr;<br>
> 02594    llvm::Value *RegHiAddr = TyLo->isFPOrFPVectorTy() ? GPAddr :<br>
> FPAddr;<br>
><br>
> The code on line 2623 is already checking for floating point vectors<br>
> appropriately. I have also attached a simple test case named gpfpTest.c.<br>
> Thanks.<br>
> Tom<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</blockquote></div><br></div>