[PATCH 0/4] barriers/memory fences improvements for r600

Hello libclc fellows,

This serie of patches provides some fixes to the current r600 barrier
implementation and also adds the support of explicit memory fences for r600.
For that, some new intrinsics are required. They are provided by my serie
of patches sent to the LLVM mailing list.
The headers for the memory fences built-ins are placed in clc/explicitmemoryfence .

(It's my first patches to an open-source project, so don't hesitate to point me my
mistakes/errors/indentation problems etc :slight_smile: ).

Tested on Evergreen (Cedar) only.

Sincerely,
Damien Hilloulin.

[1/4] Fix and improvements to barrier() for R600 targets
     This patch introduces two new intrinsics and therefore must be used in
     conjunction with the patches to the LLVM backend. It fixes the
     behaviour of barrier(0) : previously no barrier was generated, this
     is fixed by making a call to the new intrinsic barrier.nofence().
      The patch also changes the behaviour of barrier(
     CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE ) : previously two
     barriers were generated, now just one with the new intrinsic
     barrier.localglobal().
[2/4] mem_fence() support for R600 targets
     This patch introduces three new intrinsics and therefore must be used
     in conjunction with the patches to the LLVM backend. It adds the
     mem_fence built-in function, and an implementation for r600 using
     the newly introduced LLVM intrinsics. (It is mainly copy-paste
     from barrier_impl.ll but if flags equals 0, we do nothing).
[3/4] read_mem_fence() support for R600 targets
     This patch introduces three new intrinsics and therefore must be used
     in conjunction with the patches to the LLVM backend. It adds the
     read_mem_fence built-in to libclc, and an implementation for r600
     using the newly introduced LLVM intrinsics. Plain copy&paste
     from the mem_fence patch, with some find&replace
[4/4] write_mem_fence() support for R600 targets.
     This patch introduces three new intrinsics and therefore must be used
     in conjunction with the patches to the LLVM backend. It adds the
     write_mem_fence built-in to libclc, and an implementation for r600
     using the newly introduced LLVM intrinsics. Plain copy&paste
     from the read_mem_fence patch, with some find&replace.

  generic/include/clc/clc.h | 5 +++
  .../include/clc/explicitmemoryfence/mem_fence.h | 1 +
  .../clc/explicitmemoryfence/read_mem_fence.h | 1 +
  .../clc/explicitmemoryfence/write_mem_fence.h | 1 +
  r600/lib/SOURCES | 3 ++
  r600/lib/explicitmemoryfence/mem_fence_impl.ll | 44