diff options
author | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:33:49 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2021-08-11 08:33:49 +0200 |
commit | de133cf98cdf4cb3d1461ef10c83ce72df7399c7 (patch) | |
tree | 1ea3411b55f5020dcd47dbb71523a872338d4d6d /gas/config | |
parent | 7d19d096292acac01d0fde4d99c3e49d69688e03 (diff) | |
download | gdb-de133cf98cdf4cb3d1461ef10c83ce72df7399c7.zip gdb-de133cf98cdf4cb3d1461ef10c83ce72df7399c7.tar.gz gdb-de133cf98cdf4cb3d1461ef10c83ce72df7399c7.tar.bz2 |
x86: introduce .bfloat16 directive
This is to be able to generate data acted upon by AVX512-BF16 and
AMX-BF16 insns. While not part of the IEEE standard, the format is
sufficiently standardized to warrant handling in config/atof-ieee.c.
Arm, where custom handling was implemented, may want to leverage this as
well. 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/config')
-rw-r--r-- | gas/config/atof-ieee.c | 20 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 3 |
2 files changed, 18 insertions, 5 deletions
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c index e6e8879..7f95d05 100644 --- a/gas/config/atof-ieee.c +++ b/gas/config/atof-ieee.c @@ -27,6 +27,7 @@ extern FLONUM_TYPE generic_floating_point_number; /* Don't count the gap in the m68k extended precision format. */ #define MAX_PRECISION 5 #define H_PRECISION 1 +#define B_PRECISION 1 /* Not strictly IEEE, but handled here anyway. */ #define F_PRECISION 2 #define D_PRECISION 4 #define X_PRECISION 5 @@ -243,6 +244,12 @@ atof_ieee (char *str, /* Text to convert to binary. */ exponent_bits = 5; break; + case 'b': + case 'B': + precision = B_PRECISION; + exponent_bits = 8; + break; + case 'f': case 'F': case 's': @@ -368,9 +375,9 @@ gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits) as_warn (_("Infinities are not supported by this target")); /* +INF: Do the right thing. */ - if (precision == H_PRECISION) + if (precision == H_PRECISION /* also B_PRECISION */) { - words[0] = 0x7c00; + words[0] = exponent_bits == 5 ? 0x7c00 : 0x7f80; } else if (precision == F_PRECISION) { @@ -413,9 +420,9 @@ gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits) as_warn (_("Infinities are not supported by this target")); /* Negative INF. */ - if (precision == H_PRECISION) + if (precision == H_PRECISION /* also B_PRECISION */) { - words[0] = 0xfc00; + words[0] = exponent_bits == 5 ? 0xfc00 : 0xff80; } else if (precision == F_PRECISION) { @@ -777,6 +784,11 @@ ieee_md_atof (int type, prec = H_PRECISION; break; + case 'B': + case 'b': + prec = B_PRECISION; + break; + case 'f': case 'F': case 's': diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index a9e3621..dc29fa2 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[] = "fFdDxXhH"; +const char FLT_CHARS[] = "fFdDxXhHbB"; /* Tables for lexical analysis. */ static char mnemonic_chars[256]; @@ -1357,6 +1357,7 @@ const pseudo_typeS md_pseudo_table[] = {"dfloat", float_cons, 'd'}, {"tfloat", float_cons, 'x'}, {"hfloat", float_cons, 'h'}, + {"bfloat16", float_cons, 'b'}, {"value", cons, 2}, {"slong", signed_cons, 4}, {"noopt", s_ignore, 0}, |