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 5 { 6 short x; 7 short y; 8 }; 9 10 int size_x; 11 12 static inline int TileDiffXY(int x,int y)13TileDiffXY (int x, int y) 14 { 15 return (y * size_x) + x; 16 } 17 18 struct HangarTileTable 19 { 20 struct intC ti; 21 int hangar_num; 22 }; 23 24 struct AirportSpec 25 { 26 struct HangarTileTable *depot_table; 27 int size; 28 }; 29 30 void Get (); 31 struct AirportSpec dummy; 32 33 static inline int GetRotatedTileFromOffset(int * a,struct intC tidc)34GetRotatedTileFromOffset (int *a, struct intC tidc) 35 { 36 if (!*a) 37 Get (); 38 switch (*a) 39 { 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); 48 } 49 } 50 51 int GetHangarNum(int * a)52GetHangarNum (int *a) 53 { 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; 58 } 59