aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2017-01-27 02:45:32 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2017-01-26 19:45:32 -0700
commit0fb9ec83c38887a5b1da7376873506ae59b2c60e (patch)
treea9b1d8c981798fe12d8087eaba24062985520177
parentc1c3f4f25d15ab546e8a3f95adb4eb70f15d47bc (diff)
downloadgcc-0fb9ec83c38887a5b1da7376873506ae59b2c60e.zip
gcc-0fb9ec83c38887a5b1da7376873506ae59b2c60e.tar.gz
gcc-0fb9ec83c38887a5b1da7376873506ae59b2c60e.tar.bz2
gimple-ssa-sprintf.c (format_floating): Simplify the computation of precision to avoid preprocessor conditional.
gcc/ChangeLog: * gimple-ssa-sprintf.c (format_floating): Simplify the computation of precision to avoid preprocessor conditional. From-SVN: r244961
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-ssa-sprintf.c18
2 files changed, 9 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ac9a89f..c625d7b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-01-26 Martin Sebor <msebor@redhat.com>
+ * gimple-ssa-sprintf.c (format_floating): Simplify the computation
+ of precision.
+
+2017-01-26 Martin Sebor <msebor@redhat.com>
+
* gimple-ssa-sprintf.c (format_floating): Test HAVE_XFmode and
HAVE_DFmode before using XFmode or DFmode.
(parse_directive): Avoid using the z length modifier to avoid
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 65144ac..bd15a39 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1686,20 +1686,10 @@ format_floating (const directive &dir, tree arg)
prec[0] = -1;
if (prec[1] < 0)
{
-#ifdef HAVE_XFmode
- /* When L is specified use long double, otherwise double. */
- unsigned fmtprec
- = (dir.modifier == FMT_LEN_L
- ? REAL_MODE_FORMAT (XFmode)->p
- : REAL_MODE_FORMAT (DFmode)->p);
-#elif defined HAVE_DFmode
- /* No long double support, use double precision for both. */
- unsigned fmtprec = REAL_MODE_FORMAT (DFmode)->p;
-#else
- /* No long double or double support. */
- unsigned fmtprec = 0;
-#endif
- /* The precision of the IEEE 754 double format is 53.
+ unsigned fmtprec
+ = REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg)))->p;
+
+ /* The precision of the IEEE 754 double format is 53.
The precision of all other GCC binary double formats
is 56 or less. */
prec[1] = fmtprec <= 56 ? 13 : 15;