bebbo / gcc

Bebbo's gcc-6-branch for m68k-amigaos
GNU General Public License v2.0
33 stars 11 forks source link

-mtune=68030 now prefers divs/mul.s over arithmetic #224

Closed mheyer32 closed 7 months ago

mheyer32 commented 7 months ago

Some change in the recent past (can't quantify it... think of the last half year maybe?) makes ADoom now compile with a lot more muls/divs whereas previous compiler versions would often use more explicit math when the factor/divisor are known

Old code:


    mo->angle = ANG45 * (mthing->angle / 45);
   1f6d0:   move.w (4,a2,d4.l),d3
   1f6d4:   movea.w d3,a0
   1f6d6:   move.l a0,d1
   1f6d8:   add.l a0,d1
   1f6da:   add.l a0,d1
   1f6dc:   lsl.l #3,d1
   1f6de:   sub.l a0,d1
   1f6e0:   lsl.l #2,d1
   1f6e2:   sub.l a0,d1
   1f6e4:   lsl.l #6,d1
   1f6e6:   add.l a0,d1
   1f6e8:   add.l d1,d1
   1f6ea:   add.l a0,d1
   1f6ec:   moveq #19,d2
   1f6ee:   asr.l d2,d1
   1f6f0:   move.b #15,d2
   1f6f4:   asr.w d2,d3
   1f6f6:   sub.l d3,d1
   1f6f8:   moveq #29,d2
   1f6fa:   movea.l d0,a0
   1f6fc:   lsl.l d2,d1
   1f6fe:   move.l d1,32(a0)

new code:

  mo->angle = ANG45 * (mthing->angle / 45);
   1f2fe:   move.w (4,a2,d4.l),d1
   1f302:   moveq #45,d2
   1f304:   ext.l d1
   1f306:   divs.w d2,d1
   1f308:   ext.l d1
   1f30a:   moveq #29,d0
   1f30c:   lsl.l d0,d1
   1f30e:   move.l d1,32(a3)

While I'm currently using -m68020-60 -mtune=68030, switching back to the prior use of just '-m68030' does not seem to have an effect. Is this 'works as intended'?

mheyer32 commented 7 months ago

Thank you very much! Looks like the current compiler is doing the same as the prior version now.