[cxx-mem-model] Atomicity tests.

Andrew MacLeod amacleod@redhat.com
Thu Aug 18 16:35:00 GMT 2011


Here's a set of 8 tests which test the atomicity of all the >1 byte 
__sync_mem routines.  I didn't see the point of testing char for 
atomicity.  Maybe there isn't much point to short either,  but maybe 
there is some weird byte-load/store target out there now or later :-P  
It doesn't hurt to have it.

There are tests for __sync_mem_load and then all the rest.

It uses the new gdb framework to verify that no invalid intermediate 
values are ever detected.

The load test basically writes a cycling bit-pattern value into an 
atomic variable after every instruction is executed. The atomic load 
should only ever fetch one of the valid values which are in this cycle.  
the load is executed within a loop which varies the cycle of the pattern 
to ensure we don't find resonance with the instruction execution 
sequence.  (ie, alternating 2 values when it takes 2 instructions to get 
the second half of a value would not detect a failure)

The other test simply executes all the remaining __sync_mem routines in 
such a way that they alternate writing 0 and MAX into the atomic value. 
The value is  checked after every instruction that it contains one value 
or the other.

As expected, the 16 byte tests fail and I have XFAILed them.

Oh, and I modified the control script such that once a failed result is 
detected, the test-case can be terminated.

Andrew

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110818/7a66d552/attachment.ksh>


More information about the Gcc-patches mailing list