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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.4
            Summary|unexpected call to __muldi3 |[14/15/16 Regression]
                   |generated for riscv target  |unexpected call to __muldi3
                   |                            |generated for riscv target

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
typedef unsigned long long uint64_t;
typedef signed   long long int64_t;

uint64_t f(uint64_t b)
{
  b = b & 1;
  b = b << 63;
  b = ((int64_t)b)>>63;
  return b;
}
uint64_t f1(uint64_t b)
{
  b = b & 1;
  b = - b;
  return b;
}
```

Even the above expansion is not so good and f gives slightly better code (on
arm; both are almost the same on rv32ec [f1 has 2 srai while f has 1 and a
mov]). Even though they are exactly the same behavior.

Likewise for:
```
unsigned int h(unsigned int b)
{
  b = b & 1;
  b = b << 31;
  b = ((int)b)>>31;
  return b;
}
unsigned int h1(unsigned int b)
{
  b = b & 1;
  return -b;
}
```

Though for the above expansion != final code output.

I am not sure I will get some time to improve expand here ...

Reply via email to