[Bug target/106601] __builtin_bswap16 code gen could be improved with ZBB enabled

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 12 20:53:18 GMT 2022


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-08-12

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Waterman from comment #1)

> (I don't know whether bswap32 has already been similarly optimized on RV64,
> but it needs to use srai so that the 32-bit result is canonicalized
> properly.)

It is:
t:
        rev8    a0,a0
        srai    a0,a0,32
        ret
For:
unsigned int t(unsigned int a)
{
  return __builtin_bswap32(a);
}


More information about the Gcc-bugs mailing list