aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-08-11 08:32:54 +0200
committerJan Beulich <jbeulich@suse.com>2021-08-11 08:32:54 +0200
commit7d19d096292acac01d0fde4d99c3e49d69688e03 (patch)
tree5b691ba4679786fb0e8aae2a4e328e2e601b91b6 /gas
parent8f2200fe8e7f17295ed6d9bbc908da533c95e089 (diff)
downloadgdb-7d19d096292acac01d0fde4d99c3e49d69688e03.zip
gdb-7d19d096292acac01d0fde4d99c3e49d69688e03.tar.gz
gdb-7d19d096292acac01d0fde4d99c3e49d69688e03.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c3
-rw-r--r--gas/doc/c-i386.texi13
-rw-r--r--gas/read.c5
-rw-r--r--gas/testsuite/gas/i386/fp-elf32.d1
-rw-r--r--gas/testsuite/gas/i386/fp-elf64.d1
-rw-r--r--gas/testsuite/gas/i386/fp.d1
-rw-r--r--gas/testsuite/gas/i386/fp.s3
7 files changed, 21 insertions, 6 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0fa8b0d..a9e3621 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 9058ad4..664237c 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 b8e845d..4170a25 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 eefe84d..d25eed8 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 0756aa1..bdc8f86 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 b93595a..65a5fcc 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 7fe642e..8976dd8 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