Re: How to inline a huge m68k code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> My guess:
> 
> inline int64_t MUL64(int a, int b)
> {
>   uint32_t au = a;
>   uint32_t bu = b;
> 
>   uint32_t resh, resl;
>   uint64_t res;
> 
>   umul_ppmm(resh, resl, au, bu);
> 
>   if (a < 0)
>     resh -= bu;
>   if (b < 0)
>     resh -= au;
> 
>   res = ((uint64_t)resh << 32) | resl;
> 
>   return res;
> }
> 
> 
> #define MULL(a,b,s)				\
>      (MUL64(a, b) >> s)
> 
> 
> #ifndef MAC64
> #   define MAC64(d, a, b) ((d) += MUL64(a, b))
> #endif
> 
> #ifndef MLS64
> #   define MLS64(d, a, b) ((d) -= MUL64(a, b))
> #endif

Thank you for help!

I will have the results from 68060 later.

I also compiled MULH() with -m68040 option for comparison:


#include <stdint.h>

inline int MULH(int a, int b){
    return ((int64_t)(a) * (int64_t)(b))>>32;
}


68040 asm output:

#NO_APP
	.text
	.even
	.globl	_MULH
_MULH:
	move.l d2,-(sp)
	move.l 12(sp),d2
	move.l d2,d1
	muls.l 8(sp),d0:d1
	move.l (sp)+,d2
	rts

68060 asm output:

#NO_APP
	.text
	.even
	.globl	_MULH
_MULH:
	move.l 4(sp),-(sp)
	smi d0
	extb.l d0
	move.l d0,-(sp)
	move.l 16(sp),-(sp)
	smi d0
	extb.l d0
	move.l d0,-(sp)
	jsr ___muldi3
	lea (16,sp),sp
	rts

Regards



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux