1/* PR optimization/11018 */ 2/* Originator: <partain@dcs.gla.ac.uk> */ 3 4/* { dg-do run } */ 5/* { dg-require-effective-target ultrasparc_hw } */ 6/* { dg-options "-O2 -mcpu=ultrasparc" } */ 7 8/* This used to fail on 32-bit Ultrasparc because 9 of broken DImode shift patterns. */ 10 11extern void abort(void); 12 13typedef unsigned long long uint64_t; 14typedef unsigned int size_t; 15 16 17void to_octal (uint64_t value, char *where, size_t size) 18{ 19 uint64_t v = value; 20 size_t i = size; 21 22 do 23 { 24 where[--i] = '0' + (v & ((1 << 3) - 1)); 25 v >>= 3; 26 } 27 while (i); 28} 29 30 31int main (void) 32{ 33 char buf[8]; 34 35 to_octal(010644, buf, 6); 36 37 if (buf[1] != '1') 38 abort(); 39 40 return 0; 41} 42