@@ -137,6 +137,7 @@
; lxvrse Needs special handling for load-rightmost, sign-extended
; lxvrze Needs special handling for load-rightmost, zero-extended
; endian Needs special handling for endianness
+; ibmld Restrict usage to the case when TFmode is IBM-128
;
; Each attribute corresponds to extra processing required when
; the built-in is expanded. All such special processing should
@@ -215,13 +216,8 @@
double __builtin_mffsl ();
MFFSL rs6000_mffsl {}
-; This thing really assumes long double == __ibm128, and I'm told it has
-; been used as such within libgcc. Given that __builtin_pack_ibm128
-; exists for the same purpose, this should really not be used at all.
-; TODO: Consider adding special handling for this to warn whenever
-; long double is not __ibm128.
const long double __builtin_pack_longdouble (double, double);
- PACK_TF packtf {}
+ PACK_TF packtf {ibmld}
unsigned long __builtin_ppc_mftb ();
MFTB rs6000_mftb_di {32bit}
@@ -244,9 +240,8 @@
const double __builtin_unpack_ibm128 (__ibm128, const int<1>);
UNPACK_IF unpackif {}
-; See above comments for __builtin_pack_longdouble.
const double __builtin_unpack_longdouble (long double, const int<1>);
- UNPACK_TF unpacktf {}
+ UNPACK_TF unpacktf {ibmld}
; Builtins that have been around just about forever, but not quite.
@@ -15741,6 +15741,13 @@ rs6000_expand_new_builtin (tree exp, rtx target,
return const0_rtx;
}
+ if (bif_is_ibmld (*bifaddr) && !FLOAT128_2REG_P (TFmode))
+ {
+ error ("%<%s%> requires long double to be IBM 128-bit format",
+ bifaddr->bifname);
+ return const0_rtx;
+ }
+
if (bif_is_cpu (*bifaddr))
return new_cpu_expand_builtin (fcode, exp, target);
@@ -92,6 +92,7 @@ along with GCC; see the file COPYING3. If not see
lxvrse Needs special handling for load-rightmost, sign-extended
lxvrze Needs special handling for load-rightmost, zero-extended
endian Needs special handling for endianness
+ ibmld Restrict usage to the case when TFmode is IBM-128
An example stanza might look like this:
@@ -390,6 +391,7 @@ struct attrinfo
bool islxvrse;
bool islxvrze;
bool isendian;
+ bool isibmld;
};
/* Fields associated with a function prototype (bif or overload). */
@@ -1435,6 +1437,8 @@ parse_bif_attrs (attrinfo *attrptr)
attrptr->islxvrze = 1;
else if (!strcmp (attrname, "endian"))
attrptr->isendian = 1;
+ else if (!strcmp (attrname, "ibmld"))
+ attrptr->isibmld = 1;
else
{
diag (oldpos, "unknown attribute.\n");
@@ -1468,14 +1472,14 @@ 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.\n",
+ "lxvrse = %d, lxvrze = %d, endian = %d, ibmdld= %d.\n",
attrptr->isinit, attrptr->isset, attrptr->isextract,
attrptr->isnosoft, attrptr->isldvec, attrptr->isstvec,
attrptr->isreve, attrptr->ispred, attrptr->ishtm, attrptr->ishtmspr,
attrptr->ishtmcr, attrptr->ismma, attrptr->isquad, attrptr->ispair,
attrptr->ismmaint, attrptr->isno32bit, attrptr->is32bit,
attrptr->iscpu, attrptr->isldstmask, attrptr->islxvrse,
- attrptr->islxvrze, attrptr->isendian);
+ attrptr->islxvrze, attrptr->isendian, attrptr->isibmld);
#endif
return PC_OK;
@@ -2289,6 +2293,7 @@ write_decls (void)
fprintf (header_file, "#define bif_lxvrse_bit\t\t(0x00080000)\n");
fprintf (header_file, "#define bif_lxvrze_bit\t\t(0x00100000)\n");
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, "\n");
fprintf (header_file,
"#define bif_is_init(x)\t\t((x).bifattrs & bif_init_bit)\n");
@@ -2334,6 +2339,8 @@ write_decls (void)
"#define bif_is_lxvrze(x)\t((x).bifattrs & bif_lxvrze_bit)\n");
fprintf (header_file,
"#define bif_is_endian(x)\t((x).bifattrs & bif_endian_bit)\n");
+ fprintf (header_file,
+ "#define bif_is_ibmld(x)\t((x).bifattrs & bif_ibmld_bit)\n");
fprintf (header_file, "\n");
/* #### Note that the _x is added for now to avoid conflict with
@@ -2568,6 +2575,8 @@ write_bif_static_init (void)
fprintf (init_file, " | bif_lxvrze_bit");
if (bifp->attrs.isendian)
fprintf (init_file, " | bif_endian_bit");
+ if (bifp->attrs.isibmld)
+ fprintf (init_file, " | bif_ibmld_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],