| 1 |
/* { dg-do compile { target { ! ia32 } } } */ |
| 2 |
/* { dg-options "-Ofast -std=c++23 -march=znver4" } */ |
| 3 |
/* { dg-skip-if "requires hosted libstdc++ for cstdlib malloc" { ! hostedlib } } */ |
| 4 |
|
| 5 |
#include <immintrin.h> |
| 6 |
auto f(char *buf, unsigned long long in) noexcept |
| 7 |
{ |
| 8 |
unsigned long long hi{}; |
| 9 |
auto lo{_mulx_u64(in, 0x2af31dc462ull, &hi)}; |
| 10 |
lo = _mulx_u64(lo, 100, &hi); |
| 11 |
__builtin_memcpy(buf + 2, &hi, 2); |
| 12 |
return buf + 10; |
| 13 |
} |
| 14 |
|
| 15 |
/* { dg-final { scan-assembler-times "mulx" 1 } } */ |
| 16 |
/* { dg-final { scan-assembler-times "mulq" 1 } } */ |
| 17 |
/* { dg-final { scan-assembler-not "addq" } } */ |
| 18 |
/* { dg-final { scan-assembler-not "adcq" } } */ |
| 19 |
/* { dg-final { scan-assembler-not "salq" } } */ |
| 20 |
/* { dg-final { scan-assembler-not "shldq" } } */ |