sync_lock_test_and_set testcases

Adrian Straetling straetling@de.ibm.com
Thu Aug 18 18:30:00 GMT 2005


Hi,

developing a patch to implement sync_lock_test_and_set for S/390 I found
2 testcases failing:

testsuite/gcc.dg/ia64-sync-1.c
testsuite/gcc.dg/ia64-sync-2.c

They both call __sync_lock_test_and_set(AL+2, 1)
and later compare the changed memory with the expected result (in this
case 1).

This works for all architectures which do a compare_exchange or set only
1 bit, but S/390 sets all bits of the lowest byte. Therefore the actual
memory content is 0xff and the memcmp fails.

However, in md.texi it states: "The true contents of the memory operand
are implementation defined." Does this testcase intentionally check for
compare_exchange behaviour or is it overly stringent?

A fix could be to mask the result with 1 before comparing? At least that
would work for me.

regards,
Adrian



More information about the Gcc-patches mailing list