https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115749

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the original testcase, the imul vs shift can be reduced down to just:
```
unsigned long func(unsigned long x)
{
  return x * 240;
}

```

GCC produces:
```
        movq    %rdi, %rax
        salq    $4, %rax
        subq    %rdi, %rax
        salq    $4, %rax
```
vs:
```
        imulq   $240, %rdi, %rax
```

-mtune=skylake  produces the imul.

The mulx issue can be reduced down to just:
```
unsigned long func(unsigned long x)
{
  __uint128_t t = x;
  return (t * 123)>>64;
}


__uint128_t func1(unsigned long x, unsigned long y)
{
  __uint128_t t = x;
  return (t * 123);
}

```

It only happens with constants it seems.

Reply via email to