Re: How to inline a huge m68k code?

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

 





Dnia 13 lipca 2009 16:35 Andrew Haley <aph@xxxxxxxxxx> napisał(a):

> ami_stuff wrote:
> >>> Ok, so it is a GCC's bug?
> >> It's perhaps an optimization that gcc doesn't do.  But then
> >> there is an infinite number of optimizations that gcc doesn't do.
> > 
> > How should I modify GCC's inline to repleace MULH function (to make it compatible)?
> 
> What for?  I posted sample code that should work.

Could you tell me what I do wrong?

#include <stdio.h>
#include <stdint.h>

#define MULH_ORG(a,b) (((int64_t)(a) * (int64_t)(b))>>32)

#define MULH_ASM(xh, xl, a, b)
  __asm__ ("| Inlined umul_ppmm     \n\t"
	   "	move%.l	%2, %/d0   \n\t"
	   "	move%.l	%3, %/d1   \n\t"
	   "	move%.l	%/d0, %/d2 \n\t"
	   "	swap	%/d0 \n\t"
	   "	move%.l	%/d1, %/d3 \n\t"
	   "	swap	%/d1 \n\t"
	   "	move%.w	%/d2, %/d4 \n\t"
	   "	mulu	%/d3, %/d4    \n\t"
	   "	mulu	%/d1, %/d2    \n\t"
	   "	mulu	%/d1, %/d2    \n\t"
	   "	mulu	%/d0, %/d1    \n\t"
	   "	move%.l	%/d4, %/d0 \n\t"
	   "	eor%.w	%/d0, %/d0  \n\t"
	   "	swap	%/d0 \n\t"
	   "	add%.l	%/d0, %/d2  \n\t"
	   "	add%.l	%/d3, %/d2  \n\t"
	   "	jcc	1f    \n\t"
	   "	add%.l	%#65536,%/d1   \n\t"
	   "1:	swap	%/d2   \n\t"
	   "	moveq	%#0, %/d0    \n\t"
	   "	move%.w	%/d2, %/d0 \n\t"
	   "	move%.w	%/d4, %/d2 \n\t"
	   "	move%.l	%/d2, %1   \n\t"
       	   "	add%.l	%/d1, %/d0   \n\t"
	   "	move%.l	%/d0, %0   \n\t"
	   : "=g" ((USItype) (xh)),
	     "=g" ((USItype) (xl))
	   : "g" ((USItype) (a)),
	     "g" ((USItype) (b))
	   : "d0", "d1", "d2", "d3", "d4")

main ()
{
printf("result org: %d\n",m(5555555,5555555));
printf("result asm: %d\n",MULH_ASM(5555555,5555555));
}

Error:

mulhtest.c: In function `main':
mulhtest.c:64: warning: assignment makes pointer from integer without a cast
mulhtest.c:71: error: syntax error before "asm"



[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