1 /* { dg-do compile } */
2 /* { dg-options "-Os -mhw-div -mhw-mul -mhw-mulx" } */
3 
4 #include <stdint.h>
5 #include <stddef.h>
6 
foo(const uint8_t * str,uint32_t * res)7 void foo(const uint8_t* str, uint32_t* res)
8 {
9   uint32_t rdVal0, rdVal1, rdVal2;
10   rdVal0 = rdVal1 = rdVal2 = 0;
11   unsigned c;
12   for (;;) {
13     c = *str++;
14     unsigned dig = c - '0';
15     if (dig > 9)
16       break; // non-digit
17     uint64_t x10;
18 
19     x10 = (uint64_t)rdVal0*10 + dig;
20     rdVal0 = (uint32_t)x10;
21     dig = (uint32_t)(x10 >> 32);
22 
23     x10 = (uint64_t)rdVal1*10 + dig;
24     rdVal1 = (uint32_t)x10;
25     dig = (uint32_t)(x10 >> 32);
26 
27     rdVal2 = rdVal2*10 + dig;
28   }
29   res[0] = rdVal0;
30   res[1] = rdVal1;
31   res[2] = rdVal2;
32 }
33 
34 /* { dg-final { scan-assembler-times "mulxuu\t" 2 } } */
35