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

Pengfei Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 18:02:19 PST 2021


pengfei requested changes to this revision.
pengfei added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2821
+    } else if (k == BuiltinType::Float16 || k == BuiltinType::Half) {
+      // AMD64 does not support _Float16 or __fp16. When used in
+      // languages supporting it, _Float16 or __fp16 is for storage only,
----------------
It's true that AMD64 does not support _Float16, but __fp16 is supported on every target.
See https://clang.llvm.org/docs/LanguageExtensions.html#half-precision-floating-point


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2822
+      // AMD64 does not support _Float16 or __fp16. When used in
+      // languages supporting it, _Float16 or __fp16 is for storage only,
+      // which is equivalent to 16 bit integer. We need this to interop with
----------------
__fp16 is storage format while _Float16 isn't.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2824
+      // which is equivalent to 16 bit integer. We need this to interop with
+      // gcc where 16 bit integer is used in place of _Float16 or __fp16.
+      Lo = Integer;
----------------
The GCC should take _Floatn as floating types, see https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Floating-Types.html#Floating-Types
Can you provide the information how gcc uses as 16 bit integer for _Float16?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97318/new/

https://reviews.llvm.org/D97318



More information about the cfe-commits mailing list