aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-11-04 13:22:10 +0000
committerGitHub <noreply@github.com>2022-11-04 13:22:10 +0000
commit0a59abbfc74c3961fb01323d9fbff8427518fde6 (patch)
treeb17389116bc4da1d022345b7b78eb6fc0fbe4eb0 /libcpp/expr.cc
parentf8c2fab0c6c11f73fdcb1eb31e8b5b75c2fdbf7f (diff)
parenta7b70c704182db2defd0c0f991c16f4d9219bc2f (diff)
downloadgcc-0a59abbfc74c3961fb01323d9fbff8427518fde6.zip
gcc-0a59abbfc74c3961fb01323d9fbff8427518fde6.tar.gz
gcc-0a59abbfc74c3961fb01323d9fbff8427518fde6.tar.bz2
Merge #1627
1627: Merge GCC mainline/master into gccrs/master r=CohenArthur a=ibuclaw `@doko42` was asking, so here's another merge sync. Co-authored-by: GCC Administrator <gccadmin@gcc.gnu.org> Co-authored-by: Andrew MacLeod <amacleod@redhat.com> Co-authored-by: Liwei Xu <liwei.xu@intel.com> Co-authored-by: Richard Biener <rguenther@suse.de> Co-authored-by: Jakub Jelinek <jakub@redhat.com> Co-authored-by: Andre Vieira <andre.simoesdiasvieira@arm.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com> Co-authored-by: Martin Jambor <mjambor@suse.cz> Co-authored-by: Joseph Myers <joseph@codesourcery.com> Co-authored-by: Patrick Palka <ppalka@redhat.com> Co-authored-by: Florian Weimer <fweimer@redhat.com> Co-authored-by: Marek Polacek <polacek@redhat.com> Co-authored-by: liuhongt <hongtao.liu@intel.com> Co-authored-by: Martin Liska <mliska@suse.cz> Co-authored-by: Robin Dapp <rdapp@linux.ibm.com> Co-authored-by: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> Co-authored-by: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Diffstat (limited to 'libcpp/expr.cc')
-rw-r--r--libcpp/expr.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/libcpp/expr.cc b/libcpp/expr.cc
index 1d68064..5ee28c4 100644
--- a/libcpp/expr.cc
+++ b/libcpp/expr.cc
@@ -91,10 +91,10 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
size_t orig_len = len;
const uchar *orig_s = s;
size_t flags;
- size_t f, d, l, w, q, i, fn, fnx, fn_bits;
+ size_t f, d, l, w, q, i, fn, fnx, fn_bits, bf16;
flags = 0;
- f = d = l = w = q = i = fn = fnx = fn_bits = 0;
+ f = d = l = w = q = i = fn = fnx = fn_bits = bf16 = 0;
/* The following decimal float suffixes, from TR 24732:2009, TS
18661-2:2015 and C2X, are supported:
@@ -131,7 +131,8 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
w, W - machine-specific type such as __float80 (GNU extension).
q, Q - machine-specific type such as __float128 (GNU extension).
fN, FN - _FloatN (TS 18661-3:2015).
- fNx, FNx - _FloatNx (TS 18661-3:2015). */
+ fNx, FNx - _FloatNx (TS 18661-3:2015).
+ bf16, BF16 - std::bfloat16_t (ISO C++23). */
/* Process decimal float suffixes, which are two letters starting
with d or D. Order and case are significant. */
@@ -239,6 +240,19 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
fn++;
}
break;
+ case 'b': case 'B':
+ if (len > 2
+ /* Except for bf16 / BF16 where case is significant. */
+ && s[1] == (s[0] == 'b' ? 'f' : 'F')
+ && s[2] == '1'
+ && s[3] == '6')
+ {
+ bf16++;
+ len -= 3;
+ s += 3;
+ break;
+ }
+ return 0;
case 'd': case 'D': d++; break;
case 'l': case 'L': l++; break;
case 'w': case 'W': w++; break;
@@ -257,7 +271,7 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
of N larger than can be represented in the return value. The
caller is responsible for rejecting _FloatN suffixes where
_FloatN is not supported on the chosen target. */
- if (f + d + l + w + q + fn + fnx > 1 || i > 1)
+ if (f + d + l + w + q + fn + fnx + bf16 > 1 || i > 1)
return 0;
if (fn_bits > CPP_FLOATN_MAX)
return 0;
@@ -295,6 +309,7 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
q ? CPP_N_MD_Q :
fn ? CPP_N_FLOATN | (fn_bits << CPP_FLOATN_SHIFT) :
fnx ? CPP_N_FLOATNX | (fn_bits << CPP_FLOATN_SHIFT) :
+ bf16 ? CPP_N_BFLOAT16 :
CPP_N_DEFAULT));
}