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

--- Comment #7 from chenglulu <chenglulu at loongson dot cn> ---
(In reply to Xi Ruoyao from comment #5)
> (In reply to chenglulu from comment #4)
> > (In reply to Xi Ruoyao from comment #3)
> > > It happens at:
> > > 
> > > trying to combine definition of r94 in: 
> > >    15: r94:DI=r92:DI<<0x2&0xfffffffc
> > >       REG_DEAD r92:DI
> > > into:
> > >    17: r96:DI=sign_extend(r87:SI+r94:DI#0)
> > >       REG_DEAD r94:DI
> > >       REG_DEAD r87:SI
> > > 
> > > i.e.
> > > 
> > > bstrpick.d t0, a0, 31, 0
> > > slli.d     t0, t0, 2
> > > addi.w     t0, t0, a1
> > > 
> > > But we want just
> > > 
> > > alsl.w     t0, a0, a1, 2
> > > 
> > > It seems modifying SImode to DImode as comment 1 will defeat the
> > > optimization.  I guess we should sign extend mask in
> > > loongarch_reassoc_shift_bitwise to mode if it's not already sign-extended.
> > 
My modification will indeed add an extra 'and' operation. I agree with your
point of view.

Reply via email to