https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/157002
This partially reverts commit d50f2ef437aeb1784f7556fd63639487f245ffaa because _CLC_V_V_VP_VECTORIZE is also used in our downstream code: https://github.com/intel/llvm/blob/0433e4d6f5c9/libclc/libspirv/lib/ptx-nvidiacl/math/modf.cl#L30 https://github.com/intel/llvm/blob/0433e4d6f5c9/libclc/libspirv/lib/ptx-nvidiacl/math/sincos.cl#L31 >From 8390286ffa32ce98ba39cfbe313d9396ce0572fc Mon Sep 17 00:00:00 2001 From: Wenju He <wenju...@intel.com> Date: Fri, 5 Sep 2025 04:47:56 +0200 Subject: [PATCH] Revert "[NFC][libclc] Move _CLC_V_V_VP_VECTORIZE macro into clc_lgamma_r.cl and delete clcmacro.h (#156280)" This partially reverts commit d50f2ef437aeb1784f7556fd63639487f245ffaa because _CLC_V_V_VP_VECTORIZE is also used in our downstream code: https://github.com/intel/llvm/blob/0433e4d6f5c9/libclc/libspirv/lib/ptx-nvidiacl/math/modf.cl#L30 https://github.com/intel/llvm/blob/0433e4d6f5c9/libclc/libspirv/lib/ptx-nvidiacl/math/sincos.cl#L31 --- libclc/clc/include/clc/clcmacro.h | 69 +++++++++++++++++++++ libclc/clc/lib/generic/math/clc_lgamma_r.cl | 55 +--------------- 2 files changed, 70 insertions(+), 54 deletions(-) create mode 100644 libclc/clc/include/clc/clcmacro.h diff --git a/libclc/clc/include/clc/clcmacro.h b/libclc/clc/include/clc/clcmacro.h new file mode 100644 index 0000000000000..9fa11489b1457 --- /dev/null +++ b/libclc/clc/include/clc/clcmacro.h @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef __CLC_CLCMACRO_H__ +#define __CLC_CLCMACRO_H__ + +#include <clc/internal/clc.h> +#include <clc/utils.h> + +#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, __CLC_FUNCTION, ARG1_TYPE, \ + ADDR_SPACE, ARG2_TYPE) \ + DECLSPEC __CLC_XCONCAT(RET_TYPE, 2) \ + __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 2) x, \ + ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 2) * y) { \ + ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ + return (__CLC_XCONCAT(RET_TYPE, 2))(__CLC_FUNCTION(x.s0, ptr), \ + __CLC_FUNCTION(x.s1, ptr + 1)); \ + } \ + \ + DECLSPEC __CLC_XCONCAT(RET_TYPE, 3) \ + __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 3) x, \ + ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 3) * y) { \ + ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ + return (__CLC_XCONCAT(RET_TYPE, 3))(__CLC_FUNCTION(x.s0, ptr), \ + __CLC_FUNCTION(x.s1, ptr + 1), \ + __CLC_FUNCTION(x.s2, ptr + 2)); \ + } \ + \ + DECLSPEC __CLC_XCONCAT(RET_TYPE, 4) \ + __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 4) x, \ + ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 4) * y) { \ + ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ + return (__CLC_XCONCAT(RET_TYPE, 4))( \ + __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ + __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3)); \ + } \ + \ + DECLSPEC __CLC_XCONCAT(RET_TYPE, 8) \ + __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 8) x, \ + ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 8) * y) { \ + ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ + return (__CLC_XCONCAT(RET_TYPE, 8))( \ + __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ + __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3), \ + __CLC_FUNCTION(x.s4, ptr + 4), __CLC_FUNCTION(x.s5, ptr + 5), \ + __CLC_FUNCTION(x.s6, ptr + 6), __CLC_FUNCTION(x.s7, ptr + 7)); \ + } \ + \ + DECLSPEC __CLC_XCONCAT(RET_TYPE, 16) \ + __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 16) x, \ + ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 16) * y) { \ + ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ + return (__CLC_XCONCAT(RET_TYPE, 16))( \ + __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ + __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3), \ + __CLC_FUNCTION(x.s4, ptr + 4), __CLC_FUNCTION(x.s5, ptr + 5), \ + __CLC_FUNCTION(x.s6, ptr + 6), __CLC_FUNCTION(x.s7, ptr + 7), \ + __CLC_FUNCTION(x.s8, ptr + 8), __CLC_FUNCTION(x.s9, ptr + 9), \ + __CLC_FUNCTION(x.sa, ptr + 10), __CLC_FUNCTION(x.sb, ptr + 11), \ + __CLC_FUNCTION(x.sc, ptr + 12), __CLC_FUNCTION(x.sd, ptr + 13), \ + __CLC_FUNCTION(x.se, ptr + 14), __CLC_FUNCTION(x.sf, ptr + 15)); \ + } + +#endif // __CLC_CLCMACRO_H__ diff --git a/libclc/clc/lib/generic/math/clc_lgamma_r.cl b/libclc/clc/lib/generic/math/clc_lgamma_r.cl index 662b34a69bb72..20aa80a63dd37 100644 --- a/libclc/clc/lib/generic/math/clc_lgamma_r.cl +++ b/libclc/clc/lib/generic/math/clc_lgamma_r.cl @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include <clc/clc_convert.h> +#include <clc/clcmacro.h> #include <clc/float/definitions.h> #include <clc/internal/clc.h> #include <clc/math/clc_fabs.h> @@ -16,60 +17,6 @@ #include <clc/math/clc_sinpi.h> #include <clc/math/math.h> -#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, __CLC_FUNCTION, ARG1_TYPE, \ - ADDR_SPACE, ARG2_TYPE) \ - DECLSPEC __CLC_XCONCAT(RET_TYPE, 2) \ - __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 2) x, \ - ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 2) * y) { \ - ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ - return (__CLC_XCONCAT(RET_TYPE, 2))(__CLC_FUNCTION(x.s0, ptr), \ - __CLC_FUNCTION(x.s1, ptr + 1)); \ - } \ - \ - DECLSPEC __CLC_XCONCAT(RET_TYPE, 3) \ - __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 3) x, \ - ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 3) * y) { \ - ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ - return (__CLC_XCONCAT(RET_TYPE, 3))(__CLC_FUNCTION(x.s0, ptr), \ - __CLC_FUNCTION(x.s1, ptr + 1), \ - __CLC_FUNCTION(x.s2, ptr + 2)); \ - } \ - \ - DECLSPEC __CLC_XCONCAT(RET_TYPE, 4) \ - __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 4) x, \ - ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 4) * y) { \ - ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ - return (__CLC_XCONCAT(RET_TYPE, 4))( \ - __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ - __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3)); \ - } \ - \ - DECLSPEC __CLC_XCONCAT(RET_TYPE, 8) \ - __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 8) x, \ - ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 8) * y) { \ - ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ - return (__CLC_XCONCAT(RET_TYPE, 8))( \ - __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ - __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3), \ - __CLC_FUNCTION(x.s4, ptr + 4), __CLC_FUNCTION(x.s5, ptr + 5), \ - __CLC_FUNCTION(x.s6, ptr + 6), __CLC_FUNCTION(x.s7, ptr + 7)); \ - } \ - \ - DECLSPEC __CLC_XCONCAT(RET_TYPE, 16) \ - __CLC_FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 16) x, \ - ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 16) * y) { \ - ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \ - return (__CLC_XCONCAT(RET_TYPE, 16))( \ - __CLC_FUNCTION(x.s0, ptr), __CLC_FUNCTION(x.s1, ptr + 1), \ - __CLC_FUNCTION(x.s2, ptr + 2), __CLC_FUNCTION(x.s3, ptr + 3), \ - __CLC_FUNCTION(x.s4, ptr + 4), __CLC_FUNCTION(x.s5, ptr + 5), \ - __CLC_FUNCTION(x.s6, ptr + 6), __CLC_FUNCTION(x.s7, ptr + 7), \ - __CLC_FUNCTION(x.s8, ptr + 8), __CLC_FUNCTION(x.s9, ptr + 9), \ - __CLC_FUNCTION(x.sa, ptr + 10), __CLC_FUNCTION(x.sb, ptr + 11), \ - __CLC_FUNCTION(x.sc, ptr + 12), __CLC_FUNCTION(x.sd, ptr + 13), \ - __CLC_FUNCTION(x.se, ptr + 14), __CLC_FUNCTION(x.sf, ptr + 15)); \ - } - // ==================================================== // Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. // _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits