[libclc] r356012 - sqrt: Split function generation to a shared inc file.

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 00:05:56 PDT 2019


Author: jvesely
Date: Wed Mar 13 00:05:56 2019
New Revision: 356012

URL: http://llvm.org/viewvc/llvm-project?rev=356012&view=rev
Log:
sqrt: Split function generation to a shared inc file.

This will be reused by other unary functions.
Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>

Added:
    libclc/trunk/generic/lib/math/unary_builtin.inc
Modified:
    libclc/trunk/generic/lib/math/sqrt.cl

Modified: libclc/trunk/generic/lib/math/sqrt.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/sqrt.cl?rev=356012&r1=356011&r2=356012&view=diff
==============================================================================
--- libclc/trunk/generic/lib/math/sqrt.cl (original)
+++ libclc/trunk/generic/lib/math/sqrt.cl Wed Mar 13 00:05:56 2019
@@ -21,23 +21,7 @@
  */
 
 #include <clc/clc.h>
-#include "../clcmacro.h"
 #include "math/clc_sqrt.h"
 
-_CLC_DEFINE_UNARY_BUILTIN(float, sqrt, __clc_sqrt, float)
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-_CLC_DEFINE_UNARY_BUILTIN(double, sqrt, __clc_sqrt, double)
-
-#endif
-
-#ifdef cl_khr_fp16
-
-#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-
-_CLC_DEFINE_UNARY_BUILTIN(half, sqrt, __clc_sqrt, half)
-
-#endif
+#define __CLC_FUNCTION sqrt
+#include "unary_builtin.inc"

Added: libclc/trunk/generic/lib/math/unary_builtin.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/unary_builtin.inc?rev=356012&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/unary_builtin.inc (added)
+++ libclc/trunk/generic/lib/math/unary_builtin.inc Wed Mar 13 00:05:56 2019
@@ -0,0 +1,24 @@
+#include "../clcmacro.h"
+#include "utils.h"
+
+#ifndef __CLC_BUILTIN
+#define __CLC_BUILTIN __CLC_XCONCAT(__clc_, __CLC_FUNCTION)
+#endif
+
+_CLC_DEFINE_UNARY_BUILTIN(float, __CLC_FUNCTION, __CLC_BUILTIN, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_DEFINE_UNARY_BUILTIN(double, __CLC_FUNCTION, __CLC_BUILTIN, double)
+
+#endif
+
+#ifdef cl_khr_fp16
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+_CLC_DEFINE_UNARY_BUILTIN(half, __CLC_FUNCTION, __CLC_BUILTIN, half)
+
+#endif




More information about the cfe-commits mailing list