This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix passing two floating-point values in complex separately by two GPRs on RV64
ClosedPublic

Authored by Jim on May 12 2020, 12:50 AM.

Details

Summary

This patch fixed the error of counting the remaining FPRs. Complex floating-point values should be passed by two FPRs for the hard-float ABI. If no two FPRs are available, it should be passed via a 64-bit GPR (fp+fp). ArgFPRsLeft is only decreased one while the type is complex floating-point. It causes two floating-point values in the complex are passed separately by two GPRs.

Diff Detail

Event Timeline

Jim created this revision.May 12 2020, 12:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2020, 12:50 AM
luismarques added inline comments.May 12 2020, 2:00 AM
clang/lib/CodeGen/TargetInfo.cpp
10241–10242

Do you have tests that show the impact of the added FLen >= Size && ArgFPRsLeft conditions for other values besides complex floats?

asb accepted this revision.May 14 2020, 2:43 AM

Good catch, thanks for the fix! The logic was incorrectly written assuming isFloatingType would return false for complex values which is of course incorrect.

clang/lib/CodeGen/TargetInfo.cpp
10241–10242

That's actually not an added clause - it's just been clang-formatted onto a new line.

This revision is now accepted and ready to land.May 14 2020, 2:43 AM
This revision was automatically updated to reflect the committed changes.