1 Star 0 Fork 59

qingxiyingyue/binutils

forked from src-openEuler/binutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0021-x86-introduce-.hfloat-directive.patch 4.50 KB
一键复制 编辑 原始数据 按行查看 历史
dingguangya 提交于 2022-08-11 09:54 . Enable Intel AVX512_FP16 instructions
From 7d19d096292acac01d0fde4d99c3e49d69688e03 Mon Sep 17 00:00:00 2001
From: Jan Beulich <jbeulich@suse.com>
Date: Wed, 11 Aug 2021 08:32:54 +0200
Subject: [PATCH] x86: introduce .hfloat directive
This is to be able to generate data passed to {,V}CVTPH2PS and acted
upon by AVX512-FP16 insns. To be able to also use the hex forms
supported for other floating point formats, a small addition to the
generic hex_float() is needed.
Extend existing x86 testcases.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0fa8b0d5a04..a9e36213390 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -512,7 +512,7 @@ const char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant
As in 0f12.456
or 0d1.2345e12. */
-const char FLT_CHARS[] = "fFdDxX";
+const char FLT_CHARS[] = "fFdDxXhH";
/* Tables for lexical analysis. */
static char mnemonic_chars[256];
@@ -1356,6 +1356,7 @@ const pseudo_typeS md_pseudo_table[] =
{"ffloat", float_cons, 'f'},
{"dfloat", float_cons, 'd'},
{"tfloat", float_cons, 'x'},
+ {"hfloat", float_cons, 'h'},
{"value", cons, 2},
{"slong", signed_cons, 4},
{"noopt", s_ignore, 0},
diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi
index 9058ad444b0..664237c75c9 100644
--- a/gas/doc/c-i386.texi
+++ b/gas/doc/c-i386.texi
@@ -1313,18 +1313,21 @@ data type. Constructors build these data types into memory.
@cindex @code{single} directive, i386
@cindex @code{double} directive, i386
@cindex @code{tfloat} directive, i386
+@cindex @code{hfloat} directive, i386
@cindex @code{float} directive, x86-64
@cindex @code{single} directive, x86-64
@cindex @code{double} directive, x86-64
@cindex @code{tfloat} directive, x86-64
+@cindex @code{hfloat} directive, x86-64
@itemize @bullet
@item
Floating point constructors are @samp{.float} or @samp{.single},
-@samp{.double}, and @samp{.tfloat} for 32-, 64-, and 80-bit formats.
-These correspond to instruction mnemonic suffixes @samp{s}, @samp{l},
-and @samp{t}. @samp{t} stands for 80-bit (ten byte) real. The 80387
-only supports this format via the @samp{fldt} (load 80-bit real to stack
-top) and @samp{fstpt} (store 80-bit real and pop stack) instructions.
+@samp{.double}, @samp{.tfloat}, and @samp{.hfloat} for 32-, 64-, 80-, and
+16-bit formats respectively. The former three correspond to instruction
+mnemonic suffixes @samp{s}, @samp{l}, and @samp{t}. @samp{t} stands for
+80-bit (ten byte) real. The 80387 only supports this format via the
+@samp{fldt} (load 80-bit real to stack top) and @samp{fstpt} (store 80-bit
+real and pop stack) instructions.
@cindex @code{word} directive, i386
@cindex @code{long} directive, i386
diff --git a/gas/read.c b/gas/read.c
index b8e845dd569..4170a254030 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -4852,6 +4852,11 @@ hex_float (int float_type, char *bytes)
switch (float_type)
{
+ case 'h':
+ case 'H':
+ length = 2;
+ break;
+
case 'f':
case 'F':
case 's':
diff --git a/gas/testsuite/gas/i386/fp-elf32.d b/gas/testsuite/gas/i386/fp-elf32.d
index eefe84db310..d25eed8b8ef 100644
--- a/gas/testsuite/gas/i386/fp-elf32.d
+++ b/gas/testsuite/gas/i386/fp-elf32.d
@@ -14,3 +14,4 @@ Contents of section .data:
0060 00000000 00000080 fe3f0000 00000000 .*
0070 00000080 fdbf0000 00000000 00000080 .*
0080 ff030000 aaaaaaaa aaaaaaaa aaaaaaaa .*
+ 0090 003c00c0 003c5555 55555555 55555555 .*
diff --git a/gas/testsuite/gas/i386/fp-elf64.d b/gas/testsuite/gas/i386/fp-elf64.d
index 0756aa1e36a..bdc8f86662e 100644
--- a/gas/testsuite/gas/i386/fp-elf64.d
+++ b/gas/testsuite/gas/i386/fp-elf64.d
@@ -14,3 +14,4 @@ Contents of section .data:
0060 00000000 00000080 fe3f0000 00000000 .*
0070 00000000 00000080 fdbf0000 00000000 .*
0080 00000000 00000080 ff030000 00000000 .*
+ 0090 003c00c0 003c5555 55555555 55555555 .*
diff --git a/gas/testsuite/gas/i386/fp.d b/gas/testsuite/gas/i386/fp.d
index b93595ac8c3..65a5fccd6ee 100644
--- a/gas/testsuite/gas/i386/fp.d
+++ b/gas/testsuite/gas/i386/fp.d
@@ -12,3 +12,4 @@ Contents of section .data:
0050 ffffffff ffffffff ffffcccc cccccccc .*
0060 00000000 00000080 fe3f0000 00000000 .*
0070 0080fdbf 00000000 00000080 ff03aaaa .*
+ 0080 003c00c0 003c5555 55555555 55555555 .*
diff --git a/gas/testsuite/gas/i386/fp.s b/gas/testsuite/gas/i386/fp.s
index 7fe642e5180..8976dd82f60 100644
--- a/gas/testsuite/gas/i386/fp.s
+++ b/gas/testsuite/gas/i386/fp.s
@@ -29,3 +29,6 @@
.dc.x 0x:bffd80
.dcb.x 1, 0x:03ff80
.p2align 4,0xaa
+
+ .hfloat 1, -2, 0x:3c00
+ .p2align 4,0x55
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qingxiyingyue/binutils.git
git@gitee.com:qingxiyingyue/binutils.git
qingxiyingyue
binutils
binutils
master

搜索帮助