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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
      COSTS_N_INSNS (6)        /* si idiv.  */
      COSTS_N_INSNS (10)       /* di idiv.  */

+COSTS_N_INSNS (1)

sdiv is +1



x86_64 generic costs are much higher:
```
  {COSTS_N_INSNS (16),                  /* cost of a divide/mod for QI */
   COSTS_N_INSNS (22),                  /*                          HI */
   COSTS_N_INSNS (30),                  /*                          SI */
   COSTS_N_INSNS (74),                  /*                          DI */
   COSTS_N_INSNS (74)},                 /*                          other */
```

It must be that 7 is close to overall cost for the mod case. 

So I think using udiv here for the mod is fine.

Integer division on most aarch64 cores is not as expensive as it is on x86.

Reply via email to