diff options
| author | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-15 04:10:37 +0000 |
|---|---|---|
| committer | Jan Vesely <jan.vesely@rutgers.edu> | 2017-11-15 04:10:37 +0000 |
| commit | 7ba243cc3de1cc83f013daa1b84d74f51158d406 (patch) | |
| tree | 29d931e0f10e0fa4c976417085e368b566d0bec5 /libclc | |
| parent | 28742faf4967e6a869300617e2d95a14ab69485d (diff) | |
| download | bcm5719-llvm-7ba243cc3de1cc83f013daa1b84d74f51158d406.tar.gz bcm5719-llvm-7ba243cc3de1cc83f013daa1b84d74f51158d406.zip | |
math: Implement maxmag
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318264
Diffstat (limited to 'libclc')
| -rw-r--r-- | libclc/generic/include/clc/clc.h | 1 | ||||
| -rw-r--r-- | libclc/generic/include/clc/math/maxmag.h | 7 | ||||
| -rw-r--r-- | libclc/generic/lib/SOURCES | 1 | ||||
| -rw-r--r-- | libclc/generic/lib/math/maxmag.cl | 4 | ||||
| -rw-r--r-- | libclc/generic/lib/math/maxmag.inc | 4 |
5 files changed, 17 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 5d64751e365..d4ab289ccc9 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -83,6 +83,7 @@ #include <clc/math/log2.h> #include <clc/math/logb.h> #include <clc/math/mad.h> +#include <clc/math/maxmag.h> #include <clc/math/modf.h> #include <clc/math/nextafter.h> #include <clc/math/pow.h> diff --git a/libclc/generic/include/clc/math/maxmag.h b/libclc/generic/include/clc/math/maxmag.h new file mode 100644 index 00000000000..4230da9f15a --- /dev/null +++ b/libclc/generic/include/clc/math/maxmag.h @@ -0,0 +1,7 @@ +#define __CLC_BODY <clc/math/binary_decl_tt.inc> +#define __CLC_FUNCTION maxmag + +#include <clc/math/gentype.inc> + +#undef __CLC_BODY +#undef __CLC_FUNCTION diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index ad5a7437021..0320d293a9e 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -118,6 +118,7 @@ math/log1p.cl math/log2.cl math/logb.cl math/mad.cl +math/maxmag.cl math/modf.cl math/native_cos.cl math/native_divide.cl diff --git a/libclc/generic/lib/math/maxmag.cl b/libclc/generic/lib/math/maxmag.cl new file mode 100644 index 00000000000..db23fc0f629 --- /dev/null +++ b/libclc/generic/lib/math/maxmag.cl @@ -0,0 +1,4 @@ +#include <clc/clc.h> + +#define __CLC_BODY <maxmag.inc> +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/maxmag.inc b/libclc/generic/lib/math/maxmag.inc new file mode 100644 index 00000000000..88b0129835b --- /dev/null +++ b/libclc/generic/lib/math/maxmag.inc @@ -0,0 +1,4 @@ +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE maxmag(__CLC_GENTYPE x, __CLC_GENTYPE y) { + const __CLC_GENTYPE res = select(y, x, isgreater(fabs(x), fabs(y))); + return select(res, fmax(x, y), isnan(x) | isnan(y) | isequal(fabs(x), fabs(y))); +} |

