Add new test to verify that the array index, limit, and stride are
[official-gcc.git] / gcc / testsuite / gcc.dg / pr48235.c
blob401624ec62982d3b8ffc9da4ded6c20a51304a57
1 /* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
2 /* { dg-require-effective-target freorder } */
3 /* { dg-options "-O -fno-guess-branch-probability -fpeel-loops -freorder-blocks-and-partition -fschedule-insns2 -fsel-sched-pipelining -fselective-scheduling2" } */
4 struct intC
6 short x;
7 short y;
8 };
10 int size_x;
12 static inline int
13 TileDiffXY (int x, int y)
15 return (y * size_x) + x;
18 struct HangarTileTable
20 struct intC ti;
21 int hangar_num;
24 struct AirportSpec
26 struct HangarTileTable *depot_table;
27 int size;
30 void Get ();
31 struct AirportSpec dummy;
33 static inline int
34 GetRotatedTileFromOffset (int *a, struct intC tidc)
36 if (!*a)
37 Get ();
38 switch (*a)
40 case 0:
41 return (tidc.y << size_x) + tidc.x;
42 case 1:
43 return TileDiffXY (tidc.y, dummy.size - tidc.x);
44 case 2:
45 return TileDiffXY (tidc.x, dummy.size - tidc.y);
46 case 3:
47 return TileDiffXY (dummy.size - 1, tidc.x);
51 int
52 GetHangarNum (int *a)
54 int i;
55 for (i = 0; i < dummy.size; i++)
56 if (GetRotatedTileFromOffset (a, dummy.depot_table[i].ti))
57 return dummy.depot_table[i].hangar_num;