On Thu, 2025-01-16 at 20:30 +0800, Lulu Cheng wrote:
> 
> 在 2025/1/15 下午6:10, Xi Ruoyao 写道:
> > diff --git a/gcc/config/loongarch/loongarch.cc 
> > b/gcc/config/loongarch/loongarch.cc
> > index 9d97f0216f0..3a8e1297bd3 100644
> > --- a/gcc/config/loongarch/loongarch.cc
> > +++ b/gcc/config/loongarch/loongarch.cc
> > @@ -3929,14 +3929,31 @@ loongarch_rtx_costs (rtx x, machine_mode mode, int 
> > outer_code,
> >   
> >         /* If it's an add + mult (which is equivalent to shift left) and
> >      it's immediate operand satisfies const_immalsl_operand predicate.  */
> > -      if ((mode == SImode || (TARGET_64BIT && mode == DImode))
> > -     && GET_CODE (XEXP (x, 0)) == MULT)
> > +      if (code == PLUS
> 
> Hi,
> 
> This section of code is already within the "case PLUS" block, so I think 
> the condition "code == PLUS" is unnecessary.

The reason is "case MINUS:" falls through into "case PLUS:" and we don't
have a "slsl" instruction, so we need the check to reject things like a
- b * 4 here.

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to