[PATCH] Correctly Load Mixed FP-GP Variadic Arguments for x86-64

Thomas Jablin tjablin at gmail.com
Mon Jun 16 14:23:49 PDT 2014


Please find enclosed an updated patch containing a test showing the
difference in the generated IR.
Tom


On Mon, Jun 16, 2014 at 3:25 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> Can you write a test showing the difference is the generated IR? Look
> at the tests i clang/test/CodeGen for examples.
>
> On 16 June 2014 13:46, Thomas Jablin <tjablin at gmail.com> wrote:
> > Hi,
> > Please find enclosed a patch to resolve PR20018. According to the x86-64
> > ABI, structures with both floating point and integer members are split
> > between floating-point and general purpose registers, and consecutive
> 32-bit
> > floats can be packed into a single floating point register. In variadic
> > functions, clang writes out the state of the GP registers and FP
> registers
> > to different regions in memory. A bug in the TargetInfo logic is causing
> > llvm to try to read floating point arguments from the FP region of the
> > stack. Specifically:
> >
> > 02593     llvm::Value *RegLoAddr = TyLo->isFloatingPointTy() ? FPAddr :
> > GPAddr;
> > 02594     llvm::Value *RegHiAddr = TyLo->isFloatingPointTy() ? GPAddr :
> > FPAddr;
> >
> > Are checking if TyLo is a floating point type, however, two consecutive
> > floating point fields will be represented as an floating point vector.
> > Consequently, the correct code should be:
> >
> > 02593    llvm::Value *RegLoAddr = TyLo->isFPOrFPVectorTy() ? FPAddr :
> > GPAddr;
> > 02594    llvm::Value *RegHiAddr = TyLo->isFPOrFPVectorTy() ? GPAddr :
> > FPAddr;
> >
> > The code on line 2623 is already checking for floating point vectors
> > appropriately. I have also attached a simple test case named gpfpTest.c.
> > Thanks.
> > Tom
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140616/07c86574/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GPFP-2.patch
Type: text/x-patch
Size: 1613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140616/07c86574/attachment.bin>


More information about the cfe-commits mailing list