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

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 08:28:08 PST 2021


hliao added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2821
+    } else if (k == BuiltinType::Float16 || k == BuiltinType::Half) {
+      // AMD64 does not support operations on _Float16 or __fp16 other than
+      // load and store. For load/store operations, _Float16 and __fp16 is
----------------
hliao wrote:
> pengfei wrote:
> > This is still not correct I think. As Clang dos says, _Float16 is not support (including load and store) unless ABI defines it.
> > We cannot add it before there's clear definition in the ABI.
> > See https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
> That's quite outdated spec. Please check the latest one from https://gitlab.com/x86-psABIs/x86-64-ABI, which classify _Float16 as SSE.
> That's quite outdated spec. Please check the latest one from https://gitlab.com/x86-psABIs/x86-64-ABI, which classify _Float16 as SSE.

>From the log

commit 71d1183e7bb95e9f8ad732e0f2b5a4f127796e2a (origin/usr/hjl/_Float16)
Author: H.J. Lu <hjl.tools at gmail.com>
Date:   Wed Feb 20 05:45:39 2019 -0800

    Add optional _Float16 support
    
    Pass and return _Float16 values in XMM registers.

diff --git a/x86-64-ABI/low-level-sys-info.tex b/x86-64-ABI/low-level-sys-info.tex
index ca84fff..0b06c56 100644
--- a/x86-64-ABI/low-level-sys-info.tex
+++ b/x86-64-ABI/low-level-sys-info.tex
@@ -25,7 +25,8 @@ object, and the term \emph{\textindex{\sixteenbyte{}}} refers to a
 \subsubsection{Fundamental Types}
 
 Figure~\ref{basic-types} shows the correspondence between ISO C's
-scalar types and the processor's.  \code{__int128}, \code{__float80},
+scalar types and the processor's.  \code{__int128}, \code{_Float16},
+\code{__float80},
 \code{__float128}, \code{__m64}, \code{__m128}, \code{__m256} and
 \code{__m512} types are optional.



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

https://reviews.llvm.org/D97318



More information about the cfe-commits mailing list