From 0b99a66053fa1e93a984f75a7a3d5343c74882fb Mon Sep 17 00:00:00 2001 From: Felix Willgerodt Date: Fri, 9 Jul 2021 15:39:41 +0200 Subject: gdb: Enable finish command and inferior calls for _Float16 on amd64 and i386. Values of type _Float16 and _Float16 _Complex can now be used on CPUs with AVX512-FP16 support. Return values of those types are located in XMM0. Compiler support for gcc and clang is in progress, see e.g.: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574117.html gdb/ChangeLog: 2021-07-21 Felix Willgerodt * amd64-tdep.c (amd64_classify): Classify _Float16 and _Float16 _Complex as AMD64_SSE. * i386-tdep.c (i386_extract_return_value): Read _Float16 and _Float16 _Complex from xmm0. gdb/testsuite/ChangeLog: 2021-07-21 Felix Willgerodt * gdb.arch/x86-avx512fp16-abi.c: New file. * gdb.arch/x86-avx512fp16-abi.exp: New file. --- gdb/i386-tdep.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gdb/i386-tdep.c') diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index c2835a2..a9c4292 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2818,7 +2818,14 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type, int len = TYPE_LENGTH (type); gdb_byte buf[I386_MAX_REGISTER_SIZE]; - if (type->code () == TYPE_CODE_FLT) + /* _Float16 and _Float16 _Complex values are returned via xmm0. */ + if (((type->code () == TYPE_CODE_FLT) && len == 2) + || ((type->code () == TYPE_CODE_COMPLEX) && len == 4)) + { + regcache->raw_read (I387_XMM0_REGNUM (tdep), valbuf); + return; + } + else if (type->code () == TYPE_CODE_FLT) { if (tdep->st0_regnum < 0) { -- cgit v1.1