Ayup, fokes.

I was wondering if some guru can explain to me the following aspects of using sse.

in normal asm i have


add eax, ebx
jc blah


but do i have some extended flags in sse?

what i want to do is create a routine that will look like this



struct _128bitInteger{
int a,b,c,d;
} one, two;

// some code
__asm{
            movups xmm0, one
            movups xmm1, two
            addps xmm0, xmm1
        }



And i was wondering whether there is a way to implement a full adder for 128 bit ints this way.
But i am new to sse and i have no idea how carry is used, and how it works.

Any guidance will be treated with utmost respect.


Posted on 2010-03-13 01:54:57 by Turnip
The very idea of SIMD is to reduce the number of (or even eliminate) the jumps by introducing some sort of parallel processing of data. If you want to add 2 64-bit doubles, you simply use addsd/addpd. And that's pretty much all the precision you will need in 99.99% of situations.
Posted on 2010-03-13 03:51:20 by ti_mo_n
Turnip,

addps adds single-precision floating point values, not dwords (cf. paddd).

You should generate and propagate carry yourself. paddq can reduce the number of them to 1.

SIMD is designed to do something in parallel on multiple data sets, adding is inherently serial.
Posted on 2010-03-13 07:30:42 by baldr
thanks , right so

is it worth using simd in my case (adder for big digits)?

as far as i understand i'll have to precompute MAX - num2 < num1 to see if there is overflow
and its two more instructions plus i ll have to add the carry manually. seems like a bad tradeoff for 64 or 128 bit commands.

should i stick to multiple adc instead?
Posted on 2010-03-13 14:33:18 by Turnip
Turnip,

Probably you're right about adc.
Posted on 2010-03-13 15:12:40 by baldr
For usage of registers and other stuff look here:
http://support.amd.com/us/Processor_TechDocs/24592.pdf
http://support.amd.com/us/Processor_TechDocs/24593.pdf
http://support.amd.com/us/Processor_TechDocs/24594.pdf
Posted on 2010-04-22 07:23:30 by TasmDev