public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work092)] Add builtin ieeeld for long double is IEEE 128-bit.
@ 2022-06-28 20:04 Michael Meissner
0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2022-06-28 20:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:97eb29cc1d61a5a0bb33dd7891a93c72c05750f3
commit 97eb29cc1d61a5a0bb33dd7891a93c72c05750f3
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Tue Jun 28 16:04:04 2022 -0400
Add builtin ieeeld for long double is IEEE 128-bit.
2022-06-28 Michael Meissner <meissner@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Add
check for ieeeld.
* config/rs6000/rs6000-builtins.def (ieeeld): New attribute.
(__builtin_addf128_round_to_odd_tf): Add ieeeld.
(__builtin_divf128_round_to_odd_tf): Likewise.
(__builtin_fmaf128_round_to_odd_tf): Likewise.
(__builtin_mulf128_round_to_odd_tf): Likewise.
(__builtin_sqrtf128_round_to_odd_tf): Likewise.
(__builtin_subf128_round_to_odd_tf): Likewise.
(__builtin_truncf128_round_to_odd_tf): Likewise.
* config/rs6000/rs6000-gen-builtins.c (ieeeld): New attribute.
(struct attrinfo): Add ieeeld.
(parse_bif_attrs): Likewise.
(write_decls): Likewise.
(write_bif_static_init): Likewise.
Diff:
---
gcc/config/rs6000/rs6000-builtin.cc | 7 +++++++
gcc/config/rs6000/rs6000-builtins.def | 15 ++++++++-------
gcc/config/rs6000/rs6000-gen-builtins.cc | 14 ++++++++++++--
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index 7e027bed7a1..9b66870d5d5 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -3421,6 +3421,13 @@ rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
return const0_rtx;
}
+ if (bif_is_ieeeld (*bifaddr) && !FLOAT128_IEEE_P (TFmode))
+ {
+ error ("%qs requires %<long double%> to be IEEE 128-bit format",
+ bifaddr->bifname);
+ return const0_rtx;
+ }
+
if (bif_is_cpu (*bifaddr))
return cpu_expand_builtin (fcode, exp, target);
diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def
index 1be2bcd1ff0..fbaad60ccbb 100644
--- a/gcc/config/rs6000/rs6000-builtins.def
+++ b/gcc/config/rs6000/rs6000-builtins.def
@@ -139,6 +139,7 @@
; endian Needs special handling for endianness
; ibmld Restrict usage to the case when TFmode is IBM-128
; ibm128 Restrict usage to the case where __ibm128 is supported or if ibmld
+; ieeeld Restrict usage to the case when TFmode is IEEE-128
;
; Each attribute corresponds to extra processing required when
; the built-in is expanded. All such special processing should
@@ -2926,29 +2927,29 @@
; must use the IEEE 128-bit encoding.
[ieee128-hw-ld]
fpmath long double __builtin_addf128_round_to_odd_tf (long double, long double);
- ADDF128_ODD_TF addtf3_odd {}
+ ADDF128_ODD_TF addtf3_odd {ieeeld}
fpmath long double __builtin_divf128_round_to_odd_tf (long double,long double);
- DIVF128_ODD_TF divtf3_odd {}
+ DIVF128_ODD_TF divtf3_odd {ieeeld}
fpmath long double __builtin_fmaf128_round_to_odd_tf (long double, \
long double, \
long double);
- FMAF128_ODD_TF fmatf4_odd {}
+ FMAF128_ODD_TF fmatf4_odd {ieeeld}
fpmath long double __builtin_mulf128_round_to_odd_tf (long double, \
long double);
- MULF128_ODD_TF multf3_odd {}
+ MULF128_ODD_TF multf3_odd {ieeeld}
fpmath long double __builtin_sqrtf128_round_to_odd_tf (long double);
- SQRTF128_ODD_TF sqrttf2_odd {}
+ SQRTF128_ODD_TF sqrttf2_odd {ieeeld}
fpmath long double __builtin_subf128_round_to_odd_tf (long double, \
long double);
- SUBF128_ODD_TF subtf3_odd {}
+ SUBF128_ODD_TF subtf3_odd {ieeeld}
fpmath double __builtin_truncf128_round_to_odd_tf (long double);
- TRUNCF128_ODD_TF trunctfdf2_odd {}
+ TRUNCF128_ODD_TF trunctfdf2_odd {ieeeld}
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.cc b/gcc/config/rs6000/rs6000-gen-builtins.cc
index be1dc86ceb4..b939e04c258 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.cc
+++ b/gcc/config/rs6000/rs6000-gen-builtins.cc
@@ -95,6 +95,7 @@ along with GCC; see the file COPYING3. If not see
ibmld Restrict usage to the case when TFmode is IBM-128
ibm128 Restrict usage to the case where __ibm128 is supported or
if ibmld
+ ieeeld Restrict usage to the case when TFmode is IEEE-128
An example stanza might look like this:
@@ -398,6 +399,7 @@ struct attrinfo
bool isendian;
bool isibmld;
bool isibm128;
+ bool isieeeld;
};
/* Fields associated with a function prototype (bif or overload). */
@@ -1447,6 +1449,8 @@ parse_bif_attrs (attrinfo *attrptr)
attrptr->isibmld = 1;
else if (!strcmp (attrname, "ibm128"))
attrptr->isibm128 = 1;
+ else if (!strcmp (attrname, "ieeeld"))
+ attrptr->isieeeld = 1;
else
{
diag (oldpos, "unknown attribute.\n");
@@ -1480,7 +1484,8 @@ parse_bif_attrs (attrinfo *attrptr)
"ldvec = %d, stvec = %d, reve = %d, pred = %d, htm = %d, "
"htmspr = %d, htmcr = %d, mma = %d, quad = %d, pair = %d, "
"mmaint = %d, no32bit = %d, 32bit = %d, cpu = %d, ldstmask = %d, "
- "lxvrse = %d, lxvrze = %d, endian = %d, ibmdld = %d, ibm128 = %d.\n",
+ "lxvrse = %d, lxvrze = %d, endian = %d, ibmdld = %d, ibm128 = %d, "
+ "ieeeld = %d.\n",
attrptr->isinit, attrptr->isset, attrptr->isextract,
attrptr->isnosoft, attrptr->isldvec, attrptr->isstvec,
attrptr->isreve, attrptr->ispred, attrptr->ishtm, attrptr->ishtmspr,
@@ -1488,7 +1493,7 @@ parse_bif_attrs (attrinfo *attrptr)
attrptr->ismmaint, attrptr->isno32bit, attrptr->is32bit,
attrptr->iscpu, attrptr->isldstmask, attrptr->islxvrse,
attrptr->islxvrze, attrptr->isendian, attrptr->isibmld,
- attrptr->isibm128);
+ attrptr->isibm128, attrptr->isieeeld);
#endif
return PC_OK;
@@ -2305,6 +2310,7 @@ write_decls (void)
fprintf (header_file, "#define bif_endian_bit\t\t(0x00200000)\n");
fprintf (header_file, "#define bif_ibmld_bit\t\t(0x00400000)\n");
fprintf (header_file, "#define bif_ibm128_bit\t\t(0x00800000)\n");
+ fprintf (header_file, "#define bif_ieeeld_bit\t\t(0x01000000)\n");
fprintf (header_file, "\n");
fprintf (header_file,
"#define bif_is_init(x)\t\t((x).bifattrs & bif_init_bit)\n");
@@ -2354,6 +2360,8 @@ write_decls (void)
"#define bif_is_ibmld(x)\t((x).bifattrs & bif_ibmld_bit)\n");
fprintf (header_file,
"#define bif_is_ibm128(x)\t((x).bifattrs & bif_ibm128_bit)\n");
+ fprintf (header_file,
+ "#define bif_is_ieeeld(x)\t((x).bifattrs & bif_ieeeld_bit)\n");
fprintf (header_file, "\n");
fprintf (header_file,
@@ -2552,6 +2560,8 @@ write_bif_static_init (void)
fprintf (init_file, " | bif_ibmld_bit");
if (bifp->attrs.isibm128)
fprintf (init_file, " | bif_ibm128_bit");
+ if (bifp->attrs.isieeeld)
+ fprintf (init_file, " | bif_ieeeld_bit");
fprintf (init_file, ",\n");
fprintf (init_file, " /* restr_opnd */\t{%d, %d, %d},\n",
bifp->proto.restr_opnd[0], bifp->proto.restr_opnd[1],
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-28 20:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 20:04 [gcc(refs/users/meissner/heads/work092)] Add builtin ieeeld for long double is IEEE 128-bit Michael Meissner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).