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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jun 16 13:25:48 PDT 2014


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
>



More information about the cfe-commits mailing list