title: memory barrier intrinsics for ARM (analogous to _mm_*fence())
body: <p>I'm looking for the ARM analogue for the Intel memory barrier intrinsics <code>_mm_lfence(), _mm_sfence(), _mm_mfence()</code> introduced together with SSE/SSE2. </p>
  
  <p>I'm using gcc (4.8), but the solution should be portable to other compilers (icc, clang).</p>
  
  <p>From this ARM document</p>
  
  <p><a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka14552.html" rel="nofollow">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka14552.html</a></p>
  
  <p>I concluded I'd need intrinsics such as <code>__dmb()</code> and <code>__schedule_barrier()</code>, but according to this site</p>
  
  <p><a href="https://answers.launchpad.net/gcc-arm-embedded/+question/258449" rel="nofollow">https://answers.launchpad.net/gcc-arm-embedded/+question/258449</a></p>
  
  <p>these intrinsics are not available on gcc. </p>
  
  <p>I'm not sure about the CMSIS library mentioned there, would this provide a portable solution?</p>
  
  <p>I also thought of mapping the 3 fence intrinsics to <code>__sync_synchronize()</code> (full memory barrier), but I'm not sure about the portability of this intrinsic either (and there is no version for read or write barriers, only this full barrier).</p>
  
  <p>Thanks for your help!</p>