Hi,
I wish to write an algorithm in C++. My intention is to run it on a Mac
G4, however it would be nice to have the same program compile and run on
a Pentium 4.
The program will have to do a lot of the following with 32 bit integers:
int a=an arbitrary value;
int b=an arbitrary value;
int c=an arbitrary value;
int d = a*b; (discard the upper 32 bits)
if (d==c) do something;
int e = 2 << an arbitrary value from 1...31;
int f = d & e;
And so on; it's a series of ands, unsigned multiplies, and so on. It's
all contained in a massive loop that goes trillions of times. There's
no floating-point at all.
These calculations can be done in parallel. How do I make GCC output
Altivec instructions or SIMD instructions? How do I make it do an
unsigned multiply of 2 32-bit numbers and discard the upper 32 bits?
Also, is there a way of testing for carry? For example,
int a = something;
int b = something;
int c = a+b;
if (carry bit is set) do something;