-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atom: Consolidate cl_khr_{local,global}_int32_{base,extended}_atomics…
… implementation These are just atomic_* wrappers. Switch inc, dec to use atomic_* wrappers as well. Reviewed-By: Aaron Watry <awatry@gmail.com> Tested-By: Aaron Watry <awatry@gmail.com> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 335279
- Loading branch information
Showing
21 changed files
with
66 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <clc/clc.h> | ||
#include "utils.h" | ||
|
||
#define __CLC_ATOM_IMPL(AS, TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP) (AS TYPE *p, TYPE val) { \ | ||
return __CLC_XCONCAT(atomic_, __CLC_ATOMIC_OP) (p, val); \ | ||
} | ||
|
||
__CLC_ATOM_IMPL(__CLC_ATOMIC_ADDRESS_SPACE, int) | ||
__CLC_ATOM_IMPL(__CLC_ATOMIC_ADDRESS_SPACE, uint) | ||
|
||
#undef __CLC_ATOM_IMPL | ||
#undef __CLC_ATOMIC_OP | ||
#undef __CLC_ATOMIC_ADDRESS_SPACE |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(global TYPE *p, TYPE val) { \ | ||
return atomic_add(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP add | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(global TYPE *p, TYPE val) { \ | ||
return atomic_sub(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP sub | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(global TYPE *p, TYPE val) { \ | ||
return atomic_xchg(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP xchg | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(global TYPE *p, TYPE val) { \ | ||
return atomic_and(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP and | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(global TYPE *p, TYPE val) { \ | ||
return atomic_max(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP max | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_min(global TYPE *p, TYPE val) { \ | ||
return atomic_min(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP min | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_or(global TYPE *p, TYPE val) { \ | ||
return atomic_or(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP or | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(global TYPE *p, TYPE val) { \ | ||
return atomic_xor(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP xor | ||
#define __CLC_ATOMIC_ADDRESS_SPACE global | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(local TYPE *p, TYPE val) { \ | ||
return atomic_add(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP add | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(local TYPE *p, TYPE val) { \ | ||
return atomic_sub(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP sub | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(local TYPE *p, TYPE val) { \ | ||
return atomic_xchg(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP xchg | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(local TYPE *p, TYPE val) { \ | ||
return atomic_and(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP and | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(local TYPE *p, TYPE val) { \ | ||
return atomic_max(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP max | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_min(local TYPE *p, TYPE val) { \ | ||
return atomic_min(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP min | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_or(local TYPE *p, TYPE val) { \ | ||
return atomic_or(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP or | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |
12 changes: 3 additions & 9 deletions
12
libclc/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
#include <clc/clc.h> | ||
|
||
#define IMPL(TYPE) \ | ||
_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(local TYPE *p, TYPE val) { \ | ||
return atomic_xor(p, val); \ | ||
} | ||
|
||
IMPL(int) | ||
IMPL(unsigned int) | ||
#define __CLC_ATOMIC_OP xor | ||
#define __CLC_ATOMIC_ADDRESS_SPACE local | ||
#include "../atom_int32_binary.inc" |