aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr95450.c
blob: 569d2b2c536fe3421540da896f0d4da1a61d847c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* PR target/95450 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-not "return \[0-9.e+]\+;" "optimized" } } */

/* Verify this is not optimized for double double into return floating_point_constant,
   as while that constant is the maximum normalized floating point value, it needs
   107 bit precision, which is more than GCC supports for this format.  */

#if __LDBL_MANT_DIG__ == 106
union U
{
  struct { double hi; double lo; } dd;
  long double ld;
};

const union U g = { { __DBL_MAX__, __DBL_MAX__ / (double)134217728UL / (double)134217728UL } };
#else
struct S
{
  long double ld;
} g;
#endif

long double
foo (void)
{
  return g.ld;
}