From: Joseph Myers Date: Sun, 27 Nov 2005 01:40:01 +0000 (+0000) Subject: floatunsisf.c, [...]: New files. X-Git-Tag: releases/gcc-4.2.0~5733 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a3ebe774cfd41fa47a986ad679381aa3dcf7b76;p=thirdparty%2Fgcc.git floatunsisf.c, [...]: New files. * config/floatunsisf.c, config/floatunsidf.c, config/floatunsixf.c, config/floatunsitf.c: New files. * config/ia64/t-hpux: Add floatunsitf.c. * config/ia64/ia64.c (ia64_init_libfuncs): Use _U_Qfcnvxuf_dbl_to_quad for unsigned DImode-to-TFmode conversion. From-SVN: r107558 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ee870db5a20..b654b62da7b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-11-27 Joseph S. Myers + + * config/floatunsisf.c, config/floatunsidf.c, + config/floatunsixf.c, config/floatunsitf.c: New files. + * config/ia64/t-hpux: Add floatunsitf.c. + * config/ia64/ia64.c (ia64_init_libfuncs): Use + _U_Qfcnvxuf_dbl_to_quad for unsigned DImode-to-TFmode conversion. + 2005-11-26 Richard Henderson * c-lex.c (pragma_lex): Rename from c_lex. diff --git a/gcc/config/floatunsidf.c b/gcc/config/floatunsidf.c new file mode 100644 index 000000000000..ff28112502b7 --- /dev/null +++ b/gcc/config/floatunsidf.c @@ -0,0 +1,15 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef float DFtype __attribute__ ((mode (DF))); + +DFtype +__floatunsidf (USItype u) +{ + SItype s = (SItype) u; + DFtype r = (DFtype) s; + if (s < 0) + r += (DFtype)2.0 * (DFtype) ((USItype) 1 + << (sizeof (USItype) * __CHAR_BIT__ - 1)); + return r; +} diff --git a/gcc/config/floatunsisf.c b/gcc/config/floatunsisf.c new file mode 100644 index 000000000000..11d4aa78cbe2 --- /dev/null +++ b/gcc/config/floatunsisf.c @@ -0,0 +1,18 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef float SFtype __attribute__ ((mode (SF))); + +SFtype +__floatunsisf (USItype u) +{ + SItype s = (SItype) u; + if (s < 0) + { + /* As in expand_float, compute (u & 1) | (u >> 1) to ensure + correct rounding if a nonzero bit is shifted out. */ + return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1)); + } + else + return (SFtype) s; +} diff --git a/gcc/config/floatunsitf.c b/gcc/config/floatunsitf.c new file mode 100644 index 000000000000..955d67666c5b --- /dev/null +++ b/gcc/config/floatunsitf.c @@ -0,0 +1,15 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef float TFtype __attribute__ ((mode (TF))); + +TFtype +__floatunsitf (USItype u) +{ + SItype s = (SItype) u; + TFtype r = (TFtype) s; + if (s < 0) + r += (TFtype)2.0 * (TFtype) ((USItype) 1 + << (sizeof (USItype) * __CHAR_BIT__ - 1)); + return r; +} diff --git a/gcc/config/floatunsixf.c b/gcc/config/floatunsixf.c new file mode 100644 index 000000000000..52511688dad3 --- /dev/null +++ b/gcc/config/floatunsixf.c @@ -0,0 +1,15 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef float XFtype __attribute__ ((mode (XF))); + +XFtype +__floatunsixf (USItype u) +{ + SItype s = (SItype) u; + XFtype r = (XFtype) s; + if (s < 0) + r += (XFtype)2.0 * (XFtype) ((USItype) 1 + << (sizeof (USItype) * __CHAR_BIT__ - 1)); + return r; +} diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index b11583d19a70..72676255c007 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -8437,6 +8437,9 @@ ia64_init_libfuncs (void) set_conv_libfunc (sfloat_optab, TFmode, SImode, "_U_Qfcnvxf_sgl_to_quad"); set_conv_libfunc (sfloat_optab, TFmode, DImode, "_U_Qfcnvxf_dbl_to_quad"); + /* HP-UX 11.23 libc does not have a function for unsigned + SImode-to-TFmode conversion. */ + set_conv_libfunc (ufloat_optab, TFmode, DImode, "_U_Qfcnvxuf_dbl_to_quad"); } /* Rename all the TFmode libfuncs using the HPUX conventions. */ diff --git a/gcc/config/ia64/t-hpux b/gcc/config/ia64/t-hpux index 2897739fda1b..7d294d17457c 100644 --- a/gcc/config/ia64/t-hpux +++ b/gcc/config/ia64/t-hpux @@ -9,7 +9,7 @@ MULTILIB_MATCHES = # Support routines for HP-UX 128 bit floats. -LIB2FUNCS_EXTRA=quadlib.c +LIB2FUNCS_EXTRA=quadlib.c $(srcdir)/config/floatunsitf.c quadlib.c: $(srcdir)/config/ia64/quadlib.c cat $(srcdir)/config/ia64/quadlib.c > quadlib.c