summaryrefslogtreecommitdiffstats
path: root/libclc/generic/lib/math/maxmag.inc
diff options
context:
space:
mode:
authorJan Vesely <jan.vesely@rutgers.edu>2018-03-06 17:48:38 +0000
committerJan Vesely <jan.vesely@rutgers.edu>2018-03-06 17:48:38 +0000
commit4e72300929d9450f13190cd264d40268af08427c (patch)
tree61410ed39e7658b3bc4e56d97ebc32bab51de7f4 /libclc/generic/lib/math/maxmag.inc
parentdbaf6d0f7ce8d4f590e0ec929726b3085ffc1799 (diff)
downloadbcm5719-llvm-4e72300929d9450f13190cd264d40268af08427c.tar.gz
bcm5719-llvm-4e72300929d9450f13190cd264d40268af08427c.zip
maxmag: Condition variable needs to be the same bitwidth as operands
No changes wrt CTS Reviewed-by: Aaron Watry <awatry@gmail.com> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 326817
Diffstat (limited to 'libclc/generic/lib/math/maxmag.inc')
-rw-r--r--libclc/generic/lib/math/maxmag.inc22
1 files changed, 20 insertions, 2 deletions
diff --git a/libclc/generic/lib/math/maxmag.inc b/libclc/generic/lib/math/maxmag.inc
index 88b0129835b..226316ab398 100644
--- a/libclc/generic/lib/math/maxmag.inc
+++ b/libclc/generic/lib/math/maxmag.inc
@@ -1,4 +1,22 @@
+#ifdef __CLC_SCALAR
+#define __CLC_VECSIZE
+#endif
+
+#if __CLC_FPSIZE == 64
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_long, __CLC_VECSIZE)
+#elif __CLC_FPSIZE == 32
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_int, __CLC_VECSIZE)
+#elif __CLC_FPSIZE == 16
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_short, __CLC_VECSIZE)
+#endif
+
_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)));
+ const __CLC_GENTYPE res = select(y, x, __CLC_CONVERT_NATN(isgreater(fabs(x), fabs(y))));
+ return select(res, fmax(x, y), __CLC_CONVERT_NATN(isnan(x) | isnan(y) | isequal(fabs(x), fabs(y))));
}
+
+#undef __CLC_CONVERT_NATN
+
+#ifdef __CLC_SCALAR
+#undef __CLC_VECSIZE
+#endif
OpenPOWER on IntegriCloud