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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [960416-1.c] - Blame information for rev 149

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

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

powered by: WebSVN 2.1.0

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