[PATCH] D97318: [clang][CodeGen] Allow fp16 arg pass by register

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 11:45:38 PST 2021


yaxunl created this revision.
yaxunl added a reviewer: rjmccall.
Herald added a subscriber: pengfei.
yaxunl requested review of this revision.

HIP supports _Float16 and __fp16 types. In x86_64 host they are for storage
only. Since they have the same size and alignment as int16, they are supposed
to be passed by value in the same way as int16. Currently clang pass them
by stack when included in a struct, which is not efficient. This also causes
interoperability difficulty with gcc. On gcc since there is no _Float16 type,
int16 is used as replacement for _Float16 for passing arguments, which is
passed by register.

This patch changes x86_64 target codegen info so that _Float16 and __fp16
can be passed by register.


https://reviews.llvm.org/D97318

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGenCUDA/float16.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97318.325852.patch
Type: text/x-patch
Size: 4766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210223/d3d7d657/attachment.bin>


More information about the cfe-commits mailing list