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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
The HImode bswap can be implemented in two ways: using XCHGB %rH,%rL or ROLW
%r,8 where the former does not clobber flags. The change, referred in the
Comment #1 cut some corners and expanded directly to clobber-less form.

Unfortunately, clobber-less XCHGB form limits available register set to onlx
%ax, %bx, %cx and %dx, where ROLW can use all registers (but clobbers flags
reg).

So, it looks it is better to use the form that clobbers flags reg and leave
insn selection to the compiler via preferred_for_* machinery. This choice also
makes "improve register allocation" peephole2 obsolete.

Also, always convert HImode rotate by 8 to bswap pattern, which can also emit
MOVBE instruction when available.

Reply via email to