summaryrefslogtreecommitdiffstats
path: root/libclc/generic/lib/integer/abs.inc
diff options
context:
space:
mode:
Diffstat (limited to 'libclc/generic/lib/integer/abs.inc')
-rw-r--r--libclc/generic/lib/integer/abs.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/libclc/generic/lib/integer/abs.inc b/libclc/generic/lib/integer/abs.inc
new file mode 100644
index 00000000000..fff6691274a
--- /dev/null
+++ b/libclc/generic/lib/integer/abs.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF UGENTYPE abs(GENTYPE x) {
+ return __builtin_astype((GENTYPE)(x > (GENTYPE)(0) ? x : -x), UGENTYPE);
+}
OpenPOWER on IntegriCloud