aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/excess-precision-8.c
blob: c0a31ed5f4ecf12203c13378ac136d76100ac076 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Excess precision tests.  Test C11 semantics for conversions from
   integers to floating point: no excess precision for either explicit
   conversions, but excess precision for implicit conversions.  */
/* { dg-do run } */
/* { dg-options "-std=c11 -mfpmath=387 -fexcess-precision=standard" } */

extern void abort (void);
extern void exit (int);

int
main (void)
{
  float f = 1.0f;
  int i;

  i = 0x10001234;
  if ((float) i != 0x10001240)
    abort ();

  i = 0x10001234;
  i += f;
  if (i != 0x10001235)
    abort ();

  i = 0x10001234;
  i += 1.0f;
  if (i != 0x10001235)
    abort ();

  i = 0x10001234;
  i = i + f;
  if (i != 0x10001235)
    abort ();

  i = 0x10001234;
  i = i + 1.0f;
  if (i != 0x10001235)
    abort ();

  i = 0x10001235;
  i = (1 ? i : 1.0f);
  if (i != 0x10001235)
    abort ();

  i = 0x10001235;
  i = (1 ? i : f);
  if (i != 0x10001235)
    abort ();

  i = 0x10001235;
  i = (0 ? 1.0f :i);
  if (i != 0x10001235)
    abort ();

  i = 0x10001235;
  i = (0 ? f : i);
  if (i != 0x10001235)
    abort ();

  exit (0);
}