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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [20050307-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR target/20322 */
2
 
3
extern void abort (void);
4
 
5
typedef unsigned long T;
6
typedef struct
7
{
8
  T a, b;
9
  unsigned char c, d;
10
} S;
11
 
12
#define M (sizeof (T) * 4)
13
 
14
S __attribute__((noinline))
15
foo (T x, T y)
16
{
17
  S e;
18
  T f[2], g;
19
 
20
  e.b = (x & (~(T) 0 >> M)) * (y & (~(T) 0 >> M));
21
  e.a = (x >> M) * (y >> M);
22
 
23
  f[0] = (x & (~(T) 0 >> M)) * (y >> M);
24
  f[1] = (x >> M) * (y & (~(T) 0 >> M));
25
 
26
  g = e.b;
27
  e.b += (f[0] & (~(T) 0 >> M)) << M;
28
  if (e.b < g)
29
    e.a++;
30
 
31
  g = e.b;
32
  e.b += (f[1] & (~(T) 0 >> M)) << M;
33
  if (e.b < g)
34
    e.a++;
35
 
36
  e.a += (f[0] >> M);
37
  e.a += (f[1] >> M);
38
  e.c = 1;
39
  e.d = 0;
40
 
41
  return e;
42
}
43
 
44
int
45
main (void)
46
{
47
  T x = 1UL << (M * 2 - 1);
48
  S y = foo (1, x);
49
  if (y.a || y.b != x || y.c != 1 || y.d)
50
    abort ();
51
  return 0;
52
}

powered by: WebSVN 2.1.0

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