[PATCH 05/11] x86: introduce .hfloat directive
H.J. Lu
hjl.tools@gmail.com
Fri Jul 23 13:20:38 GMT 2021
On Thu, Jul 22, 2021 at 11:54 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> 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.
OK if all prerequisites have been approved. Thanks.
> ---
> I wonder whether introduction (in generic code) of .{dc,dcb,ds}.h
> directives wouldn't be warranted. The format not being supported by all
> architectures if no different from, in particular, the .x or .p forms.
If they aren't used for all architectures, keep them to x86.
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -511,7 +511,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];
> @@ -1352,6 +1352,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},
> --- a/gas/doc/c-i386.texi
> +++ b/gas/doc/c-i386.texi
> @@ -1311,18 +1311,21 @@ data type. Constructors build these dat
> @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
> --- 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':
> --- 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 .*
> --- 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 .*
> --- 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 .*
> --- 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
>
--
H.J.
More information about the Binutils
mailing list