[libclc] libclc: add half version of 'sign' (PR #99841)

Romaric Jodin via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 00:46:57 PDT 2024


https://github.com/rjodinchr created https://github.com/llvm/llvm-project/pull/99841

None

>From 009987936213d404a7dd28b5f1551ce85e6c8560 Mon Sep 17 00:00:00 2001
From: Romaric Jodin <rjodin at chromium.org>
Date: Mon, 22 Jul 2024 09:44:01 +0200
Subject: [PATCH] libclc: add half version of 'sign'

---
 libclc/generic/lib/common/sign.cl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libclc/generic/lib/common/sign.cl b/libclc/generic/lib/common/sign.cl
index 25832e0b4f8b9..7b6b793be79c1 100644
--- a/libclc/generic/lib/common/sign.cl
+++ b/libclc/generic/lib/common/sign.cl
@@ -26,3 +26,12 @@ SIGN(double, )
 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sign, double)
 
 #endif
+
+#ifdef cl_khr_fp16
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+SIGN(half,)
+_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, sign, half)
+
+#endif



More information about the cfe-commits mailing list