https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122871
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-11-26
Component|tree-optimization |middle-end
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Expand should have used shift/add.
Expand produces so much bad initial rtl for this on i386 too:
```
(insn 6 5 7 (parallel [
(set (reg:SI 103)
(mult:SI (subreg:SI (reg/v:DI 101 [ a ]) 4)
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":6:5 -1
(nil))
(insn 7 6 8 (parallel [
(set (reg:SI 104)
(mult:SI (subreg:SI (reg/v:DI 101 [ a ]) 0)
(const_int 2 [0x2])))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":6:5 -1
(nil))
(insn 8 7 9 (parallel [
(set (reg:SI 105)
(plus:SI (reg:SI 103)
(reg:SI 104)))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":6:5 -1
(nil))
(insn 9 8 10 (set (reg:SI 106)
(const_int 1 [0x1])) "/app/example.cpp":6:5 -1
(nil))
(insn 10 9 11 (parallel [
(set (reg:DI 102 [ _5 ])
(mult:DI (zero_extend:DI (subreg:SI (reg/v:DI 101 [ a ]) 0))
(zero_extend:DI (reg:SI 106))))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":6:5 -1
(nil))
```
A mult by 1. another mult by 1 but with a register.
Maybe this is the cause of the arm issue here.