aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr57662.c
blob: 7af845532b8b00a3899ae0ec9fe85a2bae810234 (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
/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
/* { dg-options " -O -fno-guess-branch-probability -fpeel-loops -freorder-blocks-and-partition -fschedule-insns2 -fsel-sched-pipelining -fselective-scheduling2 -ftree-pre" } */

struct intC
{
  short x;
  short y;
};

void Get(void);

int size_x;

struct
{
  int *depot_table;
  struct intC *ti;
  int size;
} dummy;

static inline int
GetRotatedTileFromOffset (int *a, struct intC tidc)
{
  if (!*a)
    Get ();
  switch (*a)
    {
    case 0:
      return (tidc.y << size_x) + tidc.x;
    case 1:
      return tidc.y + (dummy.size - tidc.x) * size_x;
    case 2:
      return tidc.x + (dummy.size - tidc.y) * size_x;
    case 3:
      return (dummy.size - tidc.x);
    }
  return 0;
}

int
GetHangarNum (int *a, int i)
{
  while (dummy.size)
    if (GetRotatedTileFromOffset (a, dummy.ti[i]))
      return *dummy.depot_table;
  return 0;
}