1 /* PR tree-optimization/81396 */ 2 /* { dg-do compile } */ 3 /* { dg-options "-O2 -fdump-tree-optimized" } */ 4 5 typedef unsigned long long uint64_t; 6 7 uint64_t foo(uint64_t word)8foo (uint64_t word) 9 { 10 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_LONG__ == 8 11 const unsigned char *const ptr = (const unsigned char *) &word; 12 return ((uint64_t) ptr[0] 13 | ((uint64_t) ptr[1] << 8) 14 | ((uint64_t) ptr[2] << (8 * 2)) 15 | ((uint64_t) ptr[3] << (8 * 3)) 16 | ((uint64_t) ptr[4] << (8 * 4)) 17 | ((uint64_t) ptr[5] << (8 * 5)) 18 | ((uint64_t) ptr[6] << (8 * 6)) 19 | ((uint64_t) ptr[7] << (8 * 7))); 20 #else 21 return word; 22 #endif 23 } 24 25 /* { dg-final { scan-tree-dump "return word_\[0-9]*\\(D\\);" "optimized" } } */ 26