delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/05/16:47:56

Date: Mon, 06 Jan 1997 10:42:55 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: undefined reference using #pragma aux
To: Bob Platko <platko AT ix DOT netcom DOT com>
Cc: djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <32D0D72F.7732@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <01bbf5d6$380e7a60$93f15ecf AT platko DOT ix DOT netcom DOT com>

Bob Platko wrote:
> 
> I can't seem to get the following code to work in DJGPP.
> 
> long Mul16_16( long a, long b );
> #pragma aux Mul16_16 =\
>   "imul edx",\
>   "shrd   eax,edx,16"\
>   parm [eax] [edx]
> 
> Any sugestions?  Is there another way to multiply two 16.16 fixed point
> numbers,
> returning a 16.16 result?

Use extended asm (info gcc "c ex" ex) (note, the code is untested and I
may have the %1 (%edx) and %0 (%eax) reversed and the '&' may not be
needed.

asm("
    imull %1
    shrdl $16,%1,%0
    "
    :"=&a"(result)	/* output %eax->result */
    :"b"(d),"a"(a)	/* input, a->%eax b->%edx */
    :"%edx"		/* modified registers not in output */
);

Bill
-- 
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019