-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libclc] Move nan to the CLC library (#128521)
- Loading branch information
1 parent
a88167a
commit 2dfb29a
Showing
7 changed files
with
37 additions
and
16 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,12 @@ | ||
#ifndef __CLC_MATH_CLC_NAN_H__ | ||
#define __CLC_MATH_CLC_NAN_H__ | ||
|
||
#define __CLC_FUNCTION __clc_nan | ||
#define __CLC_BODY <clc/math/clc_nan.inc> | ||
|
||
#include <clc/math/gentype.inc> | ||
|
||
#undef __CLC_BODY | ||
#undef __CLC_FUNCTION | ||
|
||
#endif // __CLC_MATH_CLC_NAN_H__ |
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 @@ | ||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_nan(__CLC_U_GENTYPE code); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <clc/internal/clc.h> | ||
#include <clc/utils.h> | ||
|
||
#define __CLC_BODY <clc_nan.inc> | ||
#include <clc/math/gentype.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#if __CLC_FPSIZE == 64 | ||
#define NAN_MASK 0x7ff0000000000000ul | ||
#elif __CLC_FPSIZE == 32 | ||
#define NAN_MASK 0x7fc00000 | ||
#elif __CLC_FPSIZE == 16 | ||
#define NAN_MASK 0x7e00 | ||
#endif | ||
|
||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_nan(__CLC_U_GENTYPE code) { | ||
const __CLC_U_GENTYPE mask = NAN_MASK; | ||
const __CLC_U_GENTYPE res = code | mask; | ||
return __CLC_AS_GENTYPE(res); | ||
} | ||
|
||
#undef NAN_MASK |
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,6 +1,5 @@ | ||
#include <clc/clc.h> | ||
#include <clc/utils.h> | ||
#include <clc/clcmacro.h> | ||
#include <clc/math/clc_nan.h> | ||
|
||
#define __OPENCL_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE) | ||
#define __CLC_BODY <nan.inc> | ||
#include <clc/math/gentype.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
#if __CLC_FPSIZE == 64 | ||
#define NAN_MASK 0x7ff0000000000000ul | ||
#elif __CLC_FPSIZE == 32 | ||
#define NAN_MASK 0x7fc00000 | ||
#elif __CLC_FPSIZE == 16 | ||
#define NAN_MASK 0x7e00 | ||
#endif | ||
|
||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE nan(__CLC_U_GENTYPE code) { | ||
const __CLC_U_GENTYPE mask = NAN_MASK; | ||
const __CLC_U_GENTYPE res = code | mask; | ||
return __OPENCL_AS_GENTYPE(res); | ||
return __clc_nan(code); | ||
} | ||
|
||
#undef NAN_MASK |