libclc: Add max() builtin function

Adds this function for both int and floating data types.

Patch by: Aaron Watry

llvm-svn: 184992
This commit is contained in:
Tom Stellard 2013-06-26 18:20:46 +00:00
parent 30f554b23d
commit ec87fb0b0c
10 changed files with 28 additions and 0 deletions

View File

@ -45,6 +45,7 @@
#include <clc/math/log.h>
#include <clc/math/log2.h>
#include <clc/math/mad.h>
#include <clc/math/max.h>
#include <clc/math/pow.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
@ -63,6 +64,7 @@
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
#include <clc/integer/max.h>
#include <clc/integer/sub_sat.h>
/* 6.11.5 Geometric Functions */

View File

@ -0,0 +1,2 @@
#define BODY <clc/integer/max.inc>
#include <clc/integer/gentype.inc>

View File

@ -0,0 +1 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);

View File

@ -0,0 +1,2 @@
#define BODY <clc/math/max.inc>
#include <clc/math/gentype.inc>

View File

@ -0,0 +1 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);

View File

@ -7,6 +7,7 @@ integer/abs.cl
integer/add_sat.cl
integer/add_sat.ll
integer/add_sat_impl.ll
integer/max.cl
integer/sub_sat.cl
integer/sub_sat.ll
integer/sub_sat_impl.ll
@ -14,6 +15,7 @@ math/fmax.cl
math/fmin.cl
math/hypot.cl
math/mad.cl
math/max.cl
relational/any.cl
workitem/get_global_id.cl
workitem/get_global_size.cl

View File

@ -0,0 +1,4 @@
#include <clc/clc.h>
#define BODY <max.inc>
#include <clc/integer/gentype.inc>

View File

@ -0,0 +1,3 @@
_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
return (a > b ? a : b);
}

View File

@ -0,0 +1,8 @@
#include <clc/clc.h>
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
#define BODY <max.inc>
#include <clc/math/gentype.inc>

View File

@ -0,0 +1,3 @@
_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
return (a > b ? a : b);
}