Re: ASM for math
- From: Ilya Zakharevich <nospam-abuse@xxxxxxxxx>
- Date: Thu, 25 Sep 2008 23:08:32 +0000 (UTC)
[A complimentary Cc of this posting was sent to
John W Kennedy
<jwkenne@xxxxxxxxxxxxx>], who wrote in article <48dbfb58$0$4917$607ed4bc@xxxxxx>:
express. Most processors have special tricks for multi-word arithmetic
(such as the Intel ADC instruction or the new z/Architecture ALC family
of instructions) that cannot be expressed at all in, say, C. (That is, C
has no way of saying, "Add X to Y, and add an additional 1 if the last
addition set the CPU carry flag.")
IIRC, PARI does not use anything "as advanced as that" ;-). There are
about 10 macros which an architecture should better imlement in
assembler; they are all very primitive, like
add two numbers and return the carry flag,
word x word --> twowords multiplication,
calculate number of trailing 0bits in a word, etc.
A typical PARI assembler file for an architecture is about 100 LOC.
(GMP kernel uses much larger assembler base, so it may be slightly
quickier for very large numbers - and slower for smaller ones for
independent reasons.)
Hope this helps,
Ilya
.
- References:
- Math::Pari in turmoil
- From: Ilya Zakharevich
- Re: [OT] On `ad hominem' - OS X users
- From: Ilya Zakharevich
- Re: [OT] On `ad hominem' - OS X users
- From: Sherm Pendley
- Re: [OT] On `ad hominem' - OS X users
- From: John W Kennedy
- Math::Pari in turmoil
- Prev by Date: Re: [OT] On `ad hominem' - OS X users
- Next by Date: Re: Trying to build berkeleyDB module against M$ VStudio 2005 SDK stuff
- Previous by thread: Re: [OT] On `ad hominem' - OS X users
- Next by thread: Re: [OT] On `ad hominem' - OS X users
- Index(es):
Relevant Pages
|