__sync commands with 16 byte

Roland Schulz roland@rschulz.eu
Tue Feb 5 05:33:00 GMT 2008


Hi,

I try to use __sync_bool_compare_and_swap_16 but the data is not
copied when using long double or 128bit integer. Which data type
should be used for this function?

A test case:
typedef int bigint_t __attribute__ ((__mode__ (__TI__)));

long double a=5, b=0;
__sync_bool_compare_and_swap_16(&b,b,a);
printf("%Lf %Lf\n",a,b);

long  a2=5, b2=0;
__sync_bool_compare_and_swap(&b2,b2,a2);
printf("%ld %ld\n",a2,b2);

bigint_t a3=5, b3=0;
__sync_bool_compare_and_swap_16(&b3,b3,a3);
printf("%Ld %Ld\n",a3,b3);

With gcc 4.2.1 (-march=nocona) I get:
5.000000 0.000000
5 5
5 0

instead of the expected:
5.000000 5.000000
5 5
5 5

Am I using the function wrong or is this a (known) problem in gcc?

Thanks
Roland



More information about the Gcc-help mailing list