emulating large registers and doing quick shifts 
Author Message
 emulating large registers and doing quick shifts

Hi there!

I try to emulate large registers (>270bits) the most efficient way on a
x86 machine. since it's sort of register limited ;) i need to either
a) break it through several registers, which is sort of difficult
b) utilize some memory trick
I basically only need shift, and, or, not functions, anything from mmx
to sse2 or just pure c can be used.

anyone ever done this before?

greetings



Sun, 05 Sep 2004 03:53:14 GMT  
 emulating large registers and doing quick shifts


Quote:
> Hi there!

> I try to emulate large registers (>270bits) the most efficient way on a
> x86 machine. since it's sort of register limited ;) i need to either
> a) break it through several registers, which is sort of difficult
> b) utilize some memory trick
> I basically only need shift, and, or, not functions, anything from mmx
> to sse2 or just pure c can be used.

> anyone ever done this before?

Yeah its called a "bignum" library.  Although if all you need is shifts,
and, or, not.... then you could use a construct like

struct reg {
   int len;
   unsigned long *data;

Quote:
};

...

Tom



Sat, 04 Sep 2004 19:18:39 GMT  
 emulating large registers and doing quick shifts

Quote:

> I try to emulate large registers (>270bits) the most efficient way on a
> x86 machine. since it's sort of register limited ;) i need to either
> a) break it through several registers, which is sort of difficult
> b) utilize some memory trick
> I basically only need shift, and, or, not functions, anything from mmx
> to sse2 or just pure c can be used.

Portable methods will have to use unsigned quantities and bit
picking, something like:

   nextcarry = a[i] & 1;
   a[i] >>= 1;
   a[i] += carry * HIBITCONSTANT;
   carry = nextcarry;
   i++;

but (for the x86) assembly is straightforward and much faster.
Rotate machine instructions exist.

--

   Available for consulting/temporary embedded and systems.
   (Remove "XXXX" from reply address. yahoo works unmodified)



Sat, 04 Sep 2004 19:20:47 GMT  
 emulating large registers and doing quick shifts

Quote:


>>I try to emulate large registers (>270bits) the most efficient way on a
>>x86 machine. since it's sort of register limited ;) i need to either
>>a) break it through several registers, which is sort of difficult
>>b) utilize some memory trick
>>I basically only need shift, and, or, not functions, anything from mmx
>>to sse2 or just pure c can be used.

> Portable methods will have to use unsigned quantities and bit
> picking, something like:

>    nextcarry = a[i] & 1;
>    a[i] >>= 1;
>    a[i] += carry * HIBITCONSTANT;
>    carry = nextcarry;
>    i++;

> but (for the x86) assembly is straightforward and much faster.
> Rotate machine instructions exist.

thanks :) that is what I have already, but - believe it or not - it's
still way too slow :(
it gets faster when you hardcode it, let's say make 9 temp variables,
then the processor can pipeline it. however, i hoped that there maybe
existed something like a built-in function in x86 cpus which could shift
the memory and - most importantly - break across the datatype borders
automatically :/

regards



Sun, 05 Sep 2004 04:36:04 GMT  
 emulating large registers and doing quick shifts


[snip]

Quote:
> thanks :) that is what I have already, but - believe it or not - it's
> still way too slow :(
> it gets faster when you hardcode it, let's say make 9 temp variables,
> then the processor can pipeline it. however, i hoped that there maybe
> existed something like a built-in function in x86 cpus which could shift
> the memory and - most importantly - break across the datatype borders
> automatically :/

http://developer.intel.com/design/litcentr/index.htm
nntp:://comp.lang.asm.x86

-Mike



Sun, 05 Sep 2004 03:00:18 GMT  
 emulating large registers and doing quick shifts

Quote:
>nntp:://comp.lang.asm.x86

comp.lang.asm.x86 is not a hostname, you url is broken.

--
bringing you boring signatures for 17 years



Mon, 06 Sep 2004 22:25:17 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Line Status Register and Transmit Shift Register

2. emulating a 64 bit divide with 2 32 bit registers in ansi c

3. Done it - Quick C now works

4. Class not registered when doing COM interop

5. Doing arithmetic with very large numbers

6. Eval of doing large project in VB or MFC

7. Left Shift Key OR Right Shift key is pressed

8. ASCII shift out and shift in char.

9. Quick Sort, quicker, stable and anti-degeneration

10. Help-Quick answer to quick memory query

11. HELP:Need copy of MS Quick C w/Quick assembler 2.5x for windows

12. Quick C v2.0 versus Quick C v1.0

 

 
Powered by phpBB® Forum Software