https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114252
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-03-06
Status|UNCONFIRMED |NEW
Component|tree-optimization |target
Keywords| |missed-optimization
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. It looks like we do no cost evaluation in
maybe_optimize_vector_constructor but checking that there's an optab
for bswap with SImode.
insn-flags.h:#define HAVE_bswapsi2 1
but somehow we end up doing a libcall?
We expand as
;; bswapdst_10 = __builtin_bswap32 (load_dst_9);
(insn 6 5 7 (set (reg:SI 47)
(mem:SI (reg/v/f:HI 46 [ buf ]) [0 MEM <long unsigned int> [(const
uint8_t *)buf_5(D)]+0 S4 A8])) -1
(nil))
(insn 7 6 8 (set (reg:SI 22 r22)
(reg:SI 47)) -1
(nil))
(insn 8 7 9 (set (reg:SI 22 r22)
(bswap:SI (reg:SI 22 r22))) -1
(nil))
^^^
so why does that turn into a library call?
I think this is mis-communication between the middle-end and the target.