OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr45415.c] - Blame information for rev 753

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O1 -fno-tree-dominator-opts" } */
3
 
4
typedef unsigned long int st;
5
typedef unsigned long long dt;
6
typedef union
7
{
8
  dt d;
9
  struct
10
  {
11
    st h, l;
12
  }
13
  s;
14
} t_be;
15
 
16
typedef union
17
{
18
  dt d;
19
  struct
20
  {
21
    st l, h;
22
  }
23
  s;
24
} t_le;
25
 
26
#define df(f, t) \
27
int \
28
f (t afh, t bfh) \
29
{ \
30
  t hh; \
31
  t hp, lp, dp, m; \
32
  st ad, bd; \
33
  int s; \
34
  s = 0; \
35
  ad = afh.s.h - afh.s.l; \
36
  bd = bfh.s.l - bfh.s.h; \
37
  if (bd > bfh.s.l) \
38
    { \
39
      bd = -bd; \
40
      s = ~s; \
41
    } \
42
  lp.d = (dt) afh.s.l * bfh.s.l; \
43
  hp.d = (dt) afh.s.h * bfh.s.h; \
44
  dp.d = (dt) ad *bd; \
45
  dp.d ^= s; \
46
  hh.d = hp.d + hp.s.h + lp.s.h + dp.s.h; \
47
  m.d = (dt) lp.s.h + hp.s.l + lp.s.l + dp.s.l; \
48
  return hh.s.l + m.s.l; \
49
}
50
 
51
df(f_le, t_le)
52
df(f_be, t_be)
53
 
54
void abort (void);
55
void exit (int);
56
main ()
57
{
58
  t_be x;
59
  x.s.h = 0x10000000U;
60
  x.s.l = 0xe0000000U;
61
  if (x.d == 0x10000000e0000000ULL
62
      && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1)
63
    abort ();
64
  if (x.d == 0xe000000010000000ULL
65
      && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1)
66
    abort ();
67
  exit (0);
68
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.