mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
libclc: Add clamp() builtin for integer/floating point
Created under a new shared/ directory for functions which are available for both integer and floating point types. Patch by: Aaron Watry llvm-svn: 184994
This commit is contained in:
parent
cd88a4ebb6
commit
fe23a30ef5
@ -67,6 +67,9 @@
|
||||
#include <clc/integer/max.h>
|
||||
#include <clc/integer/sub_sat.h>
|
||||
|
||||
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
|
||||
#include <clc/shared/clamp.h>
|
||||
|
||||
/* 6.11.5 Geometric Functions */
|
||||
#include <clc/geometric/cross.h>
|
||||
#include <clc/geometric/dot.h>
|
||||
|
5
libclc/generic/include/clc/shared/clamp.h
Normal file
5
libclc/generic/include/clc/shared/clamp.h
Normal file
@ -0,0 +1,5 @@
|
||||
#define BODY <clc/shared/clamp.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#define BODY <clc/shared/clamp.inc>
|
||||
#include <clc/math/gentype.inc>
|
1
libclc/generic/include/clc/shared/clamp.inc
Normal file
1
libclc/generic/include/clc/shared/clamp.inc
Normal file
@ -0,0 +1 @@
|
||||
_CLC_OVERLOAD _CLC_DECL GENTYPE clamp(GENTYPE x, GENTYPE y, GENTYPE z);
|
@ -18,5 +18,6 @@ math/hypot.cl
|
||||
math/mad.cl
|
||||
math/max.cl
|
||||
relational/any.cl
|
||||
shared/clamp.cl
|
||||
workitem/get_global_id.cl
|
||||
workitem/get_global_size.cl
|
||||
|
11
libclc/generic/lib/shared/clamp.cl
Normal file
11
libclc/generic/lib/shared/clamp.cl
Normal file
@ -0,0 +1,11 @@
|
||||
#include <clc/clc.h>
|
||||
|
||||
#define BODY <clamp.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#endif
|
||||
|
||||
#define BODY <clamp.inc>
|
||||
#include <clc/math/gentype.inc>
|
3
libclc/generic/lib/shared/clamp.inc
Normal file
3
libclc/generic/lib/shared/clamp.inc
Normal file
@ -0,0 +1,3 @@
|
||||
_CLC_OVERLOAD _CLC_DEF GENTYPE clamp(GENTYPE x, GENTYPE y, GENTYPE z) {
|
||||
return (x > z ? z : (x < y ? y : x));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user