bebbo / gcc

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

Never uses divs in 68000 #182

Closed alexalkis closed 2 years ago

alexalkis commented 2 years ago

http://franke.ms/cex/z/ss9Trx

Can't get the compiler to emit div.s no mater what I tried. I even change type to char.

On sas/c it gives:

              SECTION      text,CODE
__code:
foo:
___foo__1:
              MOVE.W         $6(A7),D0                ;302f 0006 
              EXT.L          D0                       ;48c0 
              DIVS.W         $a(A7),D0                ;81ef 000a 
___foo__2:
              RTS                                     ;4e75 
__const:
__strings:
              XDEF           foo
              END

or to put it another way, is there a senario where compiler emits div.s in 68000 mode?

bebbo commented 2 years ago

sorry, I pass on this.

bebbo commented 2 years ago

-mshort

alexalkis commented 2 years ago

thanks!

mheyer32 commented 2 years ago

A general question here: why does the compiler not make use of divs.w here and instead chooses to extend both operands for divs.l? This happens also when providing -m68020 and higher. Edit: I was testing without -mshort. Is the divs.w variant slower? Edit2: divs.l is slower than divs.w

bebbo commented 2 years ago

I guess that there is some forced int conversion. Thus divs.w does not match unless -mshort is used. And since int can represent unsigned char or unsigned short it ends up with int which is signed and thus uses divs