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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Huaqi from comment #1)
> This issue also present in arm-eabi-gcc toolchain 14.x, but not present in
> 13.x.
> 
> compiler option chosen is -Os -mcpu=cortex-m0
> 
> chose m0 due it don't have a multiply hw unit
> 
> see https://godbolt.org/z/941TbMKGc
> 
> 14.x will generate bl      __aeabi_lmul, but 13.x will not.

              bool speed = optimize_insn_for_speed_p ();
              int cost = add_cost (speed, mode) + neg_cost (speed, mode);
              struct algorithm algorithm;
              enum mult_variant variant;
              if (CONST_INT_P (op1)
                  ? !choose_mult_variant (mode, INTVAL (op1),
                                          &algorithm, &variant, cost)
                  : cost < mul_cost (speed, mode))
                {
                  temp = bit0_p ? expand_and (mode, negate_rtx (mode, op0),
                                              op1, target)


This is supposed to chose between `X*Y as X&-Y` but in both arm and riscv32
where there is a libcall is chosing the libcall for -Os.

Reply via email to