[libclc] [NFC][libclc] add missing __CLC_ prefix all internal macros (PR #153523)
Wenju He via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 13 19:11:16 PDT 2025
https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/153523
This unifies naming scheme of macros to address review comment https://github.com/intel/llvm/pull/19779#discussion_r2272194357
math constant value macros are not changed, e.g.
`#define AU0 -9.86494292470009928597e-03`
>From 8fb06b7ffa79e2bba5535d0fbcb50a4336d877b0 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Thu, 14 Aug 2025 04:00:27 +0200
Subject: [PATCH] [NFC][libclc] add missing __CLC_ prefix all internal macros
This unifies naming scheme of macros to address review comment
https://github.com/intel/llvm/pull/19779#discussion_r2272194357
math constant value macros are not changed, e.g.
`#define AU0 -9.86494292470009928597e-03`
---
libclc/clc/include/clc/atomic/atomic_decl.inc | 12 +-
.../clc/atomic/clc_atomic_compare_exchange.h | 4 +-
.../clc/include/clc/atomic/clc_atomic_dec.h | 4 +-
.../include/clc/atomic/clc_atomic_exchange.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_add.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_and.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_max.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_min.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_or.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_sub.h | 4 +-
.../include/clc/atomic/clc_atomic_fetch_xor.h | 4 +-
.../clc/include/clc/atomic/clc_atomic_inc.h | 4 +-
.../clc/include/clc/atomic/clc_atomic_load.h | 4 +-
.../clc/include/clc/atomic/clc_atomic_store.h | 4 +-
libclc/clc/include/clc/clcmacro.h | 60 +--
libclc/clc/include/clc/common/clc_degrees.h | 4 +-
libclc/clc/include/clc/common/clc_radians.h | 4 +-
libclc/clc/include/clc/common/clc_sign.h | 4 +-
libclc/clc/include/clc/common/clc_step.h | 4 +-
.../clc/include/clc/geometric/binary_decl.inc | 2 +-
.../clc/include/clc/geometric/binary_def.inc | 10 +-
.../clc/include/clc/geometric/clc_distance.h | 4 +-
libclc/clc/include/clc/geometric/clc_dot.h | 4 +-
.../include/clc/geometric/clc_fast_distance.h | 6 +-
.../include/clc/geometric/clc_fast_length.h | 6 +-
.../clc/geometric/clc_fast_normalize.h | 6 +-
libclc/clc/include/clc/geometric/clc_length.h | 4 +-
.../clc/include/clc/geometric/clc_normalize.h | 4 +-
.../clc/include/clc/geometric/unary_decl.inc | 2 +-
.../clc/include/clc/geometric/unary_def.inc | 8 +-
libclc/clc/include/clc/integer/clc_add_sat.h | 4 +-
.../clc/include/clc/integer/clc_bit_reverse.h | 4 +-
.../clc/integer/clc_bitfield_extract_decl.inc | 4 +-
.../clc/integer/clc_bitfield_extract_signed.h | 8 +-
.../integer/clc_bitfield_extract_unsigned.h | 8 +-
.../include/clc/integer/clc_bitfield_insert.h | 2 +-
.../clc/integer/clc_bitfield_insert.inc | 6 +-
libclc/clc/include/clc/integer/clc_clz.h | 4 +-
libclc/clc/include/clc/integer/clc_ctz.h | 4 +-
libclc/clc/include/clc/integer/clc_hadd.h | 4 +-
libclc/clc/include/clc/integer/clc_mad24.h | 4 +-
libclc/clc/include/clc/integer/clc_mad_sat.h | 4 +-
libclc/clc/include/clc/integer/clc_mul24.h | 4 +-
libclc/clc/include/clc/integer/clc_mul_hi.h | 4 +-
libclc/clc/include/clc/integer/clc_popcount.h | 4 +-
libclc/clc/include/clc/integer/clc_rhadd.h | 4 +-
libclc/clc/include/clc/integer/clc_rotate.h | 4 +-
libclc/clc/include/clc/integer/clc_sub_sat.h | 4 +-
.../include/clc/internal/math/clc_sw_fma.h | 4 +-
.../binary_decl_with_scalar_second_arg.inc | 6 +-
.../include/clc/math/binary_def_via_fp32.inc | 6 +-
libclc/clc/include/clc/math/clc_acos.h | 4 +-
libclc/clc/include/clc/math/clc_acosh.h | 4 +-
libclc/clc/include/clc/math/clc_acospi.h | 4 +-
libclc/clc/include/clc/math/clc_asin.h | 4 +-
libclc/clc/include/clc/math/clc_asinh.h | 4 +-
libclc/clc/include/clc/math/clc_asinpi.h | 4 +-
libclc/clc/include/clc/math/clc_atan.h | 4 +-
libclc/clc/include/clc/math/clc_atan2.h | 4 +-
libclc/clc/include/clc/math/clc_atan2pi.h | 4 +-
libclc/clc/include/clc/math/clc_atanh.h | 4 +-
libclc/clc/include/clc/math/clc_atanpi.h | 4 +-
libclc/clc/include/clc/math/clc_cbrt.inc | 4 +-
libclc/clc/include/clc/math/clc_ceil.h | 4 +-
libclc/clc/include/clc/math/clc_copysign.h | 4 +-
libclc/clc/include/clc/math/clc_cos.h | 4 +-
libclc/clc/include/clc/math/clc_cosh.h | 4 +-
libclc/clc/include/clc/math/clc_cospi.h | 4 +-
libclc/clc/include/clc/math/clc_erf.h | 4 +-
libclc/clc/include/clc/math/clc_erfc.h | 4 +-
libclc/clc/include/clc/math/clc_exp.h | 4 +-
libclc/clc/include/clc/math/clc_exp10.h | 4 +-
libclc/clc/include/clc/math/clc_exp2.h | 4 +-
libclc/clc/include/clc/math/clc_exp_helper.h | 2 +-
libclc/clc/include/clc/math/clc_expm1.h | 4 +-
libclc/clc/include/clc/math/clc_fabs.h | 4 +-
libclc/clc/include/clc/math/clc_fdim.h | 4 +-
libclc/clc/include/clc/math/clc_floor.h | 4 +-
libclc/clc/include/clc/math/clc_fma.h | 4 +-
libclc/clc/include/clc/math/clc_fmax.h | 4 +-
libclc/clc/include/clc/math/clc_fmin.h | 4 +-
libclc/clc/include/clc/math/clc_fmod.h | 4 +-
libclc/clc/include/clc/math/clc_fract.h | 4 +-
libclc/clc/include/clc/math/clc_frexp.h | 4 +-
libclc/clc/include/clc/math/clc_half_cos.h | 6 +-
libclc/clc/include/clc/math/clc_half_divide.h | 6 +-
libclc/clc/include/clc/math/clc_half_exp.h | 6 +-
libclc/clc/include/clc/math/clc_half_exp10.h | 6 +-
libclc/clc/include/clc/math/clc_half_exp2.h | 6 +-
libclc/clc/include/clc/math/clc_half_log.h | 6 +-
libclc/clc/include/clc/math/clc_half_log10.h | 6 +-
libclc/clc/include/clc/math/clc_half_log2.h | 6 +-
libclc/clc/include/clc/math/clc_half_powr.h | 6 +-
libclc/clc/include/clc/math/clc_half_recip.h | 6 +-
libclc/clc/include/clc/math/clc_half_rsqrt.h | 6 +-
libclc/clc/include/clc/math/clc_half_sin.h | 6 +-
libclc/clc/include/clc/math/clc_half_sqrt.h | 6 +-
libclc/clc/include/clc/math/clc_half_tan.h | 6 +-
libclc/clc/include/clc/math/clc_hypot.h | 4 +-
libclc/clc/include/clc/math/clc_ilogb.h | 4 +-
libclc/clc/include/clc/math/clc_lgamma.h | 4 +-
libclc/clc/include/clc/math/clc_lgamma_r.h | 4 +-
libclc/clc/include/clc/math/clc_log.h | 4 +-
libclc/clc/include/clc/math/clc_log10.h | 4 +-
libclc/clc/include/clc/math/clc_log1p.h | 4 +-
libclc/clc/include/clc/math/clc_log2.h | 4 +-
libclc/clc/include/clc/math/clc_logb.h | 4 +-
libclc/clc/include/clc/math/clc_mad.h | 4 +-
libclc/clc/include/clc/math/clc_maxmag.h | 4 +-
libclc/clc/include/clc/math/clc_minmag.h | 4 +-
libclc/clc/include/clc/math/clc_modf.h | 4 +-
libclc/clc/include/clc/math/clc_nan.h | 4 +-
libclc/clc/include/clc/math/clc_native_cos.h | 6 +-
.../clc/include/clc/math/clc_native_divide.h | 6 +-
libclc/clc/include/clc/math/clc_native_exp.h | 6 +-
.../clc/include/clc/math/clc_native_exp10.h | 6 +-
libclc/clc/include/clc/math/clc_native_exp2.h | 6 +-
libclc/clc/include/clc/math/clc_native_log.h | 6 +-
.../clc/include/clc/math/clc_native_log10.h | 6 +-
libclc/clc/include/clc/math/clc_native_log2.h | 6 +-
libclc/clc/include/clc/math/clc_native_powr.h | 6 +-
.../clc/include/clc/math/clc_native_recip.h | 6 +-
.../clc/include/clc/math/clc_native_rsqrt.h | 6 +-
libclc/clc/include/clc/math/clc_native_sin.h | 6 +-
libclc/clc/include/clc/math/clc_native_sqrt.h | 6 +-
libclc/clc/include/clc/math/clc_native_tan.h | 6 +-
libclc/clc/include/clc/math/clc_nextafter.h | 4 +-
libclc/clc/include/clc/math/clc_pow.h | 4 +-
libclc/clc/include/clc/math/clc_pown.h | 4 +-
libclc/clc/include/clc/math/clc_powr.h | 4 +-
libclc/clc/include/clc/math/clc_remainder.h | 4 +-
libclc/clc/include/clc/math/clc_remquo.h | 4 +-
libclc/clc/include/clc/math/clc_rint.h | 4 +-
libclc/clc/include/clc/math/clc_rootn.h | 4 +-
libclc/clc/include/clc/math/clc_round.h | 4 +-
libclc/clc/include/clc/math/clc_rsqrt.h | 4 +-
libclc/clc/include/clc/math/clc_sin.h | 4 +-
libclc/clc/include/clc/math/clc_sincos.h | 4 +-
.../clc/include/clc/math/clc_sincos_helpers.h | 4 +-
libclc/clc/include/clc/math/clc_sinh.h | 4 +-
libclc/clc/include/clc/math/clc_sinpi.h | 4 +-
libclc/clc/include/clc/math/clc_sqrt.h | 4 +-
libclc/clc/include/clc/math/clc_tan.h | 4 +-
libclc/clc/include/clc/math/clc_tanh.h | 4 +-
libclc/clc/include/clc/math/clc_tanpi.h | 4 +-
libclc/clc/include/clc/math/clc_tgamma.h | 4 +-
libclc/clc/include/clc/math/clc_trunc.h | 4 +-
libclc/clc/include/clc/math/gentype.inc | 12 +-
libclc/clc/include/clc/math/math.h | 2 -
libclc/clc/include/clc/math/remquo_decl.inc | 20 +-
libclc/clc/include/clc/math/tables.h | 120 ++---
libclc/clc/include/clc/math/unary_decl.inc | 3 +-
.../clc/math/unary_decl_with_int_ptr.inc | 16 +-
.../clc/math/unary_decl_with_int_return.inc | 2 +-
.../include/clc/math/unary_decl_with_ptr.inc | 16 +-
.../clc/math/unary_def_with_int_ptr.inc | 28 +-
.../clc/math/unary_def_with_int_return.inc | 8 +-
.../include/clc/math/unary_def_with_ptr.inc | 28 +-
libclc/clc/include/clc/misc/clc_shuffle.h | 4 +-
libclc/clc/include/clc/misc/clc_shuffle2.h | 4 +-
libclc/clc/include/clc/misc/shuffle2_decl.inc | 16 +-
libclc/clc/include/clc/misc/shuffle2_def.inc | 30 +-
libclc/clc/include/clc/misc/shuffle_decl.inc | 8 +-
libclc/clc/include/clc/misc/shuffle_def.inc | 22 +-
.../include/clc/relational/binary_decl.inc | 10 +-
.../clc/include/clc/relational/clc_isfinite.h | 4 +-
.../include/clc/relational/clc_isgreater.h | 4 +-
.../clc/relational/clc_isgreaterequal.h | 4 +-
.../clc/include/clc/relational/clc_isless.h | 4 +-
.../include/clc/relational/clc_islessequal.h | 4 +-
.../clc/relational/clc_islessgreater.h | 4 +-
.../clc/include/clc/relational/clc_isnormal.h | 4 +-
.../include/clc/relational/clc_isnotequal.h | 4 +-
.../include/clc/relational/clc_isordered.h | 4 +-
.../include/clc/relational/clc_isunordered.h | 4 +-
.../clc/include/clc/relational/clc_signbit.h | 4 +-
.../clc/include/clc/relational/relational.h | 49 ++-
.../clc/include/clc/relational/unary_decl.inc | 9 +-
libclc/clc/include/clc/shared/binary_decl.inc | 4 +-
.../binary_decl_with_int_second_arg.inc | 4 +-
libclc/clc/include/clc/shared/binary_def.inc | 10 +-
.../clc/shared/binary_def_scalarize.inc | 94 ++--
.../shared/binary_def_with_int_second_arg.inc | 9 +-
.../binary_def_with_scalar_second_arg.inc | 16 +-
libclc/clc/include/clc/shared/clc_vload.inc | 50 +--
libclc/clc/include/clc/shared/clc_vstore.inc | 66 +--
.../clc/include/clc/shared/ternary_decl.inc | 5 +-
libclc/clc/include/clc/shared/ternary_def.inc | 11 +-
.../clc/shared/ternary_def_scalarize.inc | 103 +++--
libclc/clc/include/clc/shared/unary_decl.inc | 3 +-
libclc/clc/include/clc/shared/unary_def.inc | 8 +-
.../clc/shared/unary_def_scalarize.inc | 56 +--
.../clc/lib/amdgcn/math/clc_ldexp_override.cl | 14 +-
libclc/clc/lib/amdgpu/math/clc_half_exp.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_exp10.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_exp2.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_log.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_log10.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_log2.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_recip.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_native_exp.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_native_exp2.cl | 6 +-
.../clc/lib/amdgpu/math/clc_native_log10.cl | 2 +-
libclc/clc/lib/amdgpu/math/clc_sqrt_fp64.cl | 4 +-
libclc/clc/lib/clspv/math/clc_sw_fma.cl | 4 +-
.../clc/lib/generic/atomic/clc_atomic_dec.cl | 4 +-
.../clc/lib/generic/atomic/clc_atomic_def.inc | 26 +-
.../lib/generic/atomic/clc_atomic_exchange.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_add.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_and.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_max.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_min.cl | 4 +-
.../lib/generic/atomic/clc_atomic_fetch_or.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_sub.cl | 4 +-
.../generic/atomic/clc_atomic_fetch_xor.cl | 4 +-
.../clc/lib/generic/atomic/clc_atomic_inc.cl | 4 +-
.../clc/lib/generic/atomic/clc_atomic_load.cl | 4 +-
.../lib/generic/atomic/clc_atomic_store.cl | 4 +-
libclc/clc/lib/generic/common/clc_radians.cl | 22 +-
.../generic/geometric/clc_fast_distance.cl | 2 +-
.../generic/geometric/clc_fast_normalize.cl | 2 +-
libclc/clc/lib/generic/integer/clc_add_sat.cl | 4 +-
.../lib/generic/integer/clc_bit_reverse.cl | 4 +-
libclc/clc/lib/generic/integer/clc_clz.cl | 2 +-
libclc/clc/lib/generic/integer/clc_ctz.cl | 2 +-
.../clc/lib/generic/integer/clc_popcount.cl | 4 +-
libclc/clc/lib/generic/integer/clc_sub_sat.cl | 4 +-
libclc/clc/lib/generic/math/clc_atan2.inc | 4 +-
libclc/clc/lib/generic/math/clc_atan2pi.inc | 4 +-
libclc/clc/lib/generic/math/clc_cbrt.inc | 16 +-
libclc/clc/lib/generic/math/clc_ceil.cl | 4 +-
libclc/clc/lib/generic/math/clc_copysign.cl | 4 +-
libclc/clc/lib/generic/math/clc_cosh.inc | 12 +-
libclc/clc/lib/generic/math/clc_ep_log.inc | 4 +-
libclc/clc/lib/generic/math/clc_erf.cl | 2 +-
libclc/clc/lib/generic/math/clc_erfc.cl | 2 +-
libclc/clc/lib/generic/math/clc_exp10.inc | 6 +-
libclc/clc/lib/generic/math/clc_exp_helper.cl | 2 +-
.../clc/lib/generic/math/clc_exp_helper.inc | 4 +-
libclc/clc/lib/generic/math/clc_expm1.inc | 8 +-
libclc/clc/lib/generic/math/clc_fabs.cl | 4 +-
libclc/clc/lib/generic/math/clc_floor.cl | 4 +-
libclc/clc/lib/generic/math/clc_fmax.cl | 4 +-
libclc/clc/lib/generic/math/clc_fmin.cl | 4 +-
libclc/clc/lib/generic/math/clc_fmod.cl | 16 +-
libclc/clc/lib/generic/math/clc_fract.inc | 8 +-
libclc/clc/lib/generic/math/clc_half_cos.cl | 6 +-
.../clc/lib/generic/math/clc_half_divide.cl | 2 +-
libclc/clc/lib/generic/math/clc_half_exp.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_exp10.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_exp2.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_log.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_log10.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_log2.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_powr.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_recip.cl | 2 +-
libclc/clc/lib/generic/math/clc_half_rsqrt.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_sin.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_sqrt.cl | 6 +-
libclc/clc/lib/generic/math/clc_half_tan.cl | 6 +-
libclc/clc/lib/generic/math/clc_ldexp.cl | 2 +-
libclc/clc/lib/generic/math/clc_log.cl | 2 +-
libclc/clc/lib/generic/math/clc_log10.cl | 2 +-
libclc/clc/lib/generic/math/clc_log1p.inc | 10 +-
libclc/clc/lib/generic/math/clc_log2.cl | 2 +-
libclc/clc/lib/generic/math/clc_log_base.h | 12 +-
libclc/clc/lib/generic/math/clc_modf.inc | 10 +-
libclc/clc/lib/generic/math/clc_native_cos.cl | 6 +-
.../clc/lib/generic/math/clc_native_divide.cl | 2 +-
libclc/clc/lib/generic/math/clc_native_exp.cl | 6 +-
.../clc/lib/generic/math/clc_native_exp10.cl | 2 +-
.../clc/lib/generic/math/clc_native_exp2.cl | 6 +-
libclc/clc/lib/generic/math/clc_native_log.cl | 6 +-
.../clc/lib/generic/math/clc_native_log10.cl | 6 +-
.../clc/lib/generic/math/clc_native_log2.cl | 6 +-
.../clc/lib/generic/math/clc_native_powr.cl | 2 +-
.../clc/lib/generic/math/clc_native_recip.cl | 2 +-
.../clc/lib/generic/math/clc_native_rsqrt.cl | 2 +-
libclc/clc/lib/generic/math/clc_native_sin.cl | 6 +-
.../clc/lib/generic/math/clc_native_sqrt.cl | 6 +-
libclc/clc/lib/generic/math/clc_native_tan.cl | 2 +-
libclc/clc/lib/generic/math/clc_nextafter.cl | 70 +--
libclc/clc/lib/generic/math/clc_pow.inc | 24 +-
libclc/clc/lib/generic/math/clc_pown.inc | 24 +-
libclc/clc/lib/generic/math/clc_powr.inc | 24 +-
libclc/clc/lib/generic/math/clc_remainder.cl | 16 +-
libclc/clc/lib/generic/math/clc_remquo.inc | 34 +-
libclc/clc/lib/generic/math/clc_rint.cl | 4 +-
libclc/clc/lib/generic/math/clc_rootn.inc | 25 +-
libclc/clc/lib/generic/math/clc_round.cl | 4 +-
.../lib/generic/math/clc_sincos_helpers.cl | 8 +-
.../lib/generic/math/clc_sincos_helpers.inc | 14 +-
.../generic/math/clc_sincos_helpers_fp64.inc | 10 +-
libclc/clc/lib/generic/math/clc_sinh.inc | 12 +-
libclc/clc/lib/generic/math/clc_sw_fma.cl | 4 +-
libclc/clc/lib/generic/math/clc_tables.cl | 414 +++++++++---------
libclc/clc/lib/generic/math/clc_tgamma.cl | 2 +-
libclc/clc/lib/generic/math/clc_trunc.cl | 4 +-
.../lib/generic/relational/clc_bitselect.cl | 38 +-
.../clc/lib/generic/relational/clc_signbit.cl | 72 +--
libclc/clc/lib/generic/shared/clc_vload.cl | 112 ++---
.../clc/lib/generic/shared/clc_vload_half.inc | 23 +-
libclc/clc/lib/generic/shared/clc_vstore.cl | 123 +++---
.../lib/generic/shared/clc_vstore_half.inc | 24 +-
libclc/clc/lib/ptx-nvidiacl/math/clc_log.cl | 2 +-
libclc/clc/lib/ptx-nvidiacl/math/clc_rsqrt.cl | 2 +-
libclc/clc/lib/ptx-nvidiacl/math/clc_sinpi.cl | 2 +-
libclc/clc/lib/ptx-nvidiacl/math/clc_sqrt.cl | 2 +-
.../lib/ptx-nvidiacl/relational/clc_isinf.cl | 2 +-
libclc/clc/lib/r600/math/clc_native_rsqrt.cl | 4 +-
.../clc/lib/r600/math/clc_rsqrt_override.cl | 12 +-
libclc/clc/lib/spirv/math/clc_fmax.cl | 2 +-
libclc/clc/lib/spirv/math/clc_fmin.cl | 2 +-
.../include/clc/opencl/atomic/atom_add.h | 6 +-
.../include/clc/opencl/atomic/atom_and.h | 6 +-
.../clc/opencl/atomic/atom_decl_int32.inc | 4 +-
.../clc/opencl/atomic/atom_decl_int64.inc | 4 +-
.../include/clc/opencl/atomic/atom_max.h | 6 +-
.../include/clc/opencl/atomic/atom_min.h | 6 +-
.../include/clc/opencl/atomic/atom_or.h | 6 +-
.../include/clc/opencl/atomic/atom_sub.h | 6 +-
.../include/clc/opencl/atomic/atom_xchg.h | 6 +-
.../include/clc/opencl/atomic/atom_xor.h | 6 +-
.../include/clc/opencl/atomic/atomic_add.h | 2 +-
.../include/clc/opencl/atomic/atomic_and.h | 2 +-
.../atomic/atomic_compare_exchange_strong.h | 4 +-
.../atomic/atomic_compare_exchange_weak.h | 4 +-
.../include/clc/opencl/atomic/atomic_decl.inc | 29 +-
.../clc/opencl/atomic/atomic_decl_legacy.inc | 4 +-
.../clc/opencl/atomic/atomic_exchange.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_add.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_and.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_max.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_min.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_or.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_sub.h | 4 +-
.../clc/opencl/atomic/atomic_fetch_xor.h | 4 +-
.../include/clc/opencl/atomic/atomic_load.h | 4 +-
.../include/clc/opencl/atomic/atomic_max.h | 2 +-
.../include/clc/opencl/atomic/atomic_min.h | 2 +-
.../include/clc/opencl/atomic/atomic_or.h | 2 +-
.../include/clc/opencl/atomic/atomic_store.h | 4 +-
.../include/clc/opencl/atomic/atomic_sub.h | 2 +-
.../include/clc/opencl/atomic/atomic_xchg.h | 6 +-
.../include/clc/opencl/atomic/atomic_xor.h | 2 +-
.../include/clc/opencl/common/degrees.h | 4 +-
.../include/clc/opencl/common/radians.h | 4 +-
.../opencl/include/clc/opencl/common/sign.h | 4 +-
.../include/clc/opencl/geometric/distance.h | 4 +-
.../opencl/include/clc/opencl/geometric/dot.h | 4 +-
.../clc/opencl/geometric/fast_distance.h | 6 +-
.../clc/opencl/geometric/fast_length.h | 6 +-
.../clc/opencl/geometric/fast_normalize.h | 6 +-
.../include/clc/opencl/geometric/length.h | 4 +-
.../include/clc/opencl/geometric/normalize.h | 4 +-
.../include/clc/opencl/integer/add_sat.h | 4 +-
.../include/clc/opencl/integer/bit_reverse.h | 4 +-
.../opencl/integer/bitfield_extract_signed.h | 8 +-
.../integer/bitfield_extract_unsigned.h | 8 +-
.../clc/opencl/integer/bitfield_insert.h | 2 +-
.../opencl/include/clc/opencl/integer/clz.h | 4 +-
.../opencl/include/clc/opencl/integer/ctz.h | 4 +-
.../opencl/include/clc/opencl/integer/hadd.h | 4 +-
.../opencl/include/clc/opencl/integer/mad24.h | 4 +-
.../include/clc/opencl/integer/mad_hi.h | 4 +-
.../include/clc/opencl/integer/mad_sat.h | 4 +-
.../opencl/include/clc/opencl/integer/mul24.h | 4 +-
.../include/clc/opencl/integer/mul_hi.h | 4 +-
.../include/clc/opencl/integer/popcount.h | 4 +-
.../opencl/include/clc/opencl/integer/rhadd.h | 4 +-
.../include/clc/opencl/integer/rotate.h | 4 +-
.../include/clc/opencl/integer/sub_sat.h | 4 +-
libclc/opencl/include/clc/opencl/math/acos.h | 4 +-
libclc/opencl/include/clc/opencl/math/acosh.h | 4 +-
.../opencl/include/clc/opencl/math/acospi.h | 4 +-
libclc/opencl/include/clc/opencl/math/asin.h | 4 +-
libclc/opencl/include/clc/opencl/math/asinh.h | 4 +-
.../opencl/include/clc/opencl/math/asinpi.h | 4 +-
libclc/opencl/include/clc/opencl/math/atan.h | 4 +-
libclc/opencl/include/clc/opencl/math/atan2.h | 4 +-
.../opencl/include/clc/opencl/math/atan2pi.h | 4 +-
libclc/opencl/include/clc/opencl/math/atanh.h | 4 +-
.../opencl/include/clc/opencl/math/atanpi.h | 4 +-
libclc/opencl/include/clc/opencl/math/cbrt.h | 4 +-
libclc/opencl/include/clc/opencl/math/ceil.h | 4 +-
.../opencl/include/clc/opencl/math/copysign.h | 4 +-
libclc/opencl/include/clc/opencl/math/cos.h | 4 +-
libclc/opencl/include/clc/opencl/math/cosh.h | 4 +-
libclc/opencl/include/clc/opencl/math/cospi.h | 4 +-
libclc/opencl/include/clc/opencl/math/erf.h | 4 +-
libclc/opencl/include/clc/opencl/math/erfc.h | 4 +-
libclc/opencl/include/clc/opencl/math/exp.h | 4 +-
libclc/opencl/include/clc/opencl/math/exp10.h | 4 +-
libclc/opencl/include/clc/opencl/math/exp2.h | 4 +-
libclc/opencl/include/clc/opencl/math/expm1.h | 4 +-
libclc/opencl/include/clc/opencl/math/fabs.h | 4 +-
libclc/opencl/include/clc/opencl/math/fdim.h | 4 +-
libclc/opencl/include/clc/opencl/math/floor.h | 4 +-
libclc/opencl/include/clc/opencl/math/fma.h | 4 +-
libclc/opencl/include/clc/opencl/math/fmax.h | 4 +-
libclc/opencl/include/clc/opencl/math/fmin.h | 4 +-
libclc/opencl/include/clc/opencl/math/fmod.h | 4 +-
libclc/opencl/include/clc/opencl/math/fract.h | 4 +-
libclc/opencl/include/clc/opencl/math/frexp.h | 4 +-
.../opencl/include/clc/opencl/math/half_cos.h | 6 +-
.../include/clc/opencl/math/half_divide.h | 4 +-
.../opencl/include/clc/opencl/math/half_exp.h | 6 +-
.../include/clc/opencl/math/half_exp10.h | 6 +-
.../include/clc/opencl/math/half_exp2.h | 6 +-
.../opencl/include/clc/opencl/math/half_log.h | 6 +-
.../include/clc/opencl/math/half_log10.h | 6 +-
.../include/clc/opencl/math/half_log2.h | 6 +-
.../include/clc/opencl/math/half_powr.h | 4 +-
.../include/clc/opencl/math/half_recip.h | 6 +-
.../include/clc/opencl/math/half_rsqrt.h | 6 +-
.../opencl/include/clc/opencl/math/half_sin.h | 6 +-
.../include/clc/opencl/math/half_sqrt.h | 6 +-
.../opencl/include/clc/opencl/math/half_tan.h | 6 +-
libclc/opencl/include/clc/opencl/math/hypot.h | 4 +-
libclc/opencl/include/clc/opencl/math/ilogb.h | 4 +-
libclc/opencl/include/clc/opencl/math/ldexp.h | 4 +-
.../opencl/include/clc/opencl/math/lgamma.h | 4 +-
.../opencl/include/clc/opencl/math/lgamma_r.h | 4 +-
libclc/opencl/include/clc/opencl/math/log.h | 4 +-
libclc/opencl/include/clc/opencl/math/log10.h | 4 +-
libclc/opencl/include/clc/opencl/math/log1p.h | 4 +-
libclc/opencl/include/clc/opencl/math/log2.h | 4 +-
libclc/opencl/include/clc/opencl/math/logb.h | 4 +-
libclc/opencl/include/clc/opencl/math/mad.h | 4 +-
.../opencl/include/clc/opencl/math/maxmag.h | 4 +-
.../opencl/include/clc/opencl/math/minmag.h | 4 +-
libclc/opencl/include/clc/opencl/math/modf.h | 4 +-
.../include/clc/opencl/math/native_cos.h | 6 +-
.../include/clc/opencl/math/native_divide.h | 4 +-
.../include/clc/opencl/math/native_exp.h | 6 +-
.../include/clc/opencl/math/native_exp10.h | 6 +-
.../include/clc/opencl/math/native_exp2.h | 6 +-
.../include/clc/opencl/math/native_log.h | 6 +-
.../include/clc/opencl/math/native_log10.h | 6 +-
.../include/clc/opencl/math/native_log2.h | 6 +-
.../include/clc/opencl/math/native_powr.h | 4 +-
.../include/clc/opencl/math/native_recip.h | 6 +-
.../include/clc/opencl/math/native_rsqrt.h | 6 +-
.../include/clc/opencl/math/native_sin.h | 6 +-
.../include/clc/opencl/math/native_sqrt.h | 6 +-
.../include/clc/opencl/math/native_tan.h | 6 +-
.../include/clc/opencl/math/nextafter.h | 4 +-
libclc/opencl/include/clc/opencl/math/pow.h | 4 +-
libclc/opencl/include/clc/opencl/math/pown.h | 4 +-
libclc/opencl/include/clc/opencl/math/powr.h | 4 +-
.../include/clc/opencl/math/remainder.h | 4 +-
.../opencl/include/clc/opencl/math/remquo.h | 4 +-
libclc/opencl/include/clc/opencl/math/rint.h | 4 +-
libclc/opencl/include/clc/opencl/math/rootn.h | 4 +-
libclc/opencl/include/clc/opencl/math/round.h | 4 +-
libclc/opencl/include/clc/opencl/math/rsqrt.h | 4 +-
libclc/opencl/include/clc/opencl/math/sin.h | 4 +-
.../opencl/include/clc/opencl/math/sincos.h | 4 +-
libclc/opencl/include/clc/opencl/math/sinh.h | 4 +-
libclc/opencl/include/clc/opencl/math/sinpi.h | 4 +-
libclc/opencl/include/clc/opencl/math/sqrt.h | 4 +-
libclc/opencl/include/clc/opencl/math/tan.h | 4 +-
libclc/opencl/include/clc/opencl/math/tanh.h | 4 +-
libclc/opencl/include/clc/opencl/math/tanpi.h | 4 +-
.../opencl/include/clc/opencl/math/tgamma.h | 4 +-
libclc/opencl/include/clc/opencl/math/trunc.h | 4 +-
.../opencl/include/clc/opencl/misc/shuffle.h | 4 +-
.../opencl/include/clc/opencl/misc/shuffle2.h | 4 +-
.../include/clc/opencl/relational/isfinite.h | 4 +-
.../include/clc/opencl/relational/isgreater.h | 4 +-
.../clc/opencl/relational/isgreaterequal.h | 4 +-
.../include/clc/opencl/relational/isless.h | 4 +-
.../clc/opencl/relational/islessequal.h | 4 +-
.../clc/opencl/relational/islessgreater.h | 4 +-
.../include/clc/opencl/relational/isnormal.h | 4 +-
.../clc/opencl/relational/isnotequal.h | 4 +-
.../include/clc/opencl/relational/isordered.h | 4 +-
.../clc/opencl/relational/isunordered.h | 4 +-
.../include/clc/opencl/relational/signbit.h | 4 +-
libclc/opencl/lib/clspv/math/fma.cl | 6 +-
libclc/opencl/lib/clspv/shared/vstore_half.cl | 63 +--
.../opencl/lib/clspv/shared/vstore_half.inc | 16 +-
.../async/async_work_group_strided_copy.inc | 6 +-
libclc/opencl/lib/generic/atomic/atom_add.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_and.cl | 12 +-
.../opencl/lib/generic/atomic/atom_cmpxchg.cl | 24 +-
libclc/opencl/lib/generic/atomic/atom_dec.cl | 24 +-
libclc/opencl/lib/generic/atomic/atom_inc.cl | 24 +-
libclc/opencl/lib/generic/atomic/atom_max.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_min.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_or.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_sub.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_xchg.cl | 12 +-
libclc/opencl/lib/generic/atomic/atom_xor.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_add.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_and.cl | 12 +-
.../lib/generic/atomic/atomic_cmpxchg.cl | 12 +-
.../atomic/atomic_compare_exchange_strong.cl | 2 +-
.../atomic/atomic_compare_exchange_weak.cl | 2 +-
.../opencl/lib/generic/atomic/atomic_dec.cl | 4 +-
.../opencl/lib/generic/atomic/atomic_def.inc | 40 +-
.../lib/generic/atomic/atomic_exchange.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_add.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_and.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_max.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_min.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_or.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_sub.cl | 4 +-
.../lib/generic/atomic/atomic_fetch_xor.cl | 4 +-
.../opencl/lib/generic/atomic/atomic_inc.cl | 4 +-
.../lib/generic/atomic/atomic_inc_dec.inc | 4 +-
.../opencl/lib/generic/atomic/atomic_load.cl | 4 +-
.../opencl/lib/generic/atomic/atomic_max.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_min.cl | 12 +-
libclc/opencl/lib/generic/atomic/atomic_or.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_store.cl | 4 +-
.../opencl/lib/generic/atomic/atomic_sub.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_xchg.cl | 12 +-
.../opencl/lib/generic/atomic/atomic_xor.cl | 12 +-
libclc/opencl/lib/generic/common/degrees.cl | 2 +-
libclc/opencl/lib/generic/common/radians.cl | 2 +-
libclc/opencl/lib/generic/common/sign.cl | 2 +-
.../opencl/lib/generic/geometric/distance.cl | 2 +-
libclc/opencl/lib/generic/geometric/dot.cl | 2 +-
.../lib/generic/geometric/fast_distance.cl | 4 +-
.../lib/generic/geometric/fast_length.cl | 4 +-
.../lib/generic/geometric/fast_normalize.cl | 4 +-
libclc/opencl/lib/generic/geometric/length.cl | 2 +-
.../opencl/lib/generic/geometric/normalize.cl | 2 +-
libclc/opencl/lib/generic/integer/add_sat.cl | 2 +-
.../opencl/lib/generic/integer/bit_reverse.cl | 2 +-
.../generic/integer/bitfield_extract_def.inc | 10 +-
.../integer/bitfield_extract_signed.cl | 4 +-
.../integer/bitfield_extract_unsigned.cl | 4 +-
.../lib/generic/integer/bitfield_insert.cl | 2 +-
libclc/opencl/lib/generic/integer/clz.cl | 2 +-
libclc/opencl/lib/generic/integer/ctz.cl | 2 +-
libclc/opencl/lib/generic/integer/hadd.cl | 2 +-
libclc/opencl/lib/generic/integer/mad24.cl | 2 +-
libclc/opencl/lib/generic/integer/mad_hi.cl | 2 +-
libclc/opencl/lib/generic/integer/mad_sat.cl | 2 +-
libclc/opencl/lib/generic/integer/mul24.cl | 2 +-
libclc/opencl/lib/generic/integer/mul_hi.cl | 2 +-
libclc/opencl/lib/generic/integer/popcount.cl | 2 +-
libclc/opencl/lib/generic/integer/rhadd.cl | 2 +-
libclc/opencl/lib/generic/integer/rotate.cl | 2 +-
libclc/opencl/lib/generic/integer/sub_sat.cl | 2 +-
libclc/opencl/lib/generic/math/acos.cl | 2 +-
libclc/opencl/lib/generic/math/acosh.cl | 2 +-
libclc/opencl/lib/generic/math/acospi.cl | 2 +-
libclc/opencl/lib/generic/math/asin.cl | 2 +-
libclc/opencl/lib/generic/math/asinh.cl | 2 +-
libclc/opencl/lib/generic/math/asinpi.cl | 2 +-
libclc/opencl/lib/generic/math/atan.cl | 2 +-
libclc/opencl/lib/generic/math/atan2.cl | 2 +-
libclc/opencl/lib/generic/math/atan2pi.cl | 2 +-
libclc/opencl/lib/generic/math/atanh.cl | 2 +-
libclc/opencl/lib/generic/math/atanpi.cl | 2 +-
libclc/opencl/lib/generic/math/cbrt.cl | 2 +-
libclc/opencl/lib/generic/math/ceil.cl | 2 +-
libclc/opencl/lib/generic/math/copysign.cl | 2 +-
libclc/opencl/lib/generic/math/cos.cl | 2 +-
libclc/opencl/lib/generic/math/cosh.cl | 2 +-
libclc/opencl/lib/generic/math/cospi.cl | 2 +-
libclc/opencl/lib/generic/math/erf.cl | 2 +-
libclc/opencl/lib/generic/math/erfc.cl | 2 +-
libclc/opencl/lib/generic/math/exp.cl | 2 +-
libclc/opencl/lib/generic/math/exp10.cl | 2 +-
libclc/opencl/lib/generic/math/exp2.cl | 2 +-
libclc/opencl/lib/generic/math/expm1.cl | 2 +-
libclc/opencl/lib/generic/math/fabs.cl | 2 +-
libclc/opencl/lib/generic/math/fdim.cl | 2 +-
libclc/opencl/lib/generic/math/floor.cl | 2 +-
libclc/opencl/lib/generic/math/fma.cl | 2 +-
libclc/opencl/lib/generic/math/fmax.cl | 2 +-
libclc/opencl/lib/generic/math/fmin.cl | 2 +-
libclc/opencl/lib/generic/math/fmod.cl | 2 +-
libclc/opencl/lib/generic/math/fract.cl | 2 +-
libclc/opencl/lib/generic/math/frexp.cl | 2 +-
libclc/opencl/lib/generic/math/half_cos.cl | 4 +-
libclc/opencl/lib/generic/math/half_divide.cl | 4 +-
libclc/opencl/lib/generic/math/half_exp.cl | 4 +-
libclc/opencl/lib/generic/math/half_exp10.cl | 4 +-
libclc/opencl/lib/generic/math/half_exp2.cl | 4 +-
libclc/opencl/lib/generic/math/half_log.cl | 4 +-
libclc/opencl/lib/generic/math/half_log10.cl | 4 +-
libclc/opencl/lib/generic/math/half_log2.cl | 4 +-
libclc/opencl/lib/generic/math/half_powr.cl | 4 +-
libclc/opencl/lib/generic/math/half_recip.cl | 4 +-
libclc/opencl/lib/generic/math/half_rsqrt.cl | 4 +-
libclc/opencl/lib/generic/math/half_sin.cl | 4 +-
libclc/opencl/lib/generic/math/half_sqrt.cl | 4 +-
libclc/opencl/lib/generic/math/half_tan.cl | 4 +-
libclc/opencl/lib/generic/math/hypot.cl | 2 +-
libclc/opencl/lib/generic/math/ilogb.cl | 2 +-
libclc/opencl/lib/generic/math/ldexp.cl | 4 +-
libclc/opencl/lib/generic/math/lgamma.cl | 2 +-
libclc/opencl/lib/generic/math/lgamma_r.cl | 2 +-
libclc/opencl/lib/generic/math/log.cl | 2 +-
libclc/opencl/lib/generic/math/log10.cl | 2 +-
libclc/opencl/lib/generic/math/log1p.cl | 2 +-
libclc/opencl/lib/generic/math/log2.cl | 2 +-
libclc/opencl/lib/generic/math/logb.cl | 2 +-
libclc/opencl/lib/generic/math/mad.cl | 2 +-
libclc/opencl/lib/generic/math/maxmag.cl | 2 +-
libclc/opencl/lib/generic/math/minmag.cl | 2 +-
libclc/opencl/lib/generic/math/modf.cl | 2 +-
libclc/opencl/lib/generic/math/native_cos.cl | 4 +-
.../opencl/lib/generic/math/native_divide.cl | 4 +-
libclc/opencl/lib/generic/math/native_exp.cl | 4 +-
.../opencl/lib/generic/math/native_exp10.cl | 4 +-
libclc/opencl/lib/generic/math/native_exp2.cl | 4 +-
libclc/opencl/lib/generic/math/native_log.cl | 4 +-
.../opencl/lib/generic/math/native_log10.cl | 4 +-
libclc/opencl/lib/generic/math/native_log2.cl | 4 +-
libclc/opencl/lib/generic/math/native_powr.cl | 4 +-
.../opencl/lib/generic/math/native_recip.cl | 4 +-
.../opencl/lib/generic/math/native_rsqrt.cl | 4 +-
libclc/opencl/lib/generic/math/native_sin.cl | 4 +-
libclc/opencl/lib/generic/math/native_sqrt.cl | 4 +-
libclc/opencl/lib/generic/math/native_tan.cl | 4 +-
libclc/opencl/lib/generic/math/nextafter.cl | 4 +-
libclc/opencl/lib/generic/math/pow.cl | 2 +-
libclc/opencl/lib/generic/math/pown.cl | 2 +-
libclc/opencl/lib/generic/math/powr.cl | 2 +-
libclc/opencl/lib/generic/math/remainder.cl | 2 +-
libclc/opencl/lib/generic/math/rint.cl | 2 +-
libclc/opencl/lib/generic/math/rootn.cl | 2 +-
libclc/opencl/lib/generic/math/round.cl | 2 +-
libclc/opencl/lib/generic/math/rsqrt.cl | 2 +-
libclc/opencl/lib/generic/math/sin.cl | 2 +-
libclc/opencl/lib/generic/math/sincos.cl | 2 +-
libclc/opencl/lib/generic/math/sinh.cl | 2 +-
libclc/opencl/lib/generic/math/sinpi.cl | 2 +-
libclc/opencl/lib/generic/math/sqrt.cl | 2 +-
libclc/opencl/lib/generic/math/tan.cl | 2 +-
libclc/opencl/lib/generic/math/tanh.cl | 2 +-
libclc/opencl/lib/generic/math/tanpi.cl | 2 +-
libclc/opencl/lib/generic/math/tgamma.cl | 2 +-
libclc/opencl/lib/generic/math/trunc.cl | 2 +-
libclc/opencl/lib/generic/misc/shuffle.cl | 2 +-
libclc/opencl/lib/generic/misc/shuffle2.cl | 2 +-
libclc/opencl/lib/generic/relational/all.cl | 24 +-
libclc/opencl/lib/generic/relational/any.cl | 24 +-
.../lib/generic/relational/binary_def.inc | 13 +-
.../opencl/lib/generic/relational/isequal.cl | 2 +-
.../opencl/lib/generic/relational/isfinite.cl | 2 +-
.../lib/generic/relational/isgreater.cl | 2 +-
.../lib/generic/relational/isgreaterequal.cl | 2 +-
libclc/opencl/lib/generic/relational/isinf.cl | 2 +-
.../opencl/lib/generic/relational/isless.cl | 2 +-
.../lib/generic/relational/islessequal.cl | 2 +-
.../lib/generic/relational/islessgreater.cl | 2 +-
libclc/opencl/lib/generic/relational/isnan.cl | 2 +-
.../opencl/lib/generic/relational/isnormal.cl | 2 +-
.../lib/generic/relational/isnotequal.cl | 2 +-
.../lib/generic/relational/isordered.cl | 2 +-
.../lib/generic/relational/isunordered.cl | 2 +-
.../opencl/lib/generic/relational/signbit.cl | 2 +-
.../lib/generic/relational/unary_def.inc | 12 +-
libclc/opencl/lib/generic/shared/vload.inc | 57 +--
libclc/opencl/lib/generic/shared/vstore.inc | 73 +--
libclc/opencl/lib/spirv/math/fma.cl | 6 +-
665 files changed, 2500 insertions(+), 2470 deletions(-)
diff --git a/libclc/clc/include/clc/atomic/atomic_decl.inc b/libclc/clc/include/clc/atomic/atomic_decl.inc
index b790a94c7d288..5e0f456e34009 100644
--- a/libclc/clc/include/clc/atomic/atomic_decl.inc
+++ b/libclc/clc/include/clc/atomic/atomic_decl.inc
@@ -14,23 +14,23 @@
#ifdef __CLC_NO_VALUE_ARG
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, int MemoryOrder, \
int MemoryScope);
#elif defined(__CLC_RETURN_VOID)
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL void FUNCTION(volatile ADDRSPACE __CLC_GENTYPE *Ptr, \
- __CLC_GENTYPE Value, int MemoryOrder, \
- int MemoryScope);
+ _CLC_OVERLOAD _CLC_DECL void __CLC_FUNCTION( \
+ volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Value, \
+ int MemoryOrder, int MemoryScope);
#elif defined(__CLC_COMPARE_EXCHANGE)
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Comparator, \
__CLC_GENTYPE Value, int MemoryOrderEqual, int MemoryOrderUnequal, \
int MemoryScope);
#else
#define __CLC_DECLARE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Value, \
int MemoryOrder, int MemoryScope);
#endif
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_compare_exchange.h b/libclc/clc/include/clc/atomic/clc_atomic_compare_exchange.h
index ae7918ac32e43..31b8167223502 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_compare_exchange.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_compare_exchange.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_compare_exchange
+#define __CLC_FUNCTION __clc_atomic_compare_exchange
#define __CLC_COMPARE_EXCHANGE
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
@@ -21,6 +21,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_COMPARE_EXCHANGE
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_COMPARE_EXCHANGE_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_dec.h b/libclc/clc/include/clc/atomic/clc_atomic_dec.h
index ada36ba3ff9b3..66302b6b9ade2 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_dec.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_dec.h
@@ -11,13 +11,13 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_dec
+#define __CLC_FUNCTION __clc_atomic_dec
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_NO_VALUE_ARG
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_DEC_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_exchange.h b/libclc/clc/include/clc/atomic/clc_atomic_exchange.h
index 7e626d4a8830b..321cfb4030851 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_exchange.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_exchange.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_exchange
+#define __CLC_FUNCTION __clc_atomic_exchange
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_EXCHANGE_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_add.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_add.h
index ad0c2eb4607a7..4ef29fce50af8 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_add.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_add.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_add
+#define __CLC_FUNCTION __clc_atomic_fetch_add
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_ADD_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_and.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_and.h
index 80810c38cbbb8..688c11287db50 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_and.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_and.h
@@ -11,11 +11,11 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_and
+#define __CLC_FUNCTION __clc_atomic_fetch_and
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_AND_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_max.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_max.h
index 56f511922e5c7..a4e44b88a697f 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_max.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_max.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_max
+#define __CLC_FUNCTION __clc_atomic_fetch_max
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_MAX_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_min.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_min.h
index f17408d28a35d..b58b538649e19 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_min.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_min.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_min
+#define __CLC_FUNCTION __clc_atomic_fetch_min
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_MIN_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_or.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_or.h
index b82069e6f960e..ab303cc673ba2 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_or.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_or.h
@@ -11,11 +11,11 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_or
+#define __CLC_FUNCTION __clc_atomic_fetch_or
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_OR_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_sub.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_sub.h
index 6cfd224629d60..d9deae085a61e 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_sub.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_sub.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_sub
+#define __CLC_FUNCTION __clc_atomic_fetch_sub
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_SUB_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_fetch_xor.h b/libclc/clc/include/clc/atomic/clc_atomic_fetch_xor.h
index b007b47a9369d..fe13a641fc1cd 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_fetch_xor.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_fetch_xor.h
@@ -11,11 +11,11 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_fetch_xor
+#define __CLC_FUNCTION __clc_atomic_fetch_xor
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_FETCH_XOR_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_inc.h b/libclc/clc/include/clc/atomic/clc_atomic_inc.h
index 3ddef4a8bf355..c6fcdad30949b 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_inc.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_inc.h
@@ -11,13 +11,13 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_inc
+#define __CLC_FUNCTION __clc_atomic_inc
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_NO_VALUE_ARG
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_INC_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_load.h b/libclc/clc/include/clc/atomic/clc_atomic_load.h
index a4899b34b88a1..3abfce86b1947 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_load.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_load.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_load
+#define __CLC_FUNCTION __clc_atomic_load
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
@@ -21,6 +21,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_NO_VALUE_ARG
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_LOAD_H__
diff --git a/libclc/clc/include/clc/atomic/clc_atomic_store.h b/libclc/clc/include/clc/atomic/clc_atomic_store.h
index 6baf0eb7ea32b..94d77621735d0 100644
--- a/libclc/clc/include/clc/atomic/clc_atomic_store.h
+++ b/libclc/clc/include/clc/atomic/clc_atomic_store.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_atomic_store
+#define __CLC_FUNCTION __clc_atomic_store
#define __CLC_RETURN_VOID
#define __CLC_BODY <clc/atomic/atomic_decl.inc>
@@ -21,6 +21,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_RETURN_VOID
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_ATOMIC_CLC_ATOMIC_STORE_H__
diff --git a/libclc/clc/include/clc/clcmacro.h b/libclc/clc/include/clc/clcmacro.h
index 5c67c937cb1d4..9fa11489b1457 100644
--- a/libclc/clc/include/clc/clcmacro.h
+++ b/libclc/clc/include/clc/clcmacro.h
@@ -12,58 +12,58 @@
#include <clc/internal/clc.h>
#include <clc/utils.h>
-#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, \
+#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, __CLC_FUNCTION, ARG1_TYPE, \
ADDR_SPACE, ARG2_TYPE) \
DECLSPEC __CLC_XCONCAT(RET_TYPE, 2) \
- FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 2) x, \
- ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 2) * y) { \
+ __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))(FUNCTION(x.s0, ptr), \
- FUNCTION(x.s1, ptr + 1)); \
+ return (__CLC_XCONCAT(RET_TYPE, 2))(__CLC_FUNCTION(x.s0, ptr), \
+ __CLC_FUNCTION(x.s1, ptr + 1)); \
} \
\
DECLSPEC __CLC_XCONCAT(RET_TYPE, 3) \
- FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 3) x, \
- ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 3) * y) { \
+ __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))(FUNCTION(x.s0, ptr), \
- FUNCTION(x.s1, ptr + 1), \
- FUNCTION(x.s2, ptr + 2)); \
+ 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) \
- FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 4) x, \
- ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 4) * y) { \
+ __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))( \
- FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
- FUNCTION(x.s3, ptr + 3)); \
+ __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) \
- FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 8) x, \
- ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 8) * y) { \
+ __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))( \
- FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
- FUNCTION(x.s3, ptr + 3), FUNCTION(x.s4, ptr + 4), \
- FUNCTION(x.s5, ptr + 5), FUNCTION(x.s6, ptr + 6), \
- FUNCTION(x.s7, ptr + 7)); \
+ __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) \
- FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 16) x, \
- ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 16) * y) { \
+ __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))( \
- FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
- FUNCTION(x.s3, ptr + 3), FUNCTION(x.s4, ptr + 4), \
- FUNCTION(x.s5, ptr + 5), FUNCTION(x.s6, ptr + 6), \
- FUNCTION(x.s7, ptr + 7), FUNCTION(x.s8, ptr + 8), \
- FUNCTION(x.s9, ptr + 9), FUNCTION(x.sa, ptr + 10), \
- FUNCTION(x.sb, ptr + 11), FUNCTION(x.sc, ptr + 12), \
- FUNCTION(x.sd, ptr + 13), FUNCTION(x.se, ptr + 14), \
- FUNCTION(x.sf, ptr + 15)); \
+ __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/include/clc/common/clc_degrees.h b/libclc/clc/include/clc/common/clc_degrees.h
index e633344c291c1..5f04fac1f2612 100644
--- a/libclc/clc/include/clc/common/clc_degrees.h
+++ b/libclc/clc/include/clc/common/clc_degrees.h
@@ -10,10 +10,10 @@
#define __CLC_COMMON_CLC_DEGREES_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_degrees
+#define __CLC_FUNCTION __clc_degrees
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_COMMON_CLC_DEGREES_H__
diff --git a/libclc/clc/include/clc/common/clc_radians.h b/libclc/clc/include/clc/common/clc_radians.h
index 0b075efbcce2f..03d7c4b9e3014 100644
--- a/libclc/clc/include/clc/common/clc_radians.h
+++ b/libclc/clc/include/clc/common/clc_radians.h
@@ -10,10 +10,10 @@
#define __CLC_COMMON_CLC_RADIANS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_radians
+#define __CLC_FUNCTION __clc_radians
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_COMMON_CLC_RADIANS_H__
diff --git a/libclc/clc/include/clc/common/clc_sign.h b/libclc/clc/include/clc/common/clc_sign.h
index 0a8c4cc94d80b..9737f1e54441b 100644
--- a/libclc/clc/include/clc/common/clc_sign.h
+++ b/libclc/clc/include/clc/common/clc_sign.h
@@ -9,11 +9,11 @@
#ifndef __CLC_COMMON_CLC_SIGN_H__
#define __CLC_COMMON_CLC_SIGN_H__
-#define FUNCTION __clc_sign
+#define __CLC_FUNCTION __clc_sign
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_COMMON_CLC_SIGN_H__
diff --git a/libclc/clc/include/clc/common/clc_step.h b/libclc/clc/include/clc/common/clc_step.h
index 96b4759cabf77..6b093d06896c0 100644
--- a/libclc/clc/include/clc/common/clc_step.h
+++ b/libclc/clc/include/clc/common/clc_step.h
@@ -9,11 +9,11 @@
#ifndef __CLC_COMMON_CLC_STEP_H__
#define __CLC_COMMON_CLC_STEP_H__
-#define FUNCTION __clc_step
+#define __CLC_FUNCTION __clc_step
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_COMMON_CLC_STEP_H__
diff --git a/libclc/clc/include/clc/geometric/binary_decl.inc b/libclc/clc/include/clc/geometric/binary_decl.inc
index 4a4235ae44db8..ab64c9bece324 100644
--- a/libclc/clc/include/clc/geometric/binary_decl.inc
+++ b/libclc/clc/include/clc/geometric/binary_decl.inc
@@ -11,6 +11,6 @@
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_SCALAR_GENTYPE
-FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
+__CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
#endif
diff --git a/libclc/clc/include/clc/geometric/binary_def.inc b/libclc/clc/include/clc/geometric/binary_def.inc
index ad4fa4c01683b..bbd4f57980023 100644
--- a/libclc/clc/include/clc/geometric/binary_def.inc
+++ b/libclc/clc/include/clc/geometric/binary_def.inc
@@ -8,17 +8,17 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
-_CLC_OVERLOAD _CLC_DEF __CLC_SCALAR_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b) {
- return __IMPL_FUNCTION(FUNCTION)(a, b);
+_CLC_OVERLOAD _CLC_DEF __CLC_SCALAR_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_GENTYPE b) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, b);
}
#endif
diff --git a/libclc/clc/include/clc/geometric/clc_distance.h b/libclc/clc/include/clc/geometric/clc_distance.h
index 666e2c881bc9a..1acea411a08b6 100644
--- a/libclc/clc/include/clc/geometric/clc_distance.h
+++ b/libclc/clc/include/clc/geometric/clc_distance.h
@@ -9,11 +9,11 @@
#ifndef __CLC_GEOMETRIC_CLC_DISTANCE_H__
#define __CLC_GEOMETRIC_CLC_DISTANCE_H__
-#define FUNCTION __clc_distance
+#define __CLC_FUNCTION __clc_distance
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_GEOMETRIC_CLC_DISTANCE_H__
diff --git a/libclc/clc/include/clc/geometric/clc_dot.h b/libclc/clc/include/clc/geometric/clc_dot.h
index 4bfed6e3abc51..a5a97d1bdd2bc 100644
--- a/libclc/clc/include/clc/geometric/clc_dot.h
+++ b/libclc/clc/include/clc/geometric/clc_dot.h
@@ -9,11 +9,11 @@
#ifndef __CLC_GEOMETRIC_CLC_DOT_H__
#define __CLC_GEOMETRIC_CLC_DOT_H__
-#define FUNCTION __clc_dot
+#define __CLC_FUNCTION __clc_dot
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_GEOMETRIC_CLC_DOT_H__
diff --git a/libclc/clc/include/clc/geometric/clc_fast_distance.h b/libclc/clc/include/clc/geometric/clc_fast_distance.h
index 2932d0147a6d8..47292130e9d68 100644
--- a/libclc/clc/include/clc/geometric/clc_fast_distance.h
+++ b/libclc/clc/include/clc/geometric/clc_fast_distance.h
@@ -9,12 +9,12 @@
#ifndef __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
#define __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_fast_distance
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_fast_distance
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
diff --git a/libclc/clc/include/clc/geometric/clc_fast_length.h b/libclc/clc/include/clc/geometric/clc_fast_length.h
index 903ecc8b91755..2244d8c77feaa 100644
--- a/libclc/clc/include/clc/geometric/clc_fast_length.h
+++ b/libclc/clc/include/clc/geometric/clc_fast_length.h
@@ -9,12 +9,12 @@
#ifndef __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
#define __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_fast_length
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_fast_length
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
diff --git a/libclc/clc/include/clc/geometric/clc_fast_normalize.h b/libclc/clc/include/clc/geometric/clc_fast_normalize.h
index a91862fe61cb7..ee9747c1af1e3 100644
--- a/libclc/clc/include/clc/geometric/clc_fast_normalize.h
+++ b/libclc/clc/include/clc/geometric/clc_fast_normalize.h
@@ -9,13 +9,13 @@
#ifndef __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
#define __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_GEOMETRIC_RET_GENTYPE
-#define FUNCTION __clc_fast_normalize
+#define __CLC_FUNCTION __clc_fast_normalize
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#undef __CLC_GEOMETRIC_RET_GENTYPE
#endif // __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
diff --git a/libclc/clc/include/clc/geometric/clc_length.h b/libclc/clc/include/clc/geometric/clc_length.h
index 35b206e6c3fbb..f8ce12db07871 100644
--- a/libclc/clc/include/clc/geometric/clc_length.h
+++ b/libclc/clc/include/clc/geometric/clc_length.h
@@ -9,11 +9,11 @@
#ifndef __CLC_GEOMETRIC_CLC_LENGTH_H__
#define __CLC_GEOMETRIC_CLC_LENGTH_H__
-#define FUNCTION __clc_length
+#define __CLC_FUNCTION __clc_length
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_GEOMETRIC_CLC_LENGTH_H__
diff --git a/libclc/clc/include/clc/geometric/clc_normalize.h b/libclc/clc/include/clc/geometric/clc_normalize.h
index 745ed7f4887d1..3058a72b2bbbe 100644
--- a/libclc/clc/include/clc/geometric/clc_normalize.h
+++ b/libclc/clc/include/clc/geometric/clc_normalize.h
@@ -10,11 +10,11 @@
#define __CLC_GEOMETRIC_CLC_NORMALIZE_H__
#define __CLC_GEOMETRIC_RET_GENTYPE
-#define FUNCTION __clc_normalize
+#define __CLC_FUNCTION __clc_normalize
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#undef __CLC_GEOMETRIC_RET_GENTYPE
#endif // __CLC_GEOMETRIC_CLC_NORMALIZE_H__
diff --git a/libclc/clc/include/clc/geometric/unary_decl.inc b/libclc/clc/include/clc/geometric/unary_decl.inc
index bca1f3b78f177..6641d28d09678 100644
--- a/libclc/clc/include/clc/geometric/unary_decl.inc
+++ b/libclc/clc/include/clc/geometric/unary_decl.inc
@@ -16,6 +16,6 @@ _CLC_OVERLOAD _CLC_CONST _CLC_DECL
#else
__CLC_SCALAR_GENTYPE
#endif
- FUNCTION(__CLC_GENTYPE a);
+ __CLC_FUNCTION(__CLC_GENTYPE a);
#endif
diff --git a/libclc/clc/include/clc/geometric/unary_def.inc b/libclc/clc/include/clc/geometric/unary_def.inc
index ea90de0ec581d..78c144b35af2c 100644
--- a/libclc/clc/include/clc/geometric/unary_def.inc
+++ b/libclc/clc/include/clc/geometric/unary_def.inc
@@ -8,8 +8,8 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
@@ -22,8 +22,8 @@ _CLC_OVERLOAD _CLC_DEF
#else
__CLC_SCALAR_GENTYPE
#endif
- FUNCTION(__CLC_GENTYPE a) {
- return __IMPL_FUNCTION(FUNCTION)(a);
+ __CLC_FUNCTION(__CLC_GENTYPE a) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a);
}
#endif
diff --git a/libclc/clc/include/clc/integer/clc_add_sat.h b/libclc/clc/include/clc/integer/clc_add_sat.h
index be095d38225e6..8c3495f6c5193 100644
--- a/libclc/clc/include/clc/integer/clc_add_sat.h
+++ b/libclc/clc/include/clc/integer/clc_add_sat.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_ADD_SAT_H__
#define __CLC_INTEGER_CLC_ADD_SAT_H__
-#define FUNCTION __clc_add_sat
+#define __CLC_FUNCTION __clc_add_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_ADD_SAT_H__
diff --git a/libclc/clc/include/clc/integer/clc_bit_reverse.h b/libclc/clc/include/clc/integer/clc_bit_reverse.h
index c945e326c74fa..de0c354b3fa4e 100644
--- a/libclc/clc/include/clc/integer/clc_bit_reverse.h
+++ b/libclc/clc/include/clc/integer/clc_bit_reverse.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_BIT_REVERSE_H__
#define __CLC_INTEGER_CLC_BIT_REVERSE_H__
-#define FUNCTION __clc_bit_reverse
+#define __CLC_FUNCTION __clc_bit_reverse
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_BIT_REVERSE_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc b/libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc
index b3f0e71a5f538..2f23667011209 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc
@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE base,
- uint offset, uint count);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_RETTYPE
+__CLC_FUNCTION(__CLC_GENTYPE base, uint offset, uint count);
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
index 9c2e047b8be00..7998196512b30 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
@@ -11,13 +11,13 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_bitfield_extract_signed
-#define __RETTYPE __CLC_S_GENTYPE
+#define __CLC_FUNCTION __clc_bitfield_extract_signed
+#define __CLC_RETTYPE __CLC_S_GENTYPE
#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
#include <clc/integer/gentype.inc>
-#undef __RETTYPE
-#undef FUNCTION
+#undef __CLC_RETTYPE
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
index 95305a3027e5d..84614056417f4 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
@@ -11,13 +11,13 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_bitfield_extract_unsigned
-#define __RETTYPE __CLC_U_GENTYPE
+#define __CLC_FUNCTION __clc_bitfield_extract_unsigned
+#define __CLC_RETTYPE __CLC_U_GENTYPE
#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
#include <clc/integer/gentype.inc>
-#undef __RETTYPE
-#undef FUNCTION
+#undef __CLC_RETTYPE
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.h b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
index f4d36b2ad2d2e..b284c0bf932d5 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_insert.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
@@ -11,7 +11,7 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_bitfield_insert
+#define __CLC_FUNCTION __clc_bitfield_insert
#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.inc b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
index de0b3d9469994..00a363fa41129 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
@@ -6,7 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE base,
- __CLC_GENTYPE insert,
- uint offset,
- uint count);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(
+ __CLC_GENTYPE base, __CLC_GENTYPE insert, uint offset, uint count);
diff --git a/libclc/clc/include/clc/integer/clc_clz.h b/libclc/clc/include/clc/integer/clc_clz.h
index 3e0530bad6f11..dd62cc935f8cd 100644
--- a/libclc/clc/include/clc/integer/clc_clz.h
+++ b/libclc/clc/include/clc/integer/clc_clz.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_CLZ_H__
#define __CLC_INTEGER_CLC_CLZ_H__
-#define FUNCTION __clc_clz
+#define __CLC_FUNCTION __clc_clz
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_CLZ_H__
diff --git a/libclc/clc/include/clc/integer/clc_ctz.h b/libclc/clc/include/clc/integer/clc_ctz.h
index 1495dc5560f1d..3f2079e023f67 100644
--- a/libclc/clc/include/clc/integer/clc_ctz.h
+++ b/libclc/clc/include/clc/integer/clc_ctz.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_CTZ_H__
#define __CLC_INTEGER_CLC_CTZ_H__
-#define FUNCTION __clc_ctz
+#define __CLC_FUNCTION __clc_ctz
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_CTZ_H__
diff --git a/libclc/clc/include/clc/integer/clc_hadd.h b/libclc/clc/include/clc/integer/clc_hadd.h
index 7aaee9b601a26..679369d3c9d4e 100644
--- a/libclc/clc/include/clc/integer/clc_hadd.h
+++ b/libclc/clc/include/clc/integer/clc_hadd.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_HADD_H__
#define __CLC_INTEGER_CLC_HADD_H__
-#define FUNCTION __clc_hadd
+#define __CLC_FUNCTION __clc_hadd
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_HADD_H__
diff --git a/libclc/clc/include/clc/integer/clc_mad24.h b/libclc/clc/include/clc/integer/clc_mad24.h
index 121840f81d63e..e19bd905d22eb 100644
--- a/libclc/clc/include/clc/integer/clc_mad24.h
+++ b/libclc/clc/include/clc/integer/clc_mad24.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_MAD24_H__
#define __CLC_INTEGER_CLC_MAD24_H__
-#define FUNCTION __clc_mad24
+#define __CLC_FUNCTION __clc_mad24
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype24.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_MAD24_H__
diff --git a/libclc/clc/include/clc/integer/clc_mad_sat.h b/libclc/clc/include/clc/integer/clc_mad_sat.h
index 0c418068ca4ac..845378b3e7c46 100644
--- a/libclc/clc/include/clc/integer/clc_mad_sat.h
+++ b/libclc/clc/include/clc/integer/clc_mad_sat.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_MAD_SAT_H__
#define __CLC_INTEGER_CLC_MAD_SAT_H__
-#define FUNCTION __clc_mad_sat
+#define __CLC_FUNCTION __clc_mad_sat
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_MAD_SAT_H__
diff --git a/libclc/clc/include/clc/integer/clc_mul24.h b/libclc/clc/include/clc/integer/clc_mul24.h
index 9310458d59817..f813de55c71e5 100644
--- a/libclc/clc/include/clc/integer/clc_mul24.h
+++ b/libclc/clc/include/clc/integer/clc_mul24.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_MUL24_H__
#define __CLC_INTEGER_CLC_MUL24_H__
-#define FUNCTION __clc_mul24
+#define __CLC_FUNCTION __clc_mul24
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype24.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_MUL24_H__
diff --git a/libclc/clc/include/clc/integer/clc_mul_hi.h b/libclc/clc/include/clc/integer/clc_mul_hi.h
index 6542f237d09bc..e4738e5570e81 100644
--- a/libclc/clc/include/clc/integer/clc_mul_hi.h
+++ b/libclc/clc/include/clc/integer/clc_mul_hi.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_MUL_HI_H__
#define __CLC_INTEGER_CLC_MUL_HI_H__
-#define FUNCTION __clc_mul_hi
+#define __CLC_FUNCTION __clc_mul_hi
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_MUL_HI_H__
diff --git a/libclc/clc/include/clc/integer/clc_popcount.h b/libclc/clc/include/clc/integer/clc_popcount.h
index 8ece2e998862d..55ca6ccfcec28 100644
--- a/libclc/clc/include/clc/integer/clc_popcount.h
+++ b/libclc/clc/include/clc/integer/clc_popcount.h
@@ -9,12 +9,12 @@
#ifndef __CLC_INTEGER_CLC_POPCOUNT_H__
#define __CLC_INTEGER_CLC_POPCOUNT_H__
-#define FUNCTION __clc_popcount
+#define __CLC_FUNCTION __clc_popcount
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
#undef __CLC_INTRINSIC
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_POPCOUNT_H__
diff --git a/libclc/clc/include/clc/integer/clc_rhadd.h b/libclc/clc/include/clc/integer/clc_rhadd.h
index 882f950656dfb..b8b0b1a3a56ed 100644
--- a/libclc/clc/include/clc/integer/clc_rhadd.h
+++ b/libclc/clc/include/clc/integer/clc_rhadd.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_RHADD_H__
#define __CLC_INTEGER_CLC_RHADD_H__
-#define FUNCTION __clc_rhadd
+#define __CLC_FUNCTION __clc_rhadd
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_RHADD_H__
diff --git a/libclc/clc/include/clc/integer/clc_rotate.h b/libclc/clc/include/clc/integer/clc_rotate.h
index 61cf08788ef3b..513bf98526233 100644
--- a/libclc/clc/include/clc/integer/clc_rotate.h
+++ b/libclc/clc/include/clc/integer/clc_rotate.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_ROTATE_H__
#define __CLC_INTEGER_CLC_ROTATE_H__
-#define FUNCTION __clc_rotate
+#define __CLC_FUNCTION __clc_rotate
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_ROTATE_H__
diff --git a/libclc/clc/include/clc/integer/clc_sub_sat.h b/libclc/clc/include/clc/integer/clc_sub_sat.h
index 1b694a4a1780a..94a5484adefcf 100644
--- a/libclc/clc/include/clc/integer/clc_sub_sat.h
+++ b/libclc/clc/include/clc/integer/clc_sub_sat.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTEGER_CLC_SUB_SAT_H__
#define __CLC_INTEGER_CLC_SUB_SAT_H__
-#define FUNCTION __clc_sub_sat
+#define __CLC_FUNCTION __clc_sub_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTEGER_CLC_SUB_SAT_H__
diff --git a/libclc/clc/include/clc/internal/math/clc_sw_fma.h b/libclc/clc/include/clc/internal/math/clc_sw_fma.h
index 8497f4efd1137..5d6c76879ceb9 100644
--- a/libclc/clc/include/clc/internal/math/clc_sw_fma.h
+++ b/libclc/clc/include/clc/internal/math/clc_sw_fma.h
@@ -9,11 +9,11 @@
#ifndef __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
#define __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
-#define FUNCTION __clc_sw_fma
+#define __CLC_FUNCTION __clc_sw_fma
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
diff --git a/libclc/clc/include/clc/math/binary_decl_with_scalar_second_arg.inc b/libclc/clc/include/clc/math/binary_decl_with_scalar_second_arg.inc
index 45f39b73013bd..b9acf8c4af331 100644
--- a/libclc/clc/include/clc/math/binary_decl_with_scalar_second_arg.inc
+++ b/libclc/clc/include/clc/math/binary_decl_with_scalar_second_arg.inc
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b);
+__CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b);
diff --git a/libclc/clc/include/clc/math/binary_def_via_fp32.inc b/libclc/clc/include/clc/math/binary_def_via_fp32.inc
index c8cdb1e9e5c7d..ae22903dd3d0b 100644
--- a/libclc/clc/include/clc/math/binary_def_via_fp32.inc
+++ b/libclc/clc/include/clc/math/binary_def_via_fp32.inc
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- __CLC_GENTYPE y) {
+_CLC_OVERLOAD _CLC_CONST _CLC_DEF __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y) {
return __CLC_CONVERT_GENTYPE(
- FUNCTION(__CLC_CONVERT_FLOATN(x), __CLC_CONVERT_FLOATN(y)));
+ __CLC_FUNCTION(__CLC_CONVERT_FLOATN(x), __CLC_CONVERT_FLOATN(y)));
}
diff --git a/libclc/clc/include/clc/math/clc_acos.h b/libclc/clc/include/clc/math/clc_acos.h
index 130e3111ec1ca..1d484fa5b56c9 100644
--- a/libclc/clc/include/clc/math/clc_acos.h
+++ b/libclc/clc/include/clc/math/clc_acos.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ACOS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_acos
+#define __CLC_FUNCTION __clc_acos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ACOS_H__
diff --git a/libclc/clc/include/clc/math/clc_acosh.h b/libclc/clc/include/clc/math/clc_acosh.h
index 9b8c7184b9742..9492724bb27ba 100644
--- a/libclc/clc/include/clc/math/clc_acosh.h
+++ b/libclc/clc/include/clc/math/clc_acosh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ACOSH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_acosh
+#define __CLC_FUNCTION __clc_acosh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ACOSH_H__
diff --git a/libclc/clc/include/clc/math/clc_acospi.h b/libclc/clc/include/clc/math/clc_acospi.h
index 6d4dc694900a0..90cfc06b7dffb 100644
--- a/libclc/clc/include/clc/math/clc_acospi.h
+++ b/libclc/clc/include/clc/math/clc_acospi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ACOSPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_acospi
+#define __CLC_FUNCTION __clc_acospi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ACOSPI_H__
diff --git a/libclc/clc/include/clc/math/clc_asin.h b/libclc/clc/include/clc/math/clc_asin.h
index f3d69a7bf9956..f6246c49f8022 100644
--- a/libclc/clc/include/clc/math/clc_asin.h
+++ b/libclc/clc/include/clc/math/clc_asin.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ASIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_asin
+#define __CLC_FUNCTION __clc_asin
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ASIN_H__
diff --git a/libclc/clc/include/clc/math/clc_asinh.h b/libclc/clc/include/clc/math/clc_asinh.h
index dc4530fa68b82..05e44fa438cee 100644
--- a/libclc/clc/include/clc/math/clc_asinh.h
+++ b/libclc/clc/include/clc/math/clc_asinh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ASINH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_asinh
+#define __CLC_FUNCTION __clc_asinh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ASINH_H__
diff --git a/libclc/clc/include/clc/math/clc_asinpi.h b/libclc/clc/include/clc/math/clc_asinpi.h
index 19d8ec3ad0c50..8f308dd06022e 100644
--- a/libclc/clc/include/clc/math/clc_asinpi.h
+++ b/libclc/clc/include/clc/math/clc_asinpi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ASINPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_asinpi
+#define __CLC_FUNCTION __clc_asinpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ASINPI_H__
diff --git a/libclc/clc/include/clc/math/clc_atan.h b/libclc/clc/include/clc/math/clc_atan.h
index 9f10efeae976c..203e46c2b8a4a 100644
--- a/libclc/clc/include/clc/math/clc_atan.h
+++ b/libclc/clc/include/clc/math/clc_atan.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ATAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_atan
+#define __CLC_FUNCTION __clc_atan
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ATAN_H__
diff --git a/libclc/clc/include/clc/math/clc_atan2.h b/libclc/clc/include/clc/math/clc_atan2.h
index 99bd0760f3fe8..6edc9dda48f4d 100644
--- a/libclc/clc/include/clc/math/clc_atan2.h
+++ b/libclc/clc/include/clc/math/clc_atan2.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ATAN2_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_atan2
+#define __CLC_FUNCTION __clc_atan2
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ATAN2_H__
diff --git a/libclc/clc/include/clc/math/clc_atan2pi.h b/libclc/clc/include/clc/math/clc_atan2pi.h
index ae044b7bbfafb..2f26d1d9ae985 100644
--- a/libclc/clc/include/clc/math/clc_atan2pi.h
+++ b/libclc/clc/include/clc/math/clc_atan2pi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ATAN2PI_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_atan2pi
+#define __CLC_FUNCTION __clc_atan2pi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ATAN2PI_H__
diff --git a/libclc/clc/include/clc/math/clc_atanh.h b/libclc/clc/include/clc/math/clc_atanh.h
index c1a95d4acba1b..85f9fc53be1a6 100644
--- a/libclc/clc/include/clc/math/clc_atanh.h
+++ b/libclc/clc/include/clc/math/clc_atanh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ATANH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_atanh
+#define __CLC_FUNCTION __clc_atanh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ATANH_H__
diff --git a/libclc/clc/include/clc/math/clc_atanpi.h b/libclc/clc/include/clc/math/clc_atanpi.h
index 43f752ecfe98b..2b3c6b373ed42 100644
--- a/libclc/clc/include/clc/math/clc_atanpi.h
+++ b/libclc/clc/include/clc/math/clc_atanpi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ATANPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_atanpi
+#define __CLC_FUNCTION __clc_atanpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ATANPI_H__
diff --git a/libclc/clc/include/clc/math/clc_cbrt.inc b/libclc/clc/include/clc/math/clc_cbrt.inc
index 019b5174a9015..fd9b750c8fd89 100644
--- a/libclc/clc/include/clc/math/clc_cbrt.inc
+++ b/libclc/clc/include/clc/math/clc_cbrt.inc
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_CBRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_cbrt
+#define __CLC_FUNCTION __clc_cbrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_CBRT_H__
diff --git a/libclc/clc/include/clc/math/clc_ceil.h b/libclc/clc/include/clc/math/clc_ceil.h
index c60b794c83c6c..45668224c6176 100644
--- a/libclc/clc/include/clc/math/clc_ceil.h
+++ b/libclc/clc/include/clc/math/clc_ceil.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_CEIL_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_ceil
+#define __CLC_FUNCTION __clc_ceil
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_CEIL_H__
diff --git a/libclc/clc/include/clc/math/clc_copysign.h b/libclc/clc/include/clc/math/clc_copysign.h
index 5976e42de250f..563dd2827839a 100644
--- a/libclc/clc/include/clc/math/clc_copysign.h
+++ b/libclc/clc/include/clc/math/clc_copysign.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_COPYSIGN_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_copysign
+#define __CLC_FUNCTION __clc_copysign
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_COPYSIGN_H__
diff --git a/libclc/clc/include/clc/math/clc_cos.h b/libclc/clc/include/clc/math/clc_cos.h
index 3a1ae9342e265..44681608efc37 100644
--- a/libclc/clc/include/clc/math/clc_cos.h
+++ b/libclc/clc/include/clc/math/clc_cos.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_COS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_cos
+#define __CLC_FUNCTION __clc_cos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_COS_H__
diff --git a/libclc/clc/include/clc/math/clc_cosh.h b/libclc/clc/include/clc/math/clc_cosh.h
index 3033d76000dc0..7bcfa2ea26e06 100644
--- a/libclc/clc/include/clc/math/clc_cosh.h
+++ b/libclc/clc/include/clc/math/clc_cosh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_COSH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_cosh
+#define __CLC_FUNCTION __clc_cosh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_COSH_H__
diff --git a/libclc/clc/include/clc/math/clc_cospi.h b/libclc/clc/include/clc/math/clc_cospi.h
index 3e4e73f096a06..4d82100649b01 100644
--- a/libclc/clc/include/clc/math/clc_cospi.h
+++ b/libclc/clc/include/clc/math/clc_cospi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_COSPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_cospi
+#define __CLC_FUNCTION __clc_cospi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_COSPI_H__
diff --git a/libclc/clc/include/clc/math/clc_erf.h b/libclc/clc/include/clc/math/clc_erf.h
index 04b990c65133f..01a21b36b352f 100644
--- a/libclc/clc/include/clc/math/clc_erf.h
+++ b/libclc/clc/include/clc/math/clc_erf.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ERF_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_erf
+#define __CLC_FUNCTION __clc_erf
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ERF_H__
diff --git a/libclc/clc/include/clc/math/clc_erfc.h b/libclc/clc/include/clc/math/clc_erfc.h
index be2578b4bfb04..efd581542879f 100644
--- a/libclc/clc/include/clc/math/clc_erfc.h
+++ b/libclc/clc/include/clc/math/clc_erfc.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ERFC_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_erfc
+#define __CLC_FUNCTION __clc_erfc
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ERFC_H__
diff --git a/libclc/clc/include/clc/math/clc_exp.h b/libclc/clc/include/clc/math/clc_exp.h
index 355148934427f..84369bb8fbdd6 100644
--- a/libclc/clc/include/clc/math/clc_exp.h
+++ b/libclc/clc/include/clc/math/clc_exp.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_EXP_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_exp
+#define __CLC_FUNCTION __clc_exp
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_EXP_H__
diff --git a/libclc/clc/include/clc/math/clc_exp10.h b/libclc/clc/include/clc/math/clc_exp10.h
index c281ee84dd3a1..500271cb07429 100644
--- a/libclc/clc/include/clc/math/clc_exp10.h
+++ b/libclc/clc/include/clc/math/clc_exp10.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_EXP10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_exp10
+#define __CLC_FUNCTION __clc_exp10
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_EXP10_H__
diff --git a/libclc/clc/include/clc/math/clc_exp2.h b/libclc/clc/include/clc/math/clc_exp2.h
index bb10f12d34e2e..4ad0ddea48a7c 100644
--- a/libclc/clc/include/clc/math/clc_exp2.h
+++ b/libclc/clc/include/clc/math/clc_exp2.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_EXP2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_exp2
+#define __CLC_FUNCTION __clc_exp2
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_EXP2_H__
diff --git a/libclc/clc/include/clc/math/clc_exp_helper.h b/libclc/clc/include/clc/math/clc_exp_helper.h
index 0c5028bd23858..a2b3f1bebaf49 100644
--- a/libclc/clc/include/clc/math/clc_exp_helper.h
+++ b/libclc/clc/include/clc/math/clc_exp_helper.h
@@ -9,7 +9,7 @@
#ifndef __CLC_MATH_CLC_EXP_HELPER
#define __CLC_MATH_CLC_EXP_HELPER
-#define __DOUBLE_ONLY
+#define __CLC_DOUBLE_ONLY
#define __CLC_BODY <clc/math/clc_exp_helper.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/include/clc/math/clc_expm1.h b/libclc/clc/include/clc/math/clc_expm1.h
index 7a199dca17cb3..5c60960ca5b03 100644
--- a/libclc/clc/include/clc/math/clc_expm1.h
+++ b/libclc/clc/include/clc/math/clc_expm1.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_EXPM1_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_expm1
+#define __CLC_FUNCTION __clc_expm1
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_EXPM1_H__
diff --git a/libclc/clc/include/clc/math/clc_fabs.h b/libclc/clc/include/clc/math/clc_fabs.h
index 8af3bb572142f..1ef38a8c75957 100644
--- a/libclc/clc/include/clc/math/clc_fabs.h
+++ b/libclc/clc/include/clc/math/clc_fabs.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_FABS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_fabs
+#define __CLC_FUNCTION __clc_fabs
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FABS_H__
diff --git a/libclc/clc/include/clc/math/clc_fdim.h b/libclc/clc/include/clc/math/clc_fdim.h
index c678eb25f59ba..50ad045db62cf 100644
--- a/libclc/clc/include/clc/math/clc_fdim.h
+++ b/libclc/clc/include/clc/math/clc_fdim.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_FDIM_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_fdim
+#define __CLC_FUNCTION __clc_fdim
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FDIM_H__
diff --git a/libclc/clc/include/clc/math/clc_floor.h b/libclc/clc/include/clc/math/clc_floor.h
index b3fe8ea95ce13..d243819e0a42c 100644
--- a/libclc/clc/include/clc/math/clc_floor.h
+++ b/libclc/clc/include/clc/math/clc_floor.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_FLOOR_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_floor
+#define __CLC_FUNCTION __clc_floor
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FLOOR_H__
diff --git a/libclc/clc/include/clc/math/clc_fma.h b/libclc/clc/include/clc/math/clc_fma.h
index efe20bd150eb5..5e87f4c470850 100644
--- a/libclc/clc/include/clc/math/clc_fma.h
+++ b/libclc/clc/include/clc/math/clc_fma.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_FMA_H__
#define __CLC_MATH_CLC_FMA_H__
-#define FUNCTION __clc_fma
+#define __CLC_FUNCTION __clc_fma
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FMA_H__
diff --git a/libclc/clc/include/clc/math/clc_fmax.h b/libclc/clc/include/clc/math/clc_fmax.h
index fd5d38987ec11..f367a9b6ea1ca 100644
--- a/libclc/clc/include/clc/math/clc_fmax.h
+++ b/libclc/clc/include/clc/math/clc_fmax.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_FMAX_H__
#define __CLC_MATH_CLC_FMAX_H__
-#define FUNCTION __clc_fmax
+#define __CLC_FUNCTION __clc_fmax
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FMAX_H__
diff --git a/libclc/clc/include/clc/math/clc_fmin.h b/libclc/clc/include/clc/math/clc_fmin.h
index 9fcdb56475ff6..47ed3fad2d8c2 100644
--- a/libclc/clc/include/clc/math/clc_fmin.h
+++ b/libclc/clc/include/clc/math/clc_fmin.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_FMIN_H__
#define __CLC_MATH_CLC_FMIN_H__
-#define FUNCTION __clc_fmin
+#define __CLC_FUNCTION __clc_fmin
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FMIN_H__
diff --git a/libclc/clc/include/clc/math/clc_fmod.h b/libclc/clc/include/clc/math/clc_fmod.h
index 840bb850d73c9..44179babd7fed 100644
--- a/libclc/clc/include/clc/math/clc_fmod.h
+++ b/libclc/clc/include/clc/math/clc_fmod.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_FMOD_H__
#define __CLC_MATH_CLC_FMOD_H__
-#define FUNCTION __clc_fmod
+#define __CLC_FUNCTION __clc_fmod
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FMOD_H__
diff --git a/libclc/clc/include/clc/math/clc_fract.h b/libclc/clc/include/clc/math/clc_fract.h
index 26c402c79641a..af762ecc59ea5 100644
--- a/libclc/clc/include/clc/math/clc_fract.h
+++ b/libclc/clc/include/clc/math/clc_fract.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_FRACT_H__
#define __CLC_MATH_CLC_FRACT_H__
-#define FUNCTION __clc_fract
+#define __CLC_FUNCTION __clc_fract
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FRACT_H__
diff --git a/libclc/clc/include/clc/math/clc_frexp.h b/libclc/clc/include/clc/math/clc_frexp.h
index e3c9f6b363dd1..d6ed2754d0d40 100644
--- a/libclc/clc/include/clc/math/clc_frexp.h
+++ b/libclc/clc/include/clc/math/clc_frexp.h
@@ -9,10 +9,10 @@
#ifndef __CLC_MATH_CLC_FREXP_H__
#define __CLC_MATH_CLC_FREXP_H__
-#define FUNCTION __clc_frexp
+#define __CLC_FUNCTION __clc_frexp
#define __CLC_BODY <clc/math/unary_decl_with_int_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_FREXP_H__
diff --git a/libclc/clc/include/clc/math/clc_half_cos.h b/libclc/clc/include/clc/math/clc_half_cos.h
index 0f9f0b61443f9..d0122987899c3 100644
--- a/libclc/clc/include/clc/math/clc_half_cos.h
+++ b/libclc/clc/include/clc/math/clc_half_cos.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_COS_H__
#define __CLC_MATH_CLC_HALF_COS_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_cos
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_COS_H__
diff --git a/libclc/clc/include/clc/math/clc_half_divide.h b/libclc/clc/include/clc/math/clc_half_divide.h
index 44d90f39b4f61..e5d5cdc9df34e 100644
--- a/libclc/clc/include/clc/math/clc_half_divide.h
+++ b/libclc/clc/include/clc/math/clc_half_divide.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_DIVIDE_H__
#define __CLC_MATH_CLC_HALF_DIVIDE_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_divide
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_divide
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_DIVIDE_H__
diff --git a/libclc/clc/include/clc/math/clc_half_exp.h b/libclc/clc/include/clc/math/clc_half_exp.h
index 158d28c16aabb..2284eaf8df360 100644
--- a/libclc/clc/include/clc/math/clc_half_exp.h
+++ b/libclc/clc/include/clc/math/clc_half_exp.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_EXP_H__
#define __CLC_MATH_CLC_HALF_EXP_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_EXP_H__
diff --git a/libclc/clc/include/clc/math/clc_half_exp10.h b/libclc/clc/include/clc/math/clc_half_exp10.h
index 4982b618e505a..662df93e06855 100644
--- a/libclc/clc/include/clc/math/clc_half_exp10.h
+++ b/libclc/clc/include/clc/math/clc_half_exp10.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_EXP10_H__
#define __CLC_MATH_CLC_HALF_EXP10_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp10
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_EXP10_H__
diff --git a/libclc/clc/include/clc/math/clc_half_exp2.h b/libclc/clc/include/clc/math/clc_half_exp2.h
index dc0f67659bf9f..d2af0f2e3fa9a 100644
--- a/libclc/clc/include/clc/math/clc_half_exp2.h
+++ b/libclc/clc/include/clc/math/clc_half_exp2.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_EXP2_H__
#define __CLC_MATH_CLC_HALF_EXP2_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp2
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_EXP2_H__
diff --git a/libclc/clc/include/clc/math/clc_half_log.h b/libclc/clc/include/clc/math/clc_half_log.h
index df527e1a8fb57..8ae30e5abe5f8 100644
--- a/libclc/clc/include/clc/math/clc_half_log.h
+++ b/libclc/clc/include/clc/math/clc_half_log.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_LOG_H__
#define __CLC_MATH_CLC_HALF_LOG_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_LOG_H__
diff --git a/libclc/clc/include/clc/math/clc_half_log10.h b/libclc/clc/include/clc/math/clc_half_log10.h
index 47db4cd325931..fe5248350abad 100644
--- a/libclc/clc/include/clc/math/clc_half_log10.h
+++ b/libclc/clc/include/clc/math/clc_half_log10.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_LOG10_H__
#define __CLC_MATH_CLC_HALF_LOG10_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log10
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_LOG10_H__
diff --git a/libclc/clc/include/clc/math/clc_half_log2.h b/libclc/clc/include/clc/math/clc_half_log2.h
index 2b95b444b3f24..c57aa1bffb335 100644
--- a/libclc/clc/include/clc/math/clc_half_log2.h
+++ b/libclc/clc/include/clc/math/clc_half_log2.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_LOG2_H__
#define __CLC_MATH_CLC_HALF_LOG2_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log2
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_LOG2_H__
diff --git a/libclc/clc/include/clc/math/clc_half_powr.h b/libclc/clc/include/clc/math/clc_half_powr.h
index 2fd62213b8241..188b32b8b49c6 100644
--- a/libclc/clc/include/clc/math/clc_half_powr.h
+++ b/libclc/clc/include/clc/math/clc_half_powr.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_POWR_H__
#define __CLC_MATH_CLC_HALF_POWR_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_powr
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_powr
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_POWR_H__
diff --git a/libclc/clc/include/clc/math/clc_half_recip.h b/libclc/clc/include/clc/math/clc_half_recip.h
index d2ace8b7a17e4..f5f71fa1988c8 100644
--- a/libclc/clc/include/clc/math/clc_half_recip.h
+++ b/libclc/clc/include/clc/math/clc_half_recip.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_RECIP_H__
#define __CLC_MATH_CLC_HALF_RECIP_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_recip
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_recip
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_RECIP_H__
diff --git a/libclc/clc/include/clc/math/clc_half_rsqrt.h b/libclc/clc/include/clc/math/clc_half_rsqrt.h
index a50dabccdaafc..d5a05ac8b84ac 100644
--- a/libclc/clc/include/clc/math/clc_half_rsqrt.h
+++ b/libclc/clc/include/clc/math/clc_half_rsqrt.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_RSQRT_H__
#define __CLC_MATH_CLC_HALF_RSQRT_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_rsqrt
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_RSQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_half_sin.h b/libclc/clc/include/clc/math/clc_half_sin.h
index f79f6afc2b4ec..d2d3da9b11dbf 100644
--- a/libclc/clc/include/clc/math/clc_half_sin.h
+++ b/libclc/clc/include/clc/math/clc_half_sin.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_SIN_H__
#define __CLC_MATH_CLC_HALF_SIN_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_sin
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_SIN_H__
diff --git a/libclc/clc/include/clc/math/clc_half_sqrt.h b/libclc/clc/include/clc/math/clc_half_sqrt.h
index df5fc222a5c9f..a54b8122cb15e 100644
--- a/libclc/clc/include/clc/math/clc_half_sqrt.h
+++ b/libclc/clc/include/clc/math/clc_half_sqrt.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_SQRT_H__
#define __CLC_MATH_CLC_HALF_SQRT_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_sqrt
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_SQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_half_tan.h b/libclc/clc/include/clc/math/clc_half_tan.h
index 0f6ef87907225..503ebe29c3cec 100644
--- a/libclc/clc/include/clc/math/clc_half_tan.h
+++ b/libclc/clc/include/clc/math/clc_half_tan.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_HALF_TAN_H__
#define __CLC_MATH_CLC_HALF_TAN_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_tan
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_tan
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HALF_TAN_H__
diff --git a/libclc/clc/include/clc/math/clc_hypot.h b/libclc/clc/include/clc/math/clc_hypot.h
index b2d69ebda96e2..40b354154fa53 100644
--- a/libclc/clc/include/clc/math/clc_hypot.h
+++ b/libclc/clc/include/clc/math/clc_hypot.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_HYPOT_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_hypot
+#define __CLC_FUNCTION __clc_hypot
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_HYPOT_H__
diff --git a/libclc/clc/include/clc/math/clc_ilogb.h b/libclc/clc/include/clc/math/clc_ilogb.h
index e02108ff1444b..6aeaf6be3ac6c 100644
--- a/libclc/clc/include/clc/math/clc_ilogb.h
+++ b/libclc/clc/include/clc/math/clc_ilogb.h
@@ -9,10 +9,10 @@
#ifndef __CLC_MATH_CLC_ILOGB_H__
#define __CLC_MATH_CLC_ILOGB_H__
-#define FUNCTION __clc_ilogb
+#define __CLC_FUNCTION __clc_ilogb
#define __CLC_BODY <clc/math/unary_decl_with_int_return.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ILOGB_H__
diff --git a/libclc/clc/include/clc/math/clc_lgamma.h b/libclc/clc/include/clc/math/clc_lgamma.h
index 69b1ff9701ca5..f54c5e2b61b67 100644
--- a/libclc/clc/include/clc/math/clc_lgamma.h
+++ b/libclc/clc/include/clc/math/clc_lgamma.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_LGAMMA_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_lgamma
+#define __CLC_FUNCTION __clc_lgamma
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LGAMMA_H__
diff --git a/libclc/clc/include/clc/math/clc_lgamma_r.h b/libclc/clc/include/clc/math/clc_lgamma_r.h
index a98f760d8032e..262e62372227a 100644
--- a/libclc/clc/include/clc/math/clc_lgamma_r.h
+++ b/libclc/clc/include/clc/math/clc_lgamma_r.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_LGAMMA_R_H__
#define __CLC_MATH_CLC_LGAMMA_R_H__
-#define FUNCTION __clc_lgamma_r
+#define __CLC_FUNCTION __clc_lgamma_r
#define __CLC_BODY <clc/math/unary_decl_with_int_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LGAMMA_R_H__
diff --git a/libclc/clc/include/clc/math/clc_log.h b/libclc/clc/include/clc/math/clc_log.h
index 6bddb5ff746ec..8b0e44b425a89 100644
--- a/libclc/clc/include/clc/math/clc_log.h
+++ b/libclc/clc/include/clc/math/clc_log.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_LOG_H__
#define __CLC_MATH_CLC_LOG_H__
-#define FUNCTION __clc_log
+#define __CLC_FUNCTION __clc_log
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LOG_H__
diff --git a/libclc/clc/include/clc/math/clc_log10.h b/libclc/clc/include/clc/math/clc_log10.h
index e3a5b19eb4184..6e086690c6ada 100644
--- a/libclc/clc/include/clc/math/clc_log10.h
+++ b/libclc/clc/include/clc/math/clc_log10.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_LOG10_H__
#define __CLC_MATH_CLC_LOG10_H__
-#define FUNCTION __clc_log10
+#define __CLC_FUNCTION __clc_log10
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LOG10_H__
diff --git a/libclc/clc/include/clc/math/clc_log1p.h b/libclc/clc/include/clc/math/clc_log1p.h
index f502802dafb22..1be8c8548d488 100644
--- a/libclc/clc/include/clc/math/clc_log1p.h
+++ b/libclc/clc/include/clc/math/clc_log1p.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_LOG1P_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_log1p
+#define __CLC_FUNCTION __clc_log1p
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LOG1P_H__
diff --git a/libclc/clc/include/clc/math/clc_log2.h b/libclc/clc/include/clc/math/clc_log2.h
index 7344cabaeffaa..c5f9e37f39845 100644
--- a/libclc/clc/include/clc/math/clc_log2.h
+++ b/libclc/clc/include/clc/math/clc_log2.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_LOG2_H__
#define __CLC_MATH_CLC_LOG2_H__
-#define FUNCTION __clc_log2
+#define __CLC_FUNCTION __clc_log2
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LOG2_H__
diff --git a/libclc/clc/include/clc/math/clc_logb.h b/libclc/clc/include/clc/math/clc_logb.h
index 1339d5819171d..75a2ce7e578b1 100644
--- a/libclc/clc/include/clc/math/clc_logb.h
+++ b/libclc/clc/include/clc/math/clc_logb.h
@@ -9,10 +9,10 @@
#ifndef __CLC_MATH_CLC_LOGB_H__
#define __CLC_MATH_CLC_LOGB_H__
-#define FUNCTION __clc_logb
+#define __CLC_FUNCTION __clc_logb
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_LOGB_H__
diff --git a/libclc/clc/include/clc/math/clc_mad.h b/libclc/clc/include/clc/math/clc_mad.h
index 72014b7c0ef7b..117e361380eda 100644
--- a/libclc/clc/include/clc/math/clc_mad.h
+++ b/libclc/clc/include/clc/math/clc_mad.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_MAD_H__
#define __CLC_BODY <clc/shared/ternary_decl.inc>
-#define FUNCTION __clc_mad
+#define __CLC_FUNCTION __clc_mad
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_MAD_H__
diff --git a/libclc/clc/include/clc/math/clc_maxmag.h b/libclc/clc/include/clc/math/clc_maxmag.h
index 058230e6ebfc9..857ad7867b05d 100644
--- a/libclc/clc/include/clc/math/clc_maxmag.h
+++ b/libclc/clc/include/clc/math/clc_maxmag.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_MAXMAG_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_maxmag
+#define __CLC_FUNCTION __clc_maxmag
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_MAXMAG_H__
diff --git a/libclc/clc/include/clc/math/clc_minmag.h b/libclc/clc/include/clc/math/clc_minmag.h
index 581b957828235..9615d029bfed2 100644
--- a/libclc/clc/include/clc/math/clc_minmag.h
+++ b/libclc/clc/include/clc/math/clc_minmag.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_MINMAG_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_minmag
+#define __CLC_FUNCTION __clc_minmag
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_MINMAG_H__
diff --git a/libclc/clc/include/clc/math/clc_modf.h b/libclc/clc/include/clc/math/clc_modf.h
index fbdd3f8ffd4b8..aa8f9e20892ab 100644
--- a/libclc/clc/include/clc/math/clc_modf.h
+++ b/libclc/clc/include/clc/math/clc_modf.h
@@ -9,10 +9,10 @@
#ifndef __CLC_MATH_CLC_MODF_H__
#define __CLC_MATH_CLC_MODF_H__
-#define FUNCTION __clc_modf
+#define __CLC_FUNCTION __clc_modf
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_MODF_H__
diff --git a/libclc/clc/include/clc/math/clc_nan.h b/libclc/clc/include/clc/math/clc_nan.h
index 45d91184cf145..91901fd9369f2 100644
--- a/libclc/clc/include/clc/math/clc_nan.h
+++ b/libclc/clc/include/clc/math/clc_nan.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_NAN_H__
#define __CLC_MATH_CLC_NAN_H__
-#define FUNCTION __clc_nan
+#define __CLC_FUNCTION __clc_nan
#define __CLC_BODY <clc/math/clc_nan.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NAN_H__
diff --git a/libclc/clc/include/clc/math/clc_native_cos.h b/libclc/clc/include/clc/math/clc_native_cos.h
index 08d51baca1f61..eefd133911e48 100644
--- a/libclc/clc/include/clc/math/clc_native_cos.h
+++ b/libclc/clc/include/clc/math/clc_native_cos.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_COS_H__
#define __CLC_MATH_CLC_NATIVE_COS_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_cos
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_COS_H__
diff --git a/libclc/clc/include/clc/math/clc_native_divide.h b/libclc/clc/include/clc/math/clc_native_divide.h
index a10ed512f10d9..97d97c2670a6b 100644
--- a/libclc/clc/include/clc/math/clc_native_divide.h
+++ b/libclc/clc/include/clc/math/clc_native_divide.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_DIVIDE_H__
#define __CLC_MATH_CLC_NATIVE_DIVIDE_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_divide
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_divide
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_DIVIDE_H__
diff --git a/libclc/clc/include/clc/math/clc_native_exp.h b/libclc/clc/include/clc/math/clc_native_exp.h
index 30801fe2f8ad3..30c0d1edf18fb 100644
--- a/libclc/clc/include/clc/math/clc_native_exp.h
+++ b/libclc/clc/include/clc/math/clc_native_exp.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_EXP_H__
#define __CLC_MATH_CLC_NATIVE_EXP_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_exp
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_EXP_H__
diff --git a/libclc/clc/include/clc/math/clc_native_exp10.h b/libclc/clc/include/clc/math/clc_native_exp10.h
index 91cf60ef6a2be..a88b5a3897377 100644
--- a/libclc/clc/include/clc/math/clc_native_exp10.h
+++ b/libclc/clc/include/clc/math/clc_native_exp10.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_EXP10_H__
#define __CLC_MATH_CLC_NATIVE_EXP10_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_exp10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_exp10
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_EXP10_H__
diff --git a/libclc/clc/include/clc/math/clc_native_exp2.h b/libclc/clc/include/clc/math/clc_native_exp2.h
index fe47280536198..09f4bfe6979dd 100644
--- a/libclc/clc/include/clc/math/clc_native_exp2.h
+++ b/libclc/clc/include/clc/math/clc_native_exp2.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_EXP2_H__
#define __CLC_MATH_CLC_NATIVE_EXP2_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_exp2
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_EXP2_H__
diff --git a/libclc/clc/include/clc/math/clc_native_log.h b/libclc/clc/include/clc/math/clc_native_log.h
index 25a7054d2a599..c32fc812d4770 100644
--- a/libclc/clc/include/clc/math/clc_native_log.h
+++ b/libclc/clc/include/clc/math/clc_native_log.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_LOG_H__
#define __CLC_MATH_CLC_NATIVE_LOG_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_LOG_H__
diff --git a/libclc/clc/include/clc/math/clc_native_log10.h b/libclc/clc/include/clc/math/clc_native_log10.h
index d46124d655ee7..329b8a7437556 100644
--- a/libclc/clc/include/clc/math/clc_native_log10.h
+++ b/libclc/clc/include/clc/math/clc_native_log10.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_LOG10_H__
#define __CLC_MATH_CLC_NATIVE_LOG10_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log10
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_LOG10_H__
diff --git a/libclc/clc/include/clc/math/clc_native_log2.h b/libclc/clc/include/clc/math/clc_native_log2.h
index 8998553b4984a..b8ad663b470d8 100644
--- a/libclc/clc/include/clc/math/clc_native_log2.h
+++ b/libclc/clc/include/clc/math/clc_native_log2.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_LOG2_H__
#define __CLC_MATH_CLC_NATIVE_LOG2_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log2
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_LOG2_H__
diff --git a/libclc/clc/include/clc/math/clc_native_powr.h b/libclc/clc/include/clc/math/clc_native_powr.h
index 932cfa66aeb9c..3a0c8cc8b9d58 100644
--- a/libclc/clc/include/clc/math/clc_native_powr.h
+++ b/libclc/clc/include/clc/math/clc_native_powr.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_POWR_H__
#define __CLC_MATH_CLC_NATIVE_POWR_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_powr
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_powr
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_POWR_H__
diff --git a/libclc/clc/include/clc/math/clc_native_recip.h b/libclc/clc/include/clc/math/clc_native_recip.h
index 6b94cbc3d6c6e..a6540e846f2b6 100644
--- a/libclc/clc/include/clc/math/clc_native_recip.h
+++ b/libclc/clc/include/clc/math/clc_native_recip.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_RECIP_H__
#define __CLC_MATH_CLC_NATIVE_RECIP_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_recip
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_recip
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_RECIP_H__
diff --git a/libclc/clc/include/clc/math/clc_native_rsqrt.h b/libclc/clc/include/clc/math/clc_native_rsqrt.h
index 5fa870b3f868a..0c8f3da039299 100644
--- a/libclc/clc/include/clc/math/clc_native_rsqrt.h
+++ b/libclc/clc/include/clc/math/clc_native_rsqrt.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_RSQRT_H__
#define __CLC_MATH_CLC_NATIVE_RSQRT_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_rsqrt
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_RSQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_native_sin.h b/libclc/clc/include/clc/math/clc_native_sin.h
index d25968c74409e..22ab7868e20fb 100644
--- a/libclc/clc/include/clc/math/clc_native_sin.h
+++ b/libclc/clc/include/clc/math/clc_native_sin.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_SIN_H__
#define __CLC_MATH_CLC_NATIVE_SIN_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_sin
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_SIN_H__
diff --git a/libclc/clc/include/clc/math/clc_native_sqrt.h b/libclc/clc/include/clc/math/clc_native_sqrt.h
index e8a28b7f70463..fd071f1d463ab 100644
--- a/libclc/clc/include/clc/math/clc_native_sqrt.h
+++ b/libclc/clc/include/clc/math/clc_native_sqrt.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_SQRT_H__
#define __CLC_MATH_CLC_NATIVE_SQRT_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_sqrt
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_SQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_native_tan.h b/libclc/clc/include/clc/math/clc_native_tan.h
index 36fdd6d8c011b..4b381312d8d51 100644
--- a/libclc/clc/include/clc/math/clc_native_tan.h
+++ b/libclc/clc/include/clc/math/clc_native_tan.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_NATIVE_TAN_H__
#define __CLC_MATH_CLC_NATIVE_TAN_H__
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_tan
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_tan
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NATIVE_TAN_H__
diff --git a/libclc/clc/include/clc/math/clc_nextafter.h b/libclc/clc/include/clc/math/clc_nextafter.h
index d080a40a06f03..f24742b9e9c37 100644
--- a/libclc/clc/include/clc/math/clc_nextafter.h
+++ b/libclc/clc/include/clc/math/clc_nextafter.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_NEXTAFTER_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_nextafter
+#define __CLC_FUNCTION __clc_nextafter
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_NEXTAFTER_H__
diff --git a/libclc/clc/include/clc/math/clc_pow.h b/libclc/clc/include/clc/math/clc_pow.h
index b33391e10a42a..5e37e5bf6da65 100644
--- a/libclc/clc/include/clc/math/clc_pow.h
+++ b/libclc/clc/include/clc/math/clc_pow.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_POW_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_pow
+#define __CLC_FUNCTION __clc_pow
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_POW_H__
diff --git a/libclc/clc/include/clc/math/clc_pown.h b/libclc/clc/include/clc/math/clc_pown.h
index 473bbe1603c52..30628efb19001 100644
--- a/libclc/clc/include/clc/math/clc_pown.h
+++ b/libclc/clc/include/clc/math/clc_pown.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_POWN_H__
#define __CLC_BODY <clc/shared/binary_decl_with_int_second_arg.inc>
-#define FUNCTION __clc_pown
+#define __CLC_FUNCTION __clc_pown
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_POWN_H__
diff --git a/libclc/clc/include/clc/math/clc_powr.h b/libclc/clc/include/clc/math/clc_powr.h
index a820516f18660..baa494cce6989 100644
--- a/libclc/clc/include/clc/math/clc_powr.h
+++ b/libclc/clc/include/clc/math/clc_powr.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_POWR_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION __clc_powr
+#define __CLC_FUNCTION __clc_powr
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_POWR_H__
diff --git a/libclc/clc/include/clc/math/clc_remainder.h b/libclc/clc/include/clc/math/clc_remainder.h
index bc53b043045cd..a7700c95103b4 100644
--- a/libclc/clc/include/clc/math/clc_remainder.h
+++ b/libclc/clc/include/clc/math/clc_remainder.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_REMAINDER_H__
#define __CLC_MATH_CLC_REMAINDER_H__
-#define FUNCTION __clc_remainder
+#define __CLC_FUNCTION __clc_remainder
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_REMAINDER_H__
diff --git a/libclc/clc/include/clc/math/clc_remquo.h b/libclc/clc/include/clc/math/clc_remquo.h
index b46f94ba94477..48a8844a6e384 100644
--- a/libclc/clc/include/clc/math/clc_remquo.h
+++ b/libclc/clc/include/clc/math/clc_remquo.h
@@ -9,11 +9,11 @@
#ifndef __CLC_MATH_CLC_REMQUO_H__
#define __CLC_MATH_CLC_REMQUO_H__
-#define FUNCTION __clc_remquo
+#define __CLC_FUNCTION __clc_remquo
#define __CLC_BODY <clc/math/remquo_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_REMQUO_H__
diff --git a/libclc/clc/include/clc/math/clc_rint.h b/libclc/clc/include/clc/math/clc_rint.h
index c446c75764710..17b1549f439b8 100644
--- a/libclc/clc/include/clc/math/clc_rint.h
+++ b/libclc/clc/include/clc/math/clc_rint.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_RINT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_rint
+#define __CLC_FUNCTION __clc_rint
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_RINT_H__
diff --git a/libclc/clc/include/clc/math/clc_rootn.h b/libclc/clc/include/clc/math/clc_rootn.h
index fb7817ee250fd..90a25ad52d867 100644
--- a/libclc/clc/include/clc/math/clc_rootn.h
+++ b/libclc/clc/include/clc/math/clc_rootn.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ROOTN_H__
#define __CLC_BODY <clc/shared/binary_decl_with_int_second_arg.inc>
-#define FUNCTION __clc_rootn
+#define __CLC_FUNCTION __clc_rootn
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ROOTN_H__
diff --git a/libclc/clc/include/clc/math/clc_round.h b/libclc/clc/include/clc/math/clc_round.h
index fd1872a5cf224..78ebf4db99e9f 100644
--- a/libclc/clc/include/clc/math/clc_round.h
+++ b/libclc/clc/include/clc/math/clc_round.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_ROUND_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_round
+#define __CLC_FUNCTION __clc_round
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_ROUND_H__
diff --git a/libclc/clc/include/clc/math/clc_rsqrt.h b/libclc/clc/include/clc/math/clc_rsqrt.h
index 1690ede1b8926..59402fbead2b2 100644
--- a/libclc/clc/include/clc/math/clc_rsqrt.h
+++ b/libclc/clc/include/clc/math/clc_rsqrt.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_RSQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_rsqrt
+#define __CLC_FUNCTION __clc_rsqrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_RSQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_sin.h b/libclc/clc/include/clc/math/clc_sin.h
index 89ae444eb6e30..de4c722ca123f 100644
--- a/libclc/clc/include/clc/math/clc_sin.h
+++ b/libclc/clc/include/clc/math/clc_sin.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_SIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_sin
+#define __CLC_FUNCTION __clc_sin
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_SIN_H__
diff --git a/libclc/clc/include/clc/math/clc_sincos.h b/libclc/clc/include/clc/math/clc_sincos.h
index bf3e0806db381..e26dc7c024c9c 100644
--- a/libclc/clc/include/clc/math/clc_sincos.h
+++ b/libclc/clc/include/clc/math/clc_sincos.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_SINCOS_H__
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
-#define FUNCTION __clc_sincos
+#define __CLC_FUNCTION __clc_sincos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_SINCOS_H__
diff --git a/libclc/clc/include/clc/math/clc_sincos_helpers.h b/libclc/clc/include/clc/math/clc_sincos_helpers.h
index f9ceba3bf2cf7..909afe476ad90 100644
--- a/libclc/clc/include/clc/math/clc_sincos_helpers.h
+++ b/libclc/clc/include/clc/math/clc_sincos_helpers.h
@@ -9,12 +9,12 @@
#ifndef __CLC_MATH_CLC_SINCOS_HELPERS_H__
#define __CLC_MATH_CLC_SINCOS_HELPERS_H__
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc/math/clc_sincos_helpers.inc>
#include <clc/math/gentype.inc>
-#define __DOUBLE_ONLY
+#define __CLC_DOUBLE_ONLY
#define __CLC_BODY <clc/math/clc_sincos_helpers_fp64.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/include/clc/math/clc_sinh.h b/libclc/clc/include/clc/math/clc_sinh.h
index c94d8e37acc64..fa9cabe79cb0e 100644
--- a/libclc/clc/include/clc/math/clc_sinh.h
+++ b/libclc/clc/include/clc/math/clc_sinh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_SINH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_sinh
+#define __CLC_FUNCTION __clc_sinh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_SINH_H__
diff --git a/libclc/clc/include/clc/math/clc_sinpi.h b/libclc/clc/include/clc/math/clc_sinpi.h
index 725e559600edd..db563c2e7e14a 100644
--- a/libclc/clc/include/clc/math/clc_sinpi.h
+++ b/libclc/clc/include/clc/math/clc_sinpi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_SINPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_sinpi
+#define __CLC_FUNCTION __clc_sinpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_SINPI_H__
diff --git a/libclc/clc/include/clc/math/clc_sqrt.h b/libclc/clc/include/clc/math/clc_sqrt.h
index 74aea8e858099..7084515533291 100644
--- a/libclc/clc/include/clc/math/clc_sqrt.h
+++ b/libclc/clc/include/clc/math/clc_sqrt.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_SQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_sqrt
+#define __CLC_FUNCTION __clc_sqrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_SQRT_H__
diff --git a/libclc/clc/include/clc/math/clc_tan.h b/libclc/clc/include/clc/math/clc_tan.h
index d16370420a030..028ff28ecd69d 100644
--- a/libclc/clc/include/clc/math/clc_tan.h
+++ b/libclc/clc/include/clc/math/clc_tan.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_TAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_tan
+#define __CLC_FUNCTION __clc_tan
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_TAN_H__
diff --git a/libclc/clc/include/clc/math/clc_tanh.h b/libclc/clc/include/clc/math/clc_tanh.h
index 2c860c165ca67..88fce2340d99b 100644
--- a/libclc/clc/include/clc/math/clc_tanh.h
+++ b/libclc/clc/include/clc/math/clc_tanh.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_TANH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_tanh
+#define __CLC_FUNCTION __clc_tanh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_TANH_H__
diff --git a/libclc/clc/include/clc/math/clc_tanpi.h b/libclc/clc/include/clc/math/clc_tanpi.h
index 2691fa696c0a5..596bb72b4b8de 100644
--- a/libclc/clc/include/clc/math/clc_tanpi.h
+++ b/libclc/clc/include/clc/math/clc_tanpi.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_TANPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_tanpi
+#define __CLC_FUNCTION __clc_tanpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_TANPI_H__
diff --git a/libclc/clc/include/clc/math/clc_tgamma.h b/libclc/clc/include/clc/math/clc_tgamma.h
index d067703c2e9df..dd76e041875d5 100644
--- a/libclc/clc/include/clc/math/clc_tgamma.h
+++ b/libclc/clc/include/clc/math/clc_tgamma.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_TGAMMA_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_tgamma
+#define __CLC_FUNCTION __clc_tgamma
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_TGAMMA_H__
diff --git a/libclc/clc/include/clc/math/clc_trunc.h b/libclc/clc/include/clc/math/clc_trunc.h
index 6a8353a4f6d45..33445f9fe15d6 100644
--- a/libclc/clc/include/clc/math/clc_trunc.h
+++ b/libclc/clc/include/clc/math/clc_trunc.h
@@ -10,10 +10,10 @@
#define __CLC_MATH_CLC_TRUNC_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION __clc_trunc
+#define __CLC_FUNCTION __clc_trunc
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MATH_CLC_TRUNC_H__
diff --git a/libclc/clc/include/clc/math/gentype.inc b/libclc/clc/include/clc/math/gentype.inc
index 299ce6633cf0e..3373f5fa50024 100644
--- a/libclc/clc/include/clc/math/gentype.inc
+++ b/libclc/clc/include/clc/math/gentype.inc
@@ -70,7 +70,7 @@
#define __CLC_CONVERT_S_GENTYPE __CLC_XCONCAT(__clc_convert_, __CLC_S_GENTYPE)
#define __CLC_CONVERT_U_GENTYPE __CLC_XCONCAT(__clc_convert_, __CLC_U_GENTYPE)
-#if (!defined(__HALF_ONLY) && !defined(__DOUBLE_ONLY))
+#if (!defined(__CLC_HALF_ONLY) && !defined(__CLC_DOUBLE_ONLY))
#define __CLC_SCALAR_GENTYPE float
#define __CLC_FPSIZE 32
#define __CLC_FP_LIT(x) (__CLC_GENTYPE) x##F
@@ -145,7 +145,7 @@
#endif
-#if (!defined(__HALF_ONLY) && !defined(__FLOAT_ONLY))
+#if (!defined(__CLC_HALF_ONLY) && !defined(__CLC_FLOAT_ONLY))
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
@@ -223,7 +223,7 @@
#endif
#endif
-#if (!defined(__FLOAT_ONLY) && !defined(__DOUBLE_ONLY))
+#if (!defined(__CLC_FLOAT_ONLY) && !defined(__CLC_DOUBLE_ONLY))
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
@@ -356,6 +356,6 @@
#undef __CLC_AS_GENTYPE
#undef __CLC_CONVERT_GENTYPE
-#undef __HALF_ONLY
-#undef __FLOAT_ONLY
-#undef __DOUBLE_ONLY
+#undef __CLC_HALF_ONLY
+#undef __CLC_FLOAT_ONLY
+#undef __CLC_DOUBLE_ONLY
diff --git a/libclc/clc/include/clc/math/math.h b/libclc/clc/include/clc/math/math.h
index 5df53f1b5e5db..c2647f66b4006 100644
--- a/libclc/clc/include/clc/math/math.h
+++ b/libclc/clc/include/clc/math/math.h
@@ -120,6 +120,4 @@ _CLC_OVERLOAD _CLC_INLINE float __clc_flush_denormal_if_not_supported(float x) {
#endif // cl_khr_fp16
-#define ALIGNED(x) __attribute__((aligned(x)))
-
#endif // __CLC_MATH_MATH_H__
diff --git a/libclc/clc/include/clc/math/remquo_decl.inc b/libclc/clc/include/clc/math/remquo_decl.inc
index 24d96b0488059..cba28a7244eb4 100644
--- a/libclc/clc/include/clc/math/remquo_decl.inc
+++ b/libclc/clc/include/clc/math/remquo_decl.inc
@@ -6,15 +6,19 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y,
- private __CLC_INTN *q);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_GENTYPE y,
+ private __CLC_INTN *q);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y,
- global __CLC_INTN *q);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_GENTYPE y,
+ global __CLC_INTN *q);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y,
- local __CLC_INTN *q);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_GENTYPE y,
+ local __CLC_INTN *q);
#if _CLC_GENERIC_AS_SUPPORTED
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y,
- generic __CLC_INTN *q);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_GENTYPE y,
+ generic __CLC_INTN *q);
#endif
diff --git a/libclc/clc/include/clc/math/tables.h b/libclc/clc/include/clc/math/tables.h
index 0fec778b53679..ad4b0547f8c69 100644
--- a/libclc/clc/include/clc/math/tables.h
+++ b/libclc/clc/include/clc/math/tables.h
@@ -11,35 +11,36 @@
#include <clc/clctypes.h>
-#define TABLE_SPACE __constant
+#define __CLC_TABLE_SPACE __constant
-#define TABLE_MANGLE(NAME) __clc_##NAME
+#define __CLC_TABLE_MANGLE(NAME) __clc_##NAME
-#define DECLARE_TABLE(TYPE, NAME, LENGTH) TABLE_SPACE TYPE NAME[LENGTH]
+#define __CLC_DECLARE_TABLE(TYPE, NAME, LENGTH) \
+ __CLC_TABLE_SPACE TYPE NAME[LENGTH]
-#define TABLE_FUNCTION(TYPE, TABLE, NAME) \
- TYPE TABLE_MANGLE(NAME)(size_t idx) { return TABLE[idx]; }
+#define __CLC_TABLE_FUNCTION(TYPE, TABLE, NAME) \
+ TYPE __CLC_TABLE_MANGLE(NAME)(size_t idx) { return TABLE[idx]; }
-#define CLC_TABLE_FUNCTION(TYPE, TABLE, NAME) \
- _CLC_DEF _CLC_OVERLOAD TYPE TABLE_MANGLE(NAME)(int idx) { \
+#define __CLC_TABLE_FUNCTION_VEC(TYPE, TABLE, NAME) \
+ _CLC_DEF _CLC_OVERLOAD TYPE __CLC_TABLE_MANGLE(NAME)(int idx) { \
return TABLE[idx]; \
} \
- _CLC_DEF _CLC_OVERLOAD TYPE##2 TABLE_MANGLE(NAME)(int##2 idx) { \
+ _CLC_DEF _CLC_OVERLOAD TYPE##2 __CLC_TABLE_MANGLE(NAME)(int##2 idx) { \
return (TYPE##2){TABLE[idx.s0], TABLE[idx.s1]}; \
} \
- _CLC_DEF _CLC_OVERLOAD TYPE##3 TABLE_MANGLE(NAME)(int##3 idx) { \
+ _CLC_DEF _CLC_OVERLOAD TYPE##3 __CLC_TABLE_MANGLE(NAME)(int##3 idx) { \
return (TYPE##3){TABLE[idx.s0], TABLE[idx.s1], TABLE[idx.s2]}; \
} \
- _CLC_DEF _CLC_OVERLOAD TYPE##4 TABLE_MANGLE(NAME)(int##4 idx) { \
+ _CLC_DEF _CLC_OVERLOAD TYPE##4 __CLC_TABLE_MANGLE(NAME)(int##4 idx) { \
return (TYPE##4){TABLE[idx.s0], TABLE[idx.s1], TABLE[idx.s2], \
TABLE[idx.s3]}; \
} \
- _CLC_DEF _CLC_OVERLOAD TYPE##8 TABLE_MANGLE(NAME)(int##8 idx) { \
+ _CLC_DEF _CLC_OVERLOAD TYPE##8 __CLC_TABLE_MANGLE(NAME)(int##8 idx) { \
return (TYPE##8){TABLE[idx.s0], TABLE[idx.s1], TABLE[idx.s2], \
TABLE[idx.s3], TABLE[idx.s4], TABLE[idx.s5], \
TABLE[idx.s6], TABLE[idx.s7]}; \
} \
- _CLC_DEF _CLC_OVERLOAD TYPE##16 TABLE_MANGLE(NAME)(int##16 idx) { \
+ _CLC_DEF _CLC_OVERLOAD TYPE##16 __CLC_TABLE_MANGLE(NAME)(int##16 idx) { \
return (TYPE##16){ \
TABLE[idx.s0], TABLE[idx.s1], TABLE[idx.s2], TABLE[idx.s3], \
TABLE[idx.s4], TABLE[idx.s5], TABLE[idx.s6], TABLE[idx.s7], \
@@ -47,58 +48,59 @@
TABLE[idx.sC], TABLE[idx.sD], TABLE[idx.sE], TABLE[idx.sF]}; \
}
-#define TABLE_FUNCTION_DECL(TYPE, NAME) TYPE TABLE_MANGLE(NAME)(size_t idx);
-
-#define CLC_TABLE_FUNCTION_DECL(TYPE, NAME) \
- _CLC_DECL _CLC_OVERLOAD TYPE TABLE_MANGLE(NAME)(int idx); \
- _CLC_DECL _CLC_OVERLOAD TYPE##2 TABLE_MANGLE(NAME)(int##2 idx); \
- _CLC_DECL _CLC_OVERLOAD TYPE##3 TABLE_MANGLE(NAME)(int##3 idx); \
- _CLC_DECL _CLC_OVERLOAD TYPE##4 TABLE_MANGLE(NAME)(int##4 idx); \
- _CLC_DECL _CLC_OVERLOAD TYPE##8 TABLE_MANGLE(NAME)(int##8 idx); \
- _CLC_DECL _CLC_OVERLOAD TYPE##16 TABLE_MANGLE(NAME)(int##16 idx);
-
-#define USE_TABLE(NAME, IDX) TABLE_MANGLE(NAME)(IDX)
-
-TABLE_FUNCTION_DECL(float2, log2_tbl);
-TABLE_FUNCTION_DECL(float2, log10_tbl);
-
-CLC_TABLE_FUNCTION_DECL(float, log_inv_tbl_ep_head);
-CLC_TABLE_FUNCTION_DECL(float, log_inv_tbl_ep_tail);
-CLC_TABLE_FUNCTION_DECL(float, loge_tbl_lo);
-CLC_TABLE_FUNCTION_DECL(float, loge_tbl_hi);
-CLC_TABLE_FUNCTION_DECL(float, log_inv_tbl);
-CLC_TABLE_FUNCTION_DECL(float, exp_tbl);
-CLC_TABLE_FUNCTION_DECL(float, exp_tbl_ep_head);
-CLC_TABLE_FUNCTION_DECL(float, exp_tbl_ep_tail);
-CLC_TABLE_FUNCTION_DECL(float, cbrt_tbl_head);
-CLC_TABLE_FUNCTION_DECL(float, cbrt_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(float, sinhcosh_tbl_head);
-CLC_TABLE_FUNCTION_DECL(float, sinhcosh_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(ulong, pibits_tbl);
+#define __CLC_TABLE_FUNCTION_DECL(TYPE, NAME) \
+ TYPE __CLC_TABLE_MANGLE(NAME)(size_t idx);
+
+#define __CLC_TABLE_FUNCTION_DECL_VEC(TYPE, NAME) \
+ _CLC_DECL _CLC_OVERLOAD TYPE __CLC_TABLE_MANGLE(NAME)(int idx); \
+ _CLC_DECL _CLC_OVERLOAD TYPE##2 __CLC_TABLE_MANGLE(NAME)(int##2 idx); \
+ _CLC_DECL _CLC_OVERLOAD TYPE##3 __CLC_TABLE_MANGLE(NAME)(int##3 idx); \
+ _CLC_DECL _CLC_OVERLOAD TYPE##4 __CLC_TABLE_MANGLE(NAME)(int##4 idx); \
+ _CLC_DECL _CLC_OVERLOAD TYPE##8 __CLC_TABLE_MANGLE(NAME)(int##8 idx); \
+ _CLC_DECL _CLC_OVERLOAD TYPE##16 __CLC_TABLE_MANGLE(NAME)(int##16 idx);
+
+#define __CLC_USE_TABLE(NAME, IDX) __CLC_TABLE_MANGLE(NAME)(IDX)
+
+__CLC_TABLE_FUNCTION_DECL(float2, log2_tbl);
+__CLC_TABLE_FUNCTION_DECL(float2, log10_tbl);
+
+__CLC_TABLE_FUNCTION_DECL_VEC(float, log_inv_tbl_ep_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, log_inv_tbl_ep_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, loge_tbl_lo);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, loge_tbl_hi);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, log_inv_tbl);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, exp_tbl);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, exp_tbl_ep_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, exp_tbl_ep_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, cbrt_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, cbrt_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, sinhcosh_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(float, sinhcosh_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(ulong, pibits_tbl);
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-CLC_TABLE_FUNCTION_DECL(double, ln_tbl_lo);
-CLC_TABLE_FUNCTION_DECL(double, ln_tbl_hi);
-CLC_TABLE_FUNCTION_DECL(double, atan_jby256_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, atan_jby256_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, two_to_jby64_ep_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, two_to_jby64_ep_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, sinh_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, sinh_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, cosh_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, cosh_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, cbrt_inv_tbl);
-CLC_TABLE_FUNCTION_DECL(double, cbrt_dbl_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, cbrt_dbl_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, cbrt_rem_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, cbrt_rem_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, powlog_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, powlog_tbl_tail);
-CLC_TABLE_FUNCTION_DECL(double, log_f_inv_tbl_head);
-CLC_TABLE_FUNCTION_DECL(double, log_f_inv_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, ln_tbl_lo);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, ln_tbl_hi);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, atan_jby256_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, atan_jby256_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, two_to_jby64_ep_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, two_to_jby64_ep_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, sinh_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, sinh_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cosh_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cosh_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cbrt_inv_tbl);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cbrt_dbl_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cbrt_dbl_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cbrt_rem_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, cbrt_rem_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, powlog_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, powlog_tbl_tail);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, log_f_inv_tbl_head);
+__CLC_TABLE_FUNCTION_DECL_VEC(double, log_f_inv_tbl_tail);
#endif // cl_khr_fp64
diff --git a/libclc/clc/include/clc/math/unary_decl.inc b/libclc/clc/include/clc/math/unary_decl.inc
index 46108c5fac9e7..19f1c8a876e53 100644
--- a/libclc/clc/include/clc/math/unary_decl.inc
+++ b/libclc/clc/include/clc/math/unary_decl.inc
@@ -6,4 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x);
diff --git a/libclc/clc/include/clc/math/unary_decl_with_int_ptr.inc b/libclc/clc/include/clc/math/unary_decl_with_int_ptr.inc
index d62046a5292cd..8bfe17c3c6817 100644
--- a/libclc/clc/include/clc/math/unary_decl_with_int_ptr.inc
+++ b/libclc/clc/include/clc/math/unary_decl_with_int_ptr.inc
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- global __CLC_INTN *iptr);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- local __CLC_INTN *iptr);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- private __CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ global __CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ local __CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ private __CLC_INTN *iptr);
#if _CLC_GENERIC_AS_SUPPORTED
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- generic __CLC_INTN *iptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ generic __CLC_INTN *iptr);
#endif
diff --git a/libclc/clc/include/clc/math/unary_decl_with_int_return.inc b/libclc/clc/include/clc/math/unary_decl_with_int_return.inc
index 64fcf4267da34..2e86a310b018b 100644
--- a/libclc/clc/include/clc/math/unary_decl_with_int_return.inc
+++ b/libclc/clc/include/clc/math/unary_decl_with_int_return.inc
@@ -6,4 +6,4 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_INTN FUNCTION(__CLC_GENTYPE x);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_INTN __CLC_FUNCTION(__CLC_GENTYPE x);
diff --git a/libclc/clc/include/clc/math/unary_decl_with_ptr.inc b/libclc/clc/include/clc/math/unary_decl_with_ptr.inc
index ca0077bec558f..63a20e3d21c5d 100644
--- a/libclc/clc/include/clc/math/unary_decl_with_ptr.inc
+++ b/libclc/clc/include/clc/math/unary_decl_with_ptr.inc
@@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- global __CLC_GENTYPE *ptr);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- local __CLC_GENTYPE *ptr);
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- private __CLC_GENTYPE *ptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ global __CLC_GENTYPE *ptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ local __CLC_GENTYPE *ptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, private __CLC_GENTYPE *ptr);
#if _CLC_GENERIC_AS_SUPPORTED
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- generic __CLC_GENTYPE *ptr);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, generic __CLC_GENTYPE *ptr);
#endif
diff --git a/libclc/clc/include/clc/math/unary_def_with_int_ptr.inc b/libclc/clc/include/clc/math/unary_def_with_int_ptr.inc
index a8ed34ad04bbf..db6472ad0e645 100644
--- a/libclc/clc/include/clc/math/unary_def_with_int_ptr.inc
+++ b/libclc/clc/include/clc/math/unary_def_with_int_ptr.inc
@@ -8,28 +8,28 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- private __CLC_INTN *iptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, iptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ private __CLC_INTN *iptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, iptr);
}
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- global __CLC_INTN *iptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, iptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ global __CLC_INTN *iptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, iptr);
}
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- local __CLC_INTN *iptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, iptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ local __CLC_INTN *iptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, iptr);
}
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- generic __CLC_INTN *iptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, iptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ generic __CLC_INTN *iptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, iptr);
}
#endif
diff --git a/libclc/clc/include/clc/math/unary_def_with_int_return.inc b/libclc/clc/include/clc/math/unary_def_with_int_return.inc
index c7bb84cf5f7c8..7a47aae8ce637 100644
--- a/libclc/clc/include/clc/math/unary_def_with_int_return.inc
+++ b/libclc/clc/include/clc/math/unary_def_with_int_return.inc
@@ -8,10 +8,10 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_INTN FUNCTION(__CLC_GENTYPE a) {
- return __IMPL_FUNCTION(FUNCTION)(a);
+_CLC_OVERLOAD _CLC_DEF __CLC_INTN __CLC_FUNCTION(__CLC_GENTYPE a) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a);
}
diff --git a/libclc/clc/include/clc/math/unary_def_with_ptr.inc b/libclc/clc/include/clc/math/unary_def_with_ptr.inc
index c3faa9aab87c9..8a490e1bba16d 100644
--- a/libclc/clc/include/clc/math/unary_def_with_ptr.inc
+++ b/libclc/clc/include/clc/math/unary_def_with_ptr.inc
@@ -8,28 +8,28 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- private __CLC_GENTYPE *ptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, ptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, private __CLC_GENTYPE *ptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, ptr);
}
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- global __CLC_GENTYPE *ptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, ptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ global __CLC_GENTYPE *ptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, ptr);
}
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- local __CLC_GENTYPE *ptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, ptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ local __CLC_GENTYPE *ptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, ptr);
}
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- generic __CLC_GENTYPE *ptr) {
- return __IMPL_FUNCTION(FUNCTION)(x, ptr);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, generic __CLC_GENTYPE *ptr) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, ptr);
}
#endif
diff --git a/libclc/clc/include/clc/misc/clc_shuffle.h b/libclc/clc/include/clc/misc/clc_shuffle.h
index 1e9ec6828f95a..ba3d7a2bddd62 100644
--- a/libclc/clc/include/clc/misc/clc_shuffle.h
+++ b/libclc/clc/include/clc/misc/clc_shuffle.h
@@ -9,7 +9,7 @@
#ifndef __CLC_MISC_CLC_SHUFFLE_H__
#define __CLC_MISC_CLC_SHUFFLE_H__
-#define FUNCTION __clc_shuffle
+#define __CLC_FUNCTION __clc_shuffle
// Integer-type decls
#define __CLC_BODY <clc/misc/shuffle_decl.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/misc/shuffle_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MISC_CLC_SHUFFLE_H__
diff --git a/libclc/clc/include/clc/misc/clc_shuffle2.h b/libclc/clc/include/clc/misc/clc_shuffle2.h
index fb5361cfeb95a..84bafba12b211 100644
--- a/libclc/clc/include/clc/misc/clc_shuffle2.h
+++ b/libclc/clc/include/clc/misc/clc_shuffle2.h
@@ -9,7 +9,7 @@
#ifndef __CLC_MISC_CLC_SHUFFLE2_H__
#define __CLC_MISC_CLC_SHUFFLE2_H__
-#define FUNCTION __clc_shuffle2
+#define __CLC_FUNCTION __clc_shuffle2
// Integer-type decls
#define __CLC_BODY <clc/misc/shuffle2_decl.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/misc/shuffle2_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_MISC_CLC_SHUFFLE2_H__
diff --git a/libclc/clc/include/clc/misc/shuffle2_decl.inc b/libclc/clc/include/clc/misc/shuffle2_decl.inc
index 3504e7876277b..37f83cba9939c 100644
--- a/libclc/clc/include/clc/misc/shuffle2_decl.inc
+++ b/libclc/clc/include/clc/misc/shuffle2_decl.inc
@@ -13,16 +13,16 @@
// size as the mask. Elements in the mask must be the same size (number of bits)
// as the input value., e.g. char8 ret = shuffle(char2 x, uchar8 mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) y, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) y, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) y, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) y, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) y, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) y, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) y, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) y, __CLC_U_GENTYPE mask);
#endif
diff --git a/libclc/clc/include/clc/misc/shuffle2_def.inc b/libclc/clc/include/clc/misc/shuffle2_def.inc
index 0415b8c187291..f25d281af1169 100644
--- a/libclc/clc/include/clc/misc/shuffle2_def.inc
+++ b/libclc/clc/include/clc/misc/shuffle2_def.inc
@@ -11,32 +11,32 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
// The return type is same base type as the input type, with the same vector
// size as the mask. Elements in the mask must be the same size (number of bits)
// as the input value., e.g. char8 ret = shuffle(char2 x, uchar8 mask);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) y, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, y, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) y, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, y, mask);
}
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) y, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, y, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) y, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, y, mask);
}
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) y, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, y, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) y, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, y, mask);
}
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x,
- __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) y, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, y, mask);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x,
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) y, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, y, mask);
}
#endif
diff --git a/libclc/clc/include/clc/misc/shuffle_decl.inc b/libclc/clc/include/clc/misc/shuffle_decl.inc
index 1445aaf740527..0056d12f0f428 100644
--- a/libclc/clc/include/clc/misc/shuffle_decl.inc
+++ b/libclc/clc/include/clc/misc/shuffle_decl.inc
@@ -13,12 +13,12 @@
// size as the mask. Elements in the mask must be the same size (number of bits)
// as the input value., e.g. char8 ret = shuffle(char2 x, uchar8 mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x, __CLC_U_GENTYPE mask);
_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x, __CLC_U_GENTYPE mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x, __CLC_U_GENTYPE mask);
#endif
diff --git a/libclc/clc/include/clc/misc/shuffle_def.inc b/libclc/clc/include/clc/misc/shuffle_def.inc
index d2a088498fc6c..49a47daf821fe 100644
--- a/libclc/clc/include/clc/misc/shuffle_def.inc
+++ b/libclc/clc/include/clc/misc/shuffle_def.inc
@@ -11,28 +11,28 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
// The return type is same base type as the input type, with the same vector
// size as the mask. Elements in the mask must be the same size (number of bits)
// as the input value., e.g. char8 ret = shuffle(char2 x, uchar8 mask);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 2) x, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, mask);
}
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 4) x, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, mask);
}
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, mask);
+__CLC_FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 8) x, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, mask);
}
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE
-FUNCTION(__CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x, __CLC_U_GENTYPE mask) {
- return __IMPL_FUNCTION(FUNCTION)(x, mask);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(
+ __CLC_XCONCAT(__CLC_SCALAR_GENTYPE, 16) x, __CLC_U_GENTYPE mask) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, mask);
}
#endif
diff --git a/libclc/clc/include/clc/relational/binary_decl.inc b/libclc/clc/include/clc/relational/binary_decl.inc
index 87cbc8c37cdf1..34749559c7e09 100644
--- a/libclc/clc/include/clc/relational/binary_decl.inc
+++ b/libclc/clc/include/clc/relational/binary_decl.inc
@@ -7,12 +7,12 @@
//===----------------------------------------------------------------------===//
#if __CLC_VECSIZE_OR_1 == 1
-#define __RETTYPE __CLC_INTN
+#define __CLC_RETTYPE __CLC_INTN
#else
-#define __RETTYPE __CLC_BIT_INTN
+#define __CLC_RETTYPE __CLC_BIT_INTN
#endif
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_RETTYPE
+__CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
-#undef __RETTYPE
+#undef __CLC_RETTYPE
diff --git a/libclc/clc/include/clc/relational/clc_isfinite.h b/libclc/clc/include/clc/relational/clc_isfinite.h
index 444d733039819..596b81f51b853 100644
--- a/libclc/clc/include/clc/relational/clc_isfinite.h
+++ b/libclc/clc/include/clc/relational/clc_isfinite.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISFINITE_H__
#define __CLC_RELATIONAL_CLC_ISFINITE_H__
-#define FUNCTION __clc_isfinite
+#define __CLC_FUNCTION __clc_isfinite
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISFINITE_H__
diff --git a/libclc/clc/include/clc/relational/clc_isgreater.h b/libclc/clc/include/clc/relational/clc_isgreater.h
index 88de46854961d..fc5b3cdad084a 100644
--- a/libclc/clc/include/clc/relational/clc_isgreater.h
+++ b/libclc/clc/include/clc/relational/clc_isgreater.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISGREATER_H__
#define __CLC_RELATIONAL_CLC_ISGREATER_H__
-#define FUNCTION __clc_isgreater
+#define __CLC_FUNCTION __clc_isgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISGREATER_H__
diff --git a/libclc/clc/include/clc/relational/clc_isgreaterequal.h b/libclc/clc/include/clc/relational/clc_isgreaterequal.h
index 42308036f102f..6209a066cf46d 100644
--- a/libclc/clc/include/clc/relational/clc_isgreaterequal.h
+++ b/libclc/clc/include/clc/relational/clc_isgreaterequal.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
#define __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
-#define FUNCTION __clc_isgreaterequal
+#define __CLC_FUNCTION __clc_isgreaterequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISGREATEREQUAL_H__
diff --git a/libclc/clc/include/clc/relational/clc_isless.h b/libclc/clc/include/clc/relational/clc_isless.h
index 6fdc6c54947c0..4e340db121773 100644
--- a/libclc/clc/include/clc/relational/clc_isless.h
+++ b/libclc/clc/include/clc/relational/clc_isless.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESS_H__
#define __CLC_RELATIONAL_CLC_ISLESS_H__
-#define FUNCTION __clc_isless
+#define __CLC_FUNCTION __clc_isless
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISLESS_H__
diff --git a/libclc/clc/include/clc/relational/clc_islessequal.h b/libclc/clc/include/clc/relational/clc_islessequal.h
index e592287b23099..14c5a10301836 100644
--- a/libclc/clc/include/clc/relational/clc_islessequal.h
+++ b/libclc/clc/include/clc/relational/clc_islessequal.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
#define __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
-#define FUNCTION __clc_islessequal
+#define __CLC_FUNCTION __clc_islessequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISLESSEQUAL_H__
diff --git a/libclc/clc/include/clc/relational/clc_islessgreater.h b/libclc/clc/include/clc/relational/clc_islessgreater.h
index a2f10707a677d..530564bbf0595 100644
--- a/libclc/clc/include/clc/relational/clc_islessgreater.h
+++ b/libclc/clc/include/clc/relational/clc_islessgreater.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
#define __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
-#define FUNCTION __clc_islessgreater
+#define __CLC_FUNCTION __clc_islessgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISLESSGREATER_H__
diff --git a/libclc/clc/include/clc/relational/clc_isnormal.h b/libclc/clc/include/clc/relational/clc_isnormal.h
index 2281bc4245d03..9572b02004686 100644
--- a/libclc/clc/include/clc/relational/clc_isnormal.h
+++ b/libclc/clc/include/clc/relational/clc_isnormal.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISNORMAL_H__
#define __CLC_RELATIONAL_CLC_ISNORMAL_H__
-#define FUNCTION __clc_isnormal
+#define __CLC_FUNCTION __clc_isnormal
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISNORMAL_H__
diff --git a/libclc/clc/include/clc/relational/clc_isnotequal.h b/libclc/clc/include/clc/relational/clc_isnotequal.h
index c2640fc0899a6..f90622db9fe1d 100644
--- a/libclc/clc/include/clc/relational/clc_isnotequal.h
+++ b/libclc/clc/include/clc/relational/clc_isnotequal.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
#define __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
-#define FUNCTION __clc_isnotequal
+#define __CLC_FUNCTION __clc_isnotequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISNOTEQUAL_H__
diff --git a/libclc/clc/include/clc/relational/clc_isordered.h b/libclc/clc/include/clc/relational/clc_isordered.h
index cb9be31311575..3f5cc097f4a72 100644
--- a/libclc/clc/include/clc/relational/clc_isordered.h
+++ b/libclc/clc/include/clc/relational/clc_isordered.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISORDERED_H__
#define __CLC_RELATIONAL_CLC_ISORDERED_H__
-#define FUNCTION __clc_isordered
+#define __CLC_FUNCTION __clc_isordered
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISORDERED_H__
diff --git a/libclc/clc/include/clc/relational/clc_isunordered.h b/libclc/clc/include/clc/relational/clc_isunordered.h
index 36d314ff0e1be..6134ba849d229 100644
--- a/libclc/clc/include/clc/relational/clc_isunordered.h
+++ b/libclc/clc/include/clc/relational/clc_isunordered.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_ISUNORDERED_H__
#define __CLC_RELATIONAL_CLC_ISUNORDERED_H__
-#define FUNCTION __clc_isunordered
+#define __CLC_FUNCTION __clc_isunordered
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_ISUNORDERED_H__
diff --git a/libclc/clc/include/clc/relational/clc_signbit.h b/libclc/clc/include/clc/relational/clc_signbit.h
index 9e423ab448953..a8e04ce494f2c 100644
--- a/libclc/clc/include/clc/relational/clc_signbit.h
+++ b/libclc/clc/include/clc/relational/clc_signbit.h
@@ -9,11 +9,11 @@
#ifndef __CLC_RELATIONAL_CLC_SIGNBIT_H__
#define __CLC_RELATIONAL_CLC_SIGNBIT_H__
-#define FUNCTION __clc_signbit
+#define __CLC_FUNCTION __clc_signbit
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_RELATIONAL_CLC_SIGNBIT_H__
diff --git a/libclc/clc/include/clc/relational/relational.h b/libclc/clc/include/clc/relational/relational.h
index e2b577019a50f..fa22232349944 100644
--- a/libclc/clc/include/clc/relational/relational.h
+++ b/libclc/clc/include/clc/relational/relational.h
@@ -14,29 +14,29 @@
* when the result is true.
*/
-#define _CLC_DEFINE_SIMPLE_RELATIONAL_BINARY(RET_TYPE, RET_TYPE_VEC, FUNCTION, \
- ARG1_TYPE, ARG2_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
+#define _CLC_DEFINE_SIMPLE_RELATIONAL_BINARY( \
+ RET_TYPE, RET_TYPE_VEC, __CLC_FUNCTION, ARG1_TYPE, ARG2_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
return _CLC_RELATIONAL_OP(x, y); \
} \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##2 FUNCTION(ARG1_TYPE##2 x, \
- ARG2_TYPE##2 y) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##2 __CLC_FUNCTION(ARG1_TYPE##2 x, \
+ ARG2_TYPE##2 y) { \
return _CLC_RELATIONAL_OP(x, y); \
} \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##3 FUNCTION(ARG1_TYPE##3 x, \
- ARG2_TYPE##3 y) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##3 __CLC_FUNCTION(ARG1_TYPE##3 x, \
+ ARG2_TYPE##3 y) { \
return _CLC_RELATIONAL_OP(x, y); \
} \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##4 FUNCTION(ARG1_TYPE##4 x, \
- ARG2_TYPE##4 y) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##4 __CLC_FUNCTION(ARG1_TYPE##4 x, \
+ ARG2_TYPE##4 y) { \
return _CLC_RELATIONAL_OP(x, y); \
} \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##8 FUNCTION(ARG1_TYPE##8 x, \
- ARG2_TYPE##8 y) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##8 __CLC_FUNCTION(ARG1_TYPE##8 x, \
+ ARG2_TYPE##8 y) { \
return _CLC_RELATIONAL_OP(x, y); \
} \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##16 FUNCTION(ARG1_TYPE##16 x, \
- ARG2_TYPE##16 y) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE_VEC##16 __CLC_FUNCTION(ARG1_TYPE##16 x, \
+ ARG2_TYPE##16 y) { \
return _CLC_RELATIONAL_OP(x, y); \
}
@@ -49,20 +49,25 @@
(__FPCLASS_NEGNORMAL | __FPCLASS_NEGSUBNORMAL | __FPCLASS_NEGZERO)
#define fcFinite (fcPosFinite | fcNegFinite)
-#define _CLC_DEFINE_ISFPCLASS_VEC(RET_TYPE, FUNCTION, MASK, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
+#define _CLC_DEFINE_ISFPCLASS_VEC(RET_TYPE, __CLC_FUNCTION, MASK, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
return (RET_TYPE)(__builtin_isfpclass(x, (MASK)) != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_ISFPCLASS(RET_TYPE, VEC_RET_TYPE, FUNCTION, MASK, \
+#define _CLC_DEFINE_ISFPCLASS(RET_TYPE, VEC_RET_TYPE, __CLC_FUNCTION, MASK, \
ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
return __builtin_isfpclass(x, (MASK)); \
} \
- _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##2, FUNCTION, MASK, ARG_TYPE##2) \
- _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##3, FUNCTION, MASK, ARG_TYPE##3) \
- _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##4, FUNCTION, MASK, ARG_TYPE##4) \
- _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##8, FUNCTION, MASK, ARG_TYPE##8) \
- _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##16, FUNCTION, MASK, ARG_TYPE##16)
+ _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##2, __CLC_FUNCTION, MASK, \
+ ARG_TYPE##2) \
+ _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##3, __CLC_FUNCTION, MASK, \
+ ARG_TYPE##3) \
+ _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##4, __CLC_FUNCTION, MASK, \
+ ARG_TYPE##4) \
+ _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##8, __CLC_FUNCTION, MASK, \
+ ARG_TYPE##8) \
+ _CLC_DEFINE_ISFPCLASS_VEC(VEC_RET_TYPE##16, __CLC_FUNCTION, MASK, \
+ ARG_TYPE##16)
#endif // __CLC_RELATIONAL_RELATIONAL_H__
diff --git a/libclc/clc/include/clc/relational/unary_decl.inc b/libclc/clc/include/clc/relational/unary_decl.inc
index f8123eee316c7..df74194040253 100644
--- a/libclc/clc/include/clc/relational/unary_decl.inc
+++ b/libclc/clc/include/clc/relational/unary_decl.inc
@@ -7,11 +7,12 @@
//===----------------------------------------------------------------------===//
#if __CLC_VECSIZE_OR_1 == 1
-#define __RETTYPE __CLC_INTN
+#define __CLC_RETTYPE __CLC_INTN
#else
-#define __RETTYPE __CLC_BIT_INTN
+#define __CLC_RETTYPE __CLC_BIT_INTN
#endif
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE x);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_RETTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x);
-#undef __RETTYPE
+#undef __CLC_RETTYPE
diff --git a/libclc/clc/include/clc/shared/binary_decl.inc b/libclc/clc/include/clc/shared/binary_decl.inc
index c6e2b2a5b0603..f7f49519f6fca 100644
--- a/libclc/clc/include/clc/shared/binary_decl.inc
+++ b/libclc/clc/include/clc/shared/binary_decl.inc
@@ -6,5 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- __CLC_GENTYPE y);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y);
diff --git a/libclc/clc/include/clc/shared/binary_decl_with_int_second_arg.inc b/libclc/clc/include/clc/shared/binary_decl_with_int_second_arg.inc
index a091eb8e8d1db..25cf52c84811e 100644
--- a/libclc/clc/include/clc/shared/binary_decl_with_int_second_arg.inc
+++ b/libclc/clc/include/clc/shared/binary_decl_with_int_second_arg.inc
@@ -8,5 +8,5 @@
#include <clc/utils.h>
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
- __CLC_INTN y);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_INTN y);
diff --git a/libclc/clc/include/clc/shared/binary_def.inc b/libclc/clc/include/clc/shared/binary_def.inc
index 9ab5a7c5a79e5..5487ad926768d 100644
--- a/libclc/clc/include/clc/shared/binary_def.inc
+++ b/libclc/clc/include/clc/shared/binary_def.inc
@@ -8,11 +8,11 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b) {
- return __IMPL_FUNCTION(FUNCTION)(a, b);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_GENTYPE b) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, b);
}
diff --git a/libclc/clc/include/clc/shared/binary_def_scalarize.inc b/libclc/clc/include/clc/shared/binary_def_scalarize.inc
index 53d4d3fa23b13..2505f2ee0da2d 100644
--- a/libclc/clc/include/clc/shared/binary_def_scalarize.inc
+++ b/libclc/clc/include/clc/shared/binary_def_scalarize.inc
@@ -14,8 +14,8 @@
#define __CLC_MIN_VECSIZE 2
#endif
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION FUNCTION
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION __CLC_FUNCTION
#endif
#ifndef __CLC_DEF_SPEC
@@ -35,9 +35,9 @@
#endif
#if __CLC_MIN_VECSIZE == 1
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE FUNCTION(__CLC_ARG1_TYPE x,
- __CLC_ARG2_TYPE y) {
- return __IMPL_FUNCTION(x, y);
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE __CLC_FUNCTION(__CLC_ARG1_TYPE x,
+ __CLC_ARG2_TYPE y) {
+ return __CLC_IMPL_FUNCTION(x, y);
}
#endif // __CLC_MIN_VECSIZE == 1
@@ -45,10 +45,10 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE FUNCTION(__CLC_ARG1_TYPE x,
#define __CLC_RET_TYPE2 __CLC_XCONCAT(__CLC_RET_TYPE, 2)
#define __CLC_ARG1_TYPE2 __CLC_XCONCAT(__CLC_ARG1_TYPE, 2)
#define __CLC_ARG2_TYPE2 __CLC_XCONCAT(__CLC_ARG2_TYPE, 2)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x,
- __CLC_ARG2_TYPE2 y) {
- return (__CLC_RET_TYPE2)(__IMPL_FUNCTION(x.s0, y.s0),
- __IMPL_FUNCTION(x.s1, y.s1));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2
+__CLC_FUNCTION(__CLC_ARG1_TYPE2 x, __CLC_ARG2_TYPE2 y) {
+ return (__CLC_RET_TYPE2)(__CLC_IMPL_FUNCTION(x.s0, y.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1));
}
#undef __CLC_RET_TYPE2
#undef __CLC_ARG1_TYPE2
@@ -62,11 +62,11 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x,
#define __CLC_RET_TYPE3 __CLC_XCONCAT(__CLC_RET_TYPE, 3)
#define __CLC_ARG1_TYPE3 __CLC_XCONCAT(__CLC_ARG1_TYPE, 3)
#define __CLC_ARG2_TYPE3 __CLC_XCONCAT(__CLC_ARG2_TYPE, 3)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3 FUNCTION(__CLC_ARG1_TYPE3 x,
- __CLC_ARG2_TYPE3 y) {
- return (__CLC_RET_TYPE3)(__IMPL_FUNCTION(x.s0, y.s0),
- __IMPL_FUNCTION(x.s1, y.s1),
- __IMPL_FUNCTION(x.s2, y.s2));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3
+__CLC_FUNCTION(__CLC_ARG1_TYPE3 x, __CLC_ARG2_TYPE3 y) {
+ return (__CLC_RET_TYPE3)(__CLC_IMPL_FUNCTION(x.s0, y.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2));
}
#undef __CLC_RET_TYPE3
#undef __CLC_ARG1_TYPE3
@@ -75,12 +75,12 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3 FUNCTION(__CLC_ARG1_TYPE3 x,
#define __CLC_RET_TYPE4 __CLC_XCONCAT(__CLC_RET_TYPE, 4)
#define __CLC_ARG1_TYPE4 __CLC_XCONCAT(__CLC_ARG1_TYPE, 4)
#define __CLC_ARG2_TYPE4 __CLC_XCONCAT(__CLC_ARG2_TYPE, 4)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4 FUNCTION(__CLC_ARG1_TYPE4 x,
- __CLC_ARG2_TYPE4 y) {
- return (__CLC_RET_TYPE4)(__IMPL_FUNCTION(x.s0, y.s0),
- __IMPL_FUNCTION(x.s1, y.s1),
- __IMPL_FUNCTION(x.s2, y.s2),
- __IMPL_FUNCTION(x.s3, y.s3));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4
+__CLC_FUNCTION(__CLC_ARG1_TYPE4 x, __CLC_ARG2_TYPE4 y) {
+ return (__CLC_RET_TYPE4)(__CLC_IMPL_FUNCTION(x.s0, y.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3));
}
#undef __CLC_RET_TYPE4
#undef __CLC_ARG1_TYPE4
@@ -89,14 +89,16 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4 FUNCTION(__CLC_ARG1_TYPE4 x,
#define __CLC_RET_TYPE8 __CLC_XCONCAT(__CLC_RET_TYPE, 8)
#define __CLC_ARG1_TYPE8 __CLC_XCONCAT(__CLC_ARG1_TYPE, 8)
#define __CLC_ARG2_TYPE8 __CLC_XCONCAT(__CLC_ARG2_TYPE, 8)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8 FUNCTION(__CLC_ARG1_TYPE8 x,
- __CLC_ARG2_TYPE8 y) {
- return (
- __CLC_RET_TYPE8)(__IMPL_FUNCTION(x.s0, y.s0), __IMPL_FUNCTION(x.s1, y.s1),
- __IMPL_FUNCTION(x.s2, y.s2), __IMPL_FUNCTION(x.s3, y.s3),
- __IMPL_FUNCTION(x.s4, y.s4), __IMPL_FUNCTION(x.s5, y.s5),
- __IMPL_FUNCTION(x.s6, y.s6),
- __IMPL_FUNCTION(x.s7, y.s7));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8
+__CLC_FUNCTION(__CLC_ARG1_TYPE8 x, __CLC_ARG2_TYPE8 y) {
+ return (__CLC_RET_TYPE8)(__CLC_IMPL_FUNCTION(x.s0, y.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3),
+ __CLC_IMPL_FUNCTION(x.s4, y.s4),
+ __CLC_IMPL_FUNCTION(x.s5, y.s5),
+ __CLC_IMPL_FUNCTION(x.s6, y.s6),
+ __CLC_IMPL_FUNCTION(x.s7, y.s7));
}
#undef __CLC_RET_TYPE8
#undef __CLC_ARG1_TYPE8
@@ -105,24 +107,24 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8 FUNCTION(__CLC_ARG1_TYPE8 x,
#define __CLC_RET_TYPE16 __CLC_XCONCAT(__CLC_RET_TYPE, 16)
#define __CLC_ARG1_TYPE16 __CLC_XCONCAT(__CLC_ARG1_TYPE, 16)
#define __CLC_ARG2_TYPE16 __CLC_XCONCAT(__CLC_ARG2_TYPE, 16)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE16 FUNCTION(__CLC_ARG1_TYPE16 x,
- __CLC_ARG2_TYPE16 y) {
- return (__CLC_RET_TYPE16)(__IMPL_FUNCTION(x.s0, y.s0),
- __IMPL_FUNCTION(x.s1, y.s1),
- __IMPL_FUNCTION(x.s2, y.s2),
- __IMPL_FUNCTION(x.s3, y.s3),
- __IMPL_FUNCTION(x.s4, y.s4),
- __IMPL_FUNCTION(x.s5, y.s5),
- __IMPL_FUNCTION(x.s6, y.s6),
- __IMPL_FUNCTION(x.s7, y.s7),
- __IMPL_FUNCTION(x.s8, y.s8),
- __IMPL_FUNCTION(x.s9, y.s9),
- __IMPL_FUNCTION(x.sa, y.sa),
- __IMPL_FUNCTION(x.sb, y.sb),
- __IMPL_FUNCTION(x.sc, y.sc),
- __IMPL_FUNCTION(x.sd, y.sd),
- __IMPL_FUNCTION(x.se, y.se),
- __IMPL_FUNCTION(x.sf, y.sf));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE16
+__CLC_FUNCTION(__CLC_ARG1_TYPE16 x, __CLC_ARG2_TYPE16 y) {
+ return (__CLC_RET_TYPE16)(__CLC_IMPL_FUNCTION(x.s0, y.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3),
+ __CLC_IMPL_FUNCTION(x.s4, y.s4),
+ __CLC_IMPL_FUNCTION(x.s5, y.s5),
+ __CLC_IMPL_FUNCTION(x.s6, y.s6),
+ __CLC_IMPL_FUNCTION(x.s7, y.s7),
+ __CLC_IMPL_FUNCTION(x.s8, y.s8),
+ __CLC_IMPL_FUNCTION(x.s9, y.s9),
+ __CLC_IMPL_FUNCTION(x.sa, y.sa),
+ __CLC_IMPL_FUNCTION(x.sb, y.sb),
+ __CLC_IMPL_FUNCTION(x.sc, y.sc),
+ __CLC_IMPL_FUNCTION(x.sd, y.sd),
+ __CLC_IMPL_FUNCTION(x.se, y.se),
+ __CLC_IMPL_FUNCTION(x.sf, y.sf));
}
#undef __CLC_RET_TYPE16
#undef __CLC_ARG1_TYPE16
diff --git a/libclc/clc/include/clc/shared/binary_def_with_int_second_arg.inc b/libclc/clc/include/clc/shared/binary_def_with_int_second_arg.inc
index 262b6b21cc648..2c32754044db9 100644
--- a/libclc/clc/include/clc/shared/binary_def_with_int_second_arg.inc
+++ b/libclc/clc/include/clc/shared/binary_def_with_int_second_arg.inc
@@ -8,10 +8,11 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_INTN y) {
- return __IMPL_FUNCTION(FUNCTION)(x, y);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
+ __CLC_INTN y) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, y);
}
diff --git a/libclc/clc/include/clc/shared/binary_def_with_scalar_second_arg.inc b/libclc/clc/include/clc/shared/binary_def_with_scalar_second_arg.inc
index 103f775ab87e5..7a6283d7190da 100644
--- a/libclc/clc/include/clc/shared/binary_def_with_scalar_second_arg.inc
+++ b/libclc/clc/include/clc/shared/binary_def_with_scalar_second_arg.inc
@@ -8,18 +8,18 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b) {
- return __IMPL_FUNCTION(FUNCTION)(a, b);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_GENTYPE b) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, b);
}
#ifndef __CLC_SCALAR
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_SCALAR_GENTYPE b) {
- return __IMPL_FUNCTION(FUNCTION)(a, (__CLC_GENTYPE)b);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_SCALAR_GENTYPE b) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, (__CLC_GENTYPE)b);
}
#endif
diff --git a/libclc/clc/include/clc/shared/clc_vload.inc b/libclc/clc/include/clc/shared/clc_vload.inc
index 8f3b00ec04454..70bca250e4135 100644
--- a/libclc/clc/include/clc/shared/clc_vload.inc
+++ b/libclc/clc/include/clc/shared/clc_vload.inc
@@ -6,29 +6,29 @@
//
//===----------------------------------------------------------------------===//
-#define CLC_VLOAD_NAME __CLC_XCONCAT(__clc_vload, __CLC_VECSIZE)
-#define CLC_VLOAD_HALF_NAME __CLC_XCONCAT(__clc_vload_half, __CLC_VECSIZE)
-#define CLC_VLOADA_HALF_NAME __CLC_XCONCAT(__clc_vloada_half, __CLC_VECSIZE)
+#define __CLC_VLOAD_NAME __CLC_XCONCAT(__clc_vload, __CLC_VECSIZE)
+#define __CLC_VLOAD_HALF_NAME __CLC_XCONCAT(__clc_vload_half, __CLC_VECSIZE)
+#define __CLC_VLOADA_HALF_NAME __CLC_XCONCAT(__clc_vloada_half, __CLC_VECSIZE)
#ifndef __CLC_SCALAR
-#define CLC_VLOAD_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
+#define __CLC_VLOAD_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
-#define CLC_VLOAD_DECL(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL CLC_VLOAD_TY CLC_VLOAD_NAME( \
+#define __CLC_VLOAD_DECL(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DECL __CLC_VLOAD_TY __CLC_VLOAD_NAME( \
size_t offset, const ADDRSPACE __CLC_SCALAR_GENTYPE *x);
-CLC_VLOAD_DECL(__private)
-CLC_VLOAD_DECL(__local)
-CLC_VLOAD_DECL(__constant)
-CLC_VLOAD_DECL(__global)
+__CLC_VLOAD_DECL(__private)
+__CLC_VLOAD_DECL(__local)
+__CLC_VLOAD_DECL(__constant)
+__CLC_VLOAD_DECL(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VLOAD_DECL(__generic)
+__CLC_VLOAD_DECL(__generic)
#endif
-#undef CLC_VLOAD_DECL
-#undef CLC_VLOAD_TY
+#undef __CLC_VLOAD_DECL
+#undef __CLC_VLOAD_TY
#endif // __CLC_SCALAR
@@ -38,27 +38,27 @@ CLC_VLOAD_DECL(__generic)
#ifdef __CLC_FPSIZE
#if __CLC_FPSIZE == 32
-#define CLC_VLOAD_HALF_DECL(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE CLC_VLOAD_HALF_NAME( \
+#define __CLC_VLOAD_HALF_DECL(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_VLOAD_HALF_NAME( \
size_t offset, const ADDRSPACE half *mem); \
\
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE CLC_VLOADA_HALF_NAME( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_VLOADA_HALF_NAME( \
size_t offset, const ADDRSPACE half *mem);
-CLC_VLOAD_HALF_DECL(__private)
-CLC_VLOAD_HALF_DECL(__local)
-CLC_VLOAD_HALF_DECL(__constant)
-CLC_VLOAD_HALF_DECL(__global)
+__CLC_VLOAD_HALF_DECL(__private)
+__CLC_VLOAD_HALF_DECL(__local)
+__CLC_VLOAD_HALF_DECL(__constant)
+__CLC_VLOAD_HALF_DECL(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VLOAD_HALF_DECL(__generic)
+__CLC_VLOAD_HALF_DECL(__generic)
#endif
-#undef CLC_VLOAD_HALF_DECL
+#undef __CLC_VLOAD_HALF_DECL
#endif
#endif
-#undef CLC_VLOAD_NAME
-#undef CLC_VLOAD_HALF_NAME
-#undef CLC_VLOADA_HALF_NAME
+#undef __CLC_VLOAD_NAME
+#undef __CLC_VLOAD_HALF_NAME
+#undef __CLC_VLOADA_HALF_NAME
diff --git a/libclc/clc/include/clc/shared/clc_vstore.inc b/libclc/clc/include/clc/shared/clc_vstore.inc
index 38d54b2f1b67f..cd3377e077af6 100644
--- a/libclc/clc/include/clc/shared/clc_vstore.inc
+++ b/libclc/clc/include/clc/shared/clc_vstore.inc
@@ -6,28 +6,28 @@
//
//===----------------------------------------------------------------------===//
-#define CLC_VSTORE_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
-#define CLC_VSTORE_NAME __CLC_XCONCAT(__clc_vstore, __CLC_VECSIZE)
-#define CLC_VSTORE_HALF_NAME(x) \
+#define __CLC_VSTORE_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
+#define __CLC_VSTORE_NAME __CLC_XCONCAT(__clc_vstore, __CLC_VECSIZE)
+#define __CLC_VSTORE_HALF_NAME(x) \
__CLC_XCONCAT(__CLC_XCONCAT(__clc_vstore_half, __CLC_VECSIZE), x)
-#define CLC_VSTOREA_HALF_NAME(x) \
+#define __CLC_VSTOREA_HALF_NAME(x) \
__CLC_XCONCAT(__CLC_XCONCAT(__clc_vstorea_half, __CLC_VECSIZE), x)
#ifndef __CLC_SCALAR
-#define CLC_VSTORE_DECL(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL void CLC_VSTORE_NAME( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE __CLC_SCALAR_GENTYPE *p);
+#define __CLC_VSTORE_DECL(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DECL void __CLC_VSTORE_NAME( \
+ __CLC_VSTORE_TY data, size_t offset, ADDRSPACE __CLC_SCALAR_GENTYPE *p);
-CLC_VSTORE_DECL(__private)
-CLC_VSTORE_DECL(__local)
-CLC_VSTORE_DECL(__global)
+__CLC_VSTORE_DECL(__private)
+__CLC_VSTORE_DECL(__local)
+__CLC_VSTORE_DECL(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VSTORE_DECL(__generic)
+__CLC_VSTORE_DECL(__generic)
#endif
-#undef CLC_VSTORE_DECL
+#undef __CLC_VSTORE_DECL
#endif // __CLC_SCALAR
@@ -36,35 +36,35 @@ CLC_VSTORE_DECL(__generic)
#ifdef __CLC_FPSIZE
#if __CLC_FPSIZE == 32 || __CLC_FPSIZE == 64
-#define CLC_VSTORE_HALF_DECL(ADDRSPACE, SUFFIX) \
- _CLC_OVERLOAD _CLC_DECL void CLC_VSTORE_HALF_NAME(SUFFIX)( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p); \
+#define __CLC_VSTORE_HALF_DECL(ADDRSPACE, SUFFIX) \
+ _CLC_OVERLOAD _CLC_DECL void __CLC_VSTORE_HALF_NAME(SUFFIX)( \
+ __CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p); \
\
- _CLC_OVERLOAD _CLC_DECL void CLC_VSTOREA_HALF_NAME(SUFFIX)( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p);
+ _CLC_OVERLOAD _CLC_DECL void __CLC_VSTOREA_HALF_NAME(SUFFIX)( \
+ __CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p);
-#define CLC_VSTORE_HALF_DECL_ALL_MODES(ADDRSPACE) \
- CLC_VSTORE_HALF_DECL(ADDRSPACE, ) \
- CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtz) \
- CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtn) \
- CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtp) \
- CLC_VSTORE_HALF_DECL(ADDRSPACE, _rte)
+#define __CLC_VSTORE_HALF_DECL_ALL_MODES(ADDRSPACE) \
+ __CLC_VSTORE_HALF_DECL(ADDRSPACE, ) \
+ __CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtz) \
+ __CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtn) \
+ __CLC_VSTORE_HALF_DECL(ADDRSPACE, _rtp) \
+ __CLC_VSTORE_HALF_DECL(ADDRSPACE, _rte)
-CLC_VSTORE_HALF_DECL_ALL_MODES(__private)
-CLC_VSTORE_HALF_DECL_ALL_MODES(__local)
-CLC_VSTORE_HALF_DECL_ALL_MODES(__global)
+__CLC_VSTORE_HALF_DECL_ALL_MODES(__private)
+__CLC_VSTORE_HALF_DECL_ALL_MODES(__local)
+__CLC_VSTORE_HALF_DECL_ALL_MODES(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VSTORE_HALF_DECL_ALL_MODES(__generic)
+__CLC_VSTORE_HALF_DECL_ALL_MODES(__generic)
#endif
-#undef CLC_VSTORE_HALF_DECL
-#undef CLC_VSTORE_HALF_DECL_ALL_MODES
+#undef __CLC_VSTORE_HALF_DECL
+#undef __CLC_VSTORE_HALF_DECL_ALL_MODES
#endif
#endif
-#undef CLC_VSTORE_TY
-#undef CLC_VSTORE_NAME
-#undef CLC_VSTORE_HALF_NAME
-#undef CLC_VSTOREA_HALF_NAME
+#undef __CLC_VSTORE_TY
+#undef __CLC_VSTORE_NAME
+#undef __CLC_VSTORE_HALF_NAME
+#undef __CLC_VSTOREA_HALF_NAME
diff --git a/libclc/clc/include/clc/shared/ternary_decl.inc b/libclc/clc/include/clc/shared/ternary_decl.inc
index 1dc8672e3f42c..21acb0042518a 100644
--- a/libclc/clc/include/clc/shared/ternary_decl.inc
+++ b/libclc/clc/include/clc/shared/ternary_decl.inc
@@ -6,6 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
- __CLC_GENTYPE b,
- __CLC_GENTYPE c);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c);
diff --git a/libclc/clc/include/clc/shared/ternary_def.inc b/libclc/clc/include/clc/shared/ternary_def.inc
index 92134e8cb6f27..566cfb4ca58c9 100644
--- a/libclc/clc/include/clc/shared/ternary_def.inc
+++ b/libclc/clc/include/clc/shared/ternary_def.inc
@@ -8,11 +8,12 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b,
- __CLC_GENTYPE c) {
- return __IMPL_FUNCTION(FUNCTION)(a, b, c);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_GENTYPE b,
+ __CLC_GENTYPE c) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, b, c);
}
diff --git a/libclc/clc/include/clc/shared/ternary_def_scalarize.inc b/libclc/clc/include/clc/shared/ternary_def_scalarize.inc
index c216fa4db4cac..7bdaee85a612b 100644
--- a/libclc/clc/include/clc/shared/ternary_def_scalarize.inc
+++ b/libclc/clc/include/clc/shared/ternary_def_scalarize.inc
@@ -14,8 +14,8 @@
#define __CLC_MIN_VECSIZE 2
#endif
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION FUNCTION
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION __CLC_FUNCTION
#endif
#ifndef __CLC_DEF_SPEC
@@ -39,10 +39,10 @@
#endif
#if __CLC_MIN_VECSIZE == 1
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE FUNCTION(__CLC_ARG1_TYPE x,
- __CLC_ARG2_TYPE y,
- __CLC_ARG3_TYPE z) {
- return __IMPL_FUNCTION(x, y, z);
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE __CLC_FUNCTION(__CLC_ARG1_TYPE x,
+ __CLC_ARG2_TYPE y,
+ __CLC_ARG3_TYPE z) {
+ return __CLC_IMPL_FUNCTION(x, y, z);
}
#endif // __CLC_MIN_VECSIZE == 1
@@ -51,11 +51,10 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE FUNCTION(__CLC_ARG1_TYPE x,
#define __CLC_ARG1_TYPE2 __CLC_XCONCAT(__CLC_ARG1_TYPE, 2)
#define __CLC_ARG2_TYPE2 __CLC_XCONCAT(__CLC_ARG2_TYPE, 2)
#define __CLC_ARG3_TYPE2 __CLC_XCONCAT(__CLC_ARG3_TYPE, 2)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x,
- __CLC_ARG2_TYPE2 y,
- __CLC_ARG3_TYPE2 z) {
- return (__CLC_RET_TYPE2)(__IMPL_FUNCTION(x.s0, y.s0, z.s0),
- __IMPL_FUNCTION(x.s1, y.s1, z.s1));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2
+__CLC_FUNCTION(__CLC_ARG1_TYPE2 x, __CLC_ARG2_TYPE2 y, __CLC_ARG3_TYPE2 z) {
+ return (__CLC_RET_TYPE2)(__CLC_IMPL_FUNCTION(x.s0, y.s0, z.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1, z.s1));
}
#undef __CLC_RET_TYPE2
#undef __CLC_ARG1_TYPE2
@@ -71,12 +70,11 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x,
#define __CLC_ARG1_TYPE3 __CLC_XCONCAT(__CLC_ARG1_TYPE, 3)
#define __CLC_ARG2_TYPE3 __CLC_XCONCAT(__CLC_ARG2_TYPE, 3)
#define __CLC_ARG3_TYPE3 __CLC_XCONCAT(__CLC_ARG3_TYPE, 3)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3 FUNCTION(__CLC_ARG1_TYPE3 x,
- __CLC_ARG2_TYPE3 y,
- __CLC_ARG3_TYPE3 z) {
- return (__CLC_RET_TYPE3)(__IMPL_FUNCTION(x.s0, y.s0, z.s0),
- __IMPL_FUNCTION(x.s1, y.s1, z.s1),
- __IMPL_FUNCTION(x.s2, y.s2, z.s2));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3
+__CLC_FUNCTION(__CLC_ARG1_TYPE3 x, __CLC_ARG2_TYPE3 y, __CLC_ARG3_TYPE3 z) {
+ return (__CLC_RET_TYPE3)(__CLC_IMPL_FUNCTION(x.s0, y.s0, z.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1, z.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2, z.s2));
}
#undef __CLC_RET_TYPE3
#undef __CLC_ARG1_TYPE3
@@ -87,13 +85,12 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE3 FUNCTION(__CLC_ARG1_TYPE3 x,
#define __CLC_ARG1_TYPE4 __CLC_XCONCAT(__CLC_ARG1_TYPE, 4)
#define __CLC_ARG2_TYPE4 __CLC_XCONCAT(__CLC_ARG2_TYPE, 4)
#define __CLC_ARG3_TYPE4 __CLC_XCONCAT(__CLC_ARG3_TYPE, 4)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4 FUNCTION(__CLC_ARG1_TYPE4 x,
- __CLC_ARG2_TYPE4 y,
- __CLC_ARG3_TYPE4 z) {
- return (__CLC_RET_TYPE4)(__IMPL_FUNCTION(x.s0, y.s0, z.s0),
- __IMPL_FUNCTION(x.s1, y.s1, z.s1),
- __IMPL_FUNCTION(x.s2, y.s2, z.s2),
- __IMPL_FUNCTION(x.s3, y.s3, z.s3));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4
+__CLC_FUNCTION(__CLC_ARG1_TYPE4 x, __CLC_ARG2_TYPE4 y, __CLC_ARG3_TYPE4 z) {
+ return (__CLC_RET_TYPE4)(__CLC_IMPL_FUNCTION(x.s0, y.s0, z.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1, z.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2, z.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3, z.s3));
}
#undef __CLC_RET_TYPE4
#undef __CLC_ARG1_TYPE4
@@ -104,17 +101,16 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE4 FUNCTION(__CLC_ARG1_TYPE4 x,
#define __CLC_ARG1_TYPE8 __CLC_XCONCAT(__CLC_ARG1_TYPE, 8)
#define __CLC_ARG2_TYPE8 __CLC_XCONCAT(__CLC_ARG2_TYPE, 8)
#define __CLC_ARG3_TYPE8 __CLC_XCONCAT(__CLC_ARG3_TYPE, 8)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8 FUNCTION(__CLC_ARG1_TYPE8 x,
- __CLC_ARG2_TYPE8 y,
- __CLC_ARG3_TYPE8 z) {
- return (__CLC_RET_TYPE8)(__IMPL_FUNCTION(x.s0, y.s0, z.s0),
- __IMPL_FUNCTION(x.s1, y.s1, z.s1),
- __IMPL_FUNCTION(x.s2, y.s2, z.s2),
- __IMPL_FUNCTION(x.s3, y.s3, z.s3),
- __IMPL_FUNCTION(x.s4, y.s4, z.s4),
- __IMPL_FUNCTION(x.s5, y.s5, z.s5),
- __IMPL_FUNCTION(x.s6, y.s6, z.s6),
- __IMPL_FUNCTION(x.s7, y.s7, z.s7));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8
+__CLC_FUNCTION(__CLC_ARG1_TYPE8 x, __CLC_ARG2_TYPE8 y, __CLC_ARG3_TYPE8 z) {
+ return (__CLC_RET_TYPE8)(__CLC_IMPL_FUNCTION(x.s0, y.s0, z.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1, z.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2, z.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3, z.s3),
+ __CLC_IMPL_FUNCTION(x.s4, y.s4, z.s4),
+ __CLC_IMPL_FUNCTION(x.s5, y.s5, z.s5),
+ __CLC_IMPL_FUNCTION(x.s6, y.s6, z.s6),
+ __CLC_IMPL_FUNCTION(x.s7, y.s7, z.s7));
}
#undef __CLC_RET_TYPE8
#undef __CLC_ARG1_TYPE8
@@ -125,25 +121,24 @@ _CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE8 FUNCTION(__CLC_ARG1_TYPE8 x,
#define __CLC_ARG1_TYPE16 __CLC_XCONCAT(__CLC_ARG1_TYPE, 16)
#define __CLC_ARG2_TYPE16 __CLC_XCONCAT(__CLC_ARG2_TYPE, 16)
#define __CLC_ARG3_TYPE16 __CLC_XCONCAT(__CLC_ARG3_TYPE, 16)
-_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE16 FUNCTION(__CLC_ARG1_TYPE16 x,
- __CLC_ARG2_TYPE16 y,
- __CLC_ARG3_TYPE16 z) {
- return (__CLC_RET_TYPE16)(__IMPL_FUNCTION(x.s0, y.s0, z.s0),
- __IMPL_FUNCTION(x.s1, y.s1, z.s1),
- __IMPL_FUNCTION(x.s2, y.s2, z.s2),
- __IMPL_FUNCTION(x.s3, y.s3, z.s3),
- __IMPL_FUNCTION(x.s4, y.s4, z.s4),
- __IMPL_FUNCTION(x.s5, y.s5, z.s5),
- __IMPL_FUNCTION(x.s6, y.s6, z.s6),
- __IMPL_FUNCTION(x.s7, y.s7, z.s7),
- __IMPL_FUNCTION(x.s8, y.s8, z.s8),
- __IMPL_FUNCTION(x.s9, y.s9, z.s9),
- __IMPL_FUNCTION(x.sa, y.sa, z.sa),
- __IMPL_FUNCTION(x.sb, y.sb, z.sb),
- __IMPL_FUNCTION(x.sc, y.sc, z.sc),
- __IMPL_FUNCTION(x.sd, y.sd, z.sd),
- __IMPL_FUNCTION(x.se, y.se, z.se),
- __IMPL_FUNCTION(x.sf, y.sf, z.sf));
+_CLC_OVERLOAD __CLC_DEF_SPEC __CLC_RET_TYPE16
+__CLC_FUNCTION(__CLC_ARG1_TYPE16 x, __CLC_ARG2_TYPE16 y, __CLC_ARG3_TYPE16 z) {
+ return (__CLC_RET_TYPE16)(__CLC_IMPL_FUNCTION(x.s0, y.s0, z.s0),
+ __CLC_IMPL_FUNCTION(x.s1, y.s1, z.s1),
+ __CLC_IMPL_FUNCTION(x.s2, y.s2, z.s2),
+ __CLC_IMPL_FUNCTION(x.s3, y.s3, z.s3),
+ __CLC_IMPL_FUNCTION(x.s4, y.s4, z.s4),
+ __CLC_IMPL_FUNCTION(x.s5, y.s5, z.s5),
+ __CLC_IMPL_FUNCTION(x.s6, y.s6, z.s6),
+ __CLC_IMPL_FUNCTION(x.s7, y.s7, z.s7),
+ __CLC_IMPL_FUNCTION(x.s8, y.s8, z.s8),
+ __CLC_IMPL_FUNCTION(x.s9, y.s9, z.s9),
+ __CLC_IMPL_FUNCTION(x.sa, y.sa, z.sa),
+ __CLC_IMPL_FUNCTION(x.sb, y.sb, z.sb),
+ __CLC_IMPL_FUNCTION(x.sc, y.sc, z.sc),
+ __CLC_IMPL_FUNCTION(x.sd, y.sd, z.sd),
+ __CLC_IMPL_FUNCTION(x.se, y.se, z.se),
+ __CLC_IMPL_FUNCTION(x.sf, y.sf, z.sf));
}
#undef __CLC_RET_TYPE16
#undef __CLC_ARG1_TYPE16
diff --git a/libclc/clc/include/clc/shared/unary_decl.inc b/libclc/clc/include/clc/shared/unary_decl.inc
index 46108c5fac9e7..19f1c8a876e53 100644
--- a/libclc/clc/include/clc/shared/unary_decl.inc
+++ b/libclc/clc/include/clc/shared/unary_decl.inc
@@ -6,4 +6,5 @@
//
//===----------------------------------------------------------------------===//
-_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x);
+_CLC_OVERLOAD _CLC_CONST _CLC_DECL __CLC_GENTYPE
+__CLC_FUNCTION(__CLC_GENTYPE x);
diff --git a/libclc/clc/include/clc/shared/unary_def.inc b/libclc/clc/include/clc/shared/unary_def.inc
index e746a6bc89f32..b6826b023c70b 100644
--- a/libclc/clc/include/clc/shared/unary_def.inc
+++ b/libclc/clc/include/clc/shared/unary_def.inc
@@ -8,10 +8,10 @@
#include <clc/utils.h>
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a) {
- return __IMPL_FUNCTION(FUNCTION)(a);
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a);
}
diff --git a/libclc/clc/include/clc/shared/unary_def_scalarize.inc b/libclc/clc/include/clc/shared/unary_def_scalarize.inc
index 6c82babad2b52..e941918312da4 100644
--- a/libclc/clc/include/clc/shared/unary_def_scalarize.inc
+++ b/libclc/clc/include/clc/shared/unary_def_scalarize.inc
@@ -14,8 +14,8 @@
#define __CLC_MIN_VECSIZE 2
#endif
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION FUNCTION
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION __CLC_FUNCTION
#endif
#ifndef __CLC_RET_TYPE
@@ -31,16 +31,17 @@
#endif
#if __CLC_MIN_VECSIZE == 1
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE FUNCTION(__CLC_ARG1_TYPE x) {
- return __IMPL_FUNCTION(x);
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE __CLC_FUNCTION(__CLC_ARG1_TYPE x) {
+ return __CLC_IMPL_FUNCTION(x);
}
#endif // __CLC_MIN_VECSIZE == 1
#if __CLC_MIN_VECSIZE <= 2
#define __CLC_RET_TYPE2 __CLC_XCONCAT(__CLC_RET_TYPE, 2)
#define __CLC_ARG1_TYPE2 __CLC_XCONCAT(__CLC_ARG1_TYPE, 2)
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x) {
- return (__CLC_RET_TYPE2)(__IMPL_FUNCTION(x.s0), __IMPL_FUNCTION(x.s1));
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE2 __CLC_FUNCTION(__CLC_ARG1_TYPE2 x) {
+ return (__CLC_RET_TYPE2)(__CLC_IMPL_FUNCTION(x.s0),
+ __CLC_IMPL_FUNCTION(x.s1));
}
#undef __CLC_RET_TYPE2
#undef __CLC_ARG1_TYPE2
@@ -52,44 +53,47 @@ _CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE2 FUNCTION(__CLC_ARG1_TYPE2 x) {
#define __CLC_RET_TYPE3 __CLC_XCONCAT(__CLC_RET_TYPE, 3)
#define __CLC_ARG1_TYPE3 __CLC_XCONCAT(__CLC_ARG1_TYPE, 3)
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE3 FUNCTION(__CLC_ARG1_TYPE3 x) {
- return (__CLC_RET_TYPE3)(__IMPL_FUNCTION(x.s0), __IMPL_FUNCTION(x.s1),
- __IMPL_FUNCTION(x.s2));
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE3 __CLC_FUNCTION(__CLC_ARG1_TYPE3 x) {
+ return (__CLC_RET_TYPE3)(__CLC_IMPL_FUNCTION(x.s0), __CLC_IMPL_FUNCTION(x.s1),
+ __CLC_IMPL_FUNCTION(x.s2));
}
#undef __CLC_RET_TYPE3
#undef __CLC_ARG1_TYPE3
#define __CLC_RET_TYPE4 __CLC_XCONCAT(__CLC_RET_TYPE, 4)
#define __CLC_ARG1_TYPE4 __CLC_XCONCAT(__CLC_ARG1_TYPE, 4)
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE4 FUNCTION(__CLC_ARG1_TYPE4 x) {
- return (__CLC_RET_TYPE4)(__IMPL_FUNCTION(x.s0), __IMPL_FUNCTION(x.s1),
- __IMPL_FUNCTION(x.s2), __IMPL_FUNCTION(x.s3));
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE4 __CLC_FUNCTION(__CLC_ARG1_TYPE4 x) {
+ return (__CLC_RET_TYPE4)(__CLC_IMPL_FUNCTION(x.s0), __CLC_IMPL_FUNCTION(x.s1),
+ __CLC_IMPL_FUNCTION(x.s2),
+ __CLC_IMPL_FUNCTION(x.s3));
}
#undef __CLC_RET_TYPE4
#undef __CLC_ARG1_TYPE4
#define __CLC_RET_TYPE8 __CLC_XCONCAT(__CLC_RET_TYPE, 8)
#define __CLC_ARG1_TYPE8 __CLC_XCONCAT(__CLC_ARG1_TYPE, 8)
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE8 FUNCTION(__CLC_ARG1_TYPE8 x) {
- return (__CLC_RET_TYPE8)(__IMPL_FUNCTION(x.s0), __IMPL_FUNCTION(x.s1),
- __IMPL_FUNCTION(x.s2), __IMPL_FUNCTION(x.s3),
- __IMPL_FUNCTION(x.s4), __IMPL_FUNCTION(x.s5),
- __IMPL_FUNCTION(x.s6), __IMPL_FUNCTION(x.s7));
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE8 __CLC_FUNCTION(__CLC_ARG1_TYPE8 x) {
+ return (__CLC_RET_TYPE8)(__CLC_IMPL_FUNCTION(x.s0), __CLC_IMPL_FUNCTION(x.s1),
+ __CLC_IMPL_FUNCTION(x.s2), __CLC_IMPL_FUNCTION(x.s3),
+ __CLC_IMPL_FUNCTION(x.s4), __CLC_IMPL_FUNCTION(x.s5),
+ __CLC_IMPL_FUNCTION(x.s6),
+ __CLC_IMPL_FUNCTION(x.s7));
}
#undef __CLC_RET_TYPE8
#undef __CLC_ARG1_TYPE8
#define __CLC_RET_TYPE16 __CLC_XCONCAT(__CLC_RET_TYPE, 16)
#define __CLC_ARG1_TYPE16 __CLC_XCONCAT(__CLC_ARG1_TYPE, 16)
-_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE16 FUNCTION(__CLC_ARG1_TYPE16 x) {
- return (__CLC_RET_TYPE16)(__IMPL_FUNCTION(x.s0), __IMPL_FUNCTION(x.s1),
- __IMPL_FUNCTION(x.s2), __IMPL_FUNCTION(x.s3),
- __IMPL_FUNCTION(x.s4), __IMPL_FUNCTION(x.s5),
- __IMPL_FUNCTION(x.s6), __IMPL_FUNCTION(x.s7),
- __IMPL_FUNCTION(x.s8), __IMPL_FUNCTION(x.s9),
- __IMPL_FUNCTION(x.sa), __IMPL_FUNCTION(x.sb),
- __IMPL_FUNCTION(x.sc), __IMPL_FUNCTION(x.sd),
- __IMPL_FUNCTION(x.se), __IMPL_FUNCTION(x.sf));
+_CLC_OVERLOAD _CLC_DEF __CLC_RET_TYPE16 __CLC_FUNCTION(__CLC_ARG1_TYPE16 x) {
+ return (
+ __CLC_RET_TYPE16)(__CLC_IMPL_FUNCTION(x.s0), __CLC_IMPL_FUNCTION(x.s1),
+ __CLC_IMPL_FUNCTION(x.s2), __CLC_IMPL_FUNCTION(x.s3),
+ __CLC_IMPL_FUNCTION(x.s4), __CLC_IMPL_FUNCTION(x.s5),
+ __CLC_IMPL_FUNCTION(x.s6), __CLC_IMPL_FUNCTION(x.s7),
+ __CLC_IMPL_FUNCTION(x.s8), __CLC_IMPL_FUNCTION(x.s9),
+ __CLC_IMPL_FUNCTION(x.sa), __CLC_IMPL_FUNCTION(x.sb),
+ __CLC_IMPL_FUNCTION(x.sc), __CLC_IMPL_FUNCTION(x.sd),
+ __CLC_IMPL_FUNCTION(x.se), __CLC_IMPL_FUNCTION(x.sf));
}
#undef __CLC_RET_TYPE16
#undef __CLC_ARG1_TYPE16
diff --git a/libclc/clc/lib/amdgcn/math/clc_ldexp_override.cl b/libclc/clc/lib/amdgcn/math/clc_ldexp_override.cl
index b2990647a00a7..90bd50ac15512 100644
--- a/libclc/clc/lib/amdgcn/math/clc_ldexp_override.cl
+++ b/libclc/clc/lib/amdgcn/math/clc_ldexp_override.cl
@@ -10,25 +10,25 @@
#include <clc/internal/clc.h>
#include <clc/math/clc_ldexp.h>
-#define FUNCTION __clc_ldexp
+#define __CLC_FUNCTION __clc_ldexp
#define __CLC_ARG2_TYPE int
#define __CLC_MIN_VECSIZE 1
#ifdef __HAS_LDEXPF__
// This defines all the ldexp(floatN, intN) variants.
-#define __FLOAT_ONLY
-#define __IMPL_FUNCTION __builtin_amdgcn_ldexpf
+#define __CLC_FLOAT_ONLY
+#define __CLC_IMPL_FUNCTION __builtin_amdgcn_ldexpf
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef __IMPL_FUNCTION
+#undef __CLC_IMPL_FUNCTION
#endif
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// This defines all the ldexp(doubleN, intN) variants.
-#define __DOUBLE_ONLY
-#define __IMPL_FUNCTION __builtin_amdgcn_ldexp
+#define __CLC_DOUBLE_ONLY
+#define __CLC_IMPL_FUNCTION __builtin_amdgcn_ldexp
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef __IMPL_FUNCTION
+#undef __CLC_IMPL_FUNCTION
#endif
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_exp.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp.cl
index 5fa9d0b9a9dea..c332708615e19 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_exp.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_exp.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_exp.h>
#define __CLC_FUNC exp
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl
index 5c119eb5a535c..5560f7ac97965 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_exp10.h>
#define __CLC_FUNC exp10
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl
index 9750d5008986b..3e38cbee3285c 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl
@@ -10,6 +10,6 @@
#include <clc/math/clc_native_exp2.h>
#define __CLC_FUNC exp2
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_log.cl b/libclc/clc/lib/amdgpu/math/clc_half_log.cl
index ea19bd5a4c7a7..0b731c202e20b 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_log.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_log.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_log.h>
#define __CLC_FUNC log
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_log10.cl b/libclc/clc/lib/amdgpu/math/clc_half_log10.cl
index af3a2695396db..1fd8ba520411e 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_log10.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_log10.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_log10.h>
#define __CLC_FUNC log10
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_log2.cl b/libclc/clc/lib/amdgpu/math/clc_half_log2.cl
index 81795f012c77d..e4d27421f8fe0 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_log2.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_log2.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_log2.h>
#define __CLC_FUNC log2
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_recip.cl b/libclc/clc/lib/amdgpu/math/clc_half_recip.cl
index edbec07e44841..0a1c170375314 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_recip.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_recip.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_recip.h>
#define __CLC_FUNC recip
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl b/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl
index c0a5489ec8fc0..a17ac508b5ad3 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_rsqrt.h>
#define __CLC_FUNC rsqrt
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl b/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl
index 4dc6fa31f21a7..142a878818535 100644
--- a/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_native_sqrt.h>
#define __CLC_FUNC sqrt
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_native_unary.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_native_exp.cl b/libclc/clc/lib/amdgpu/math/clc_native_exp.cl
index 591ecb0ac00b5..946b9beed5be4 100644
--- a/libclc/clc/lib/amdgpu/math/clc_native_exp.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_native_exp.cl
@@ -11,5 +11,5 @@
#include <clc/math/clc_native_exp2.h>
#define __CLC_BODY <clc_native_exp.inc>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_native_exp2.cl b/libclc/clc/lib/amdgpu/math/clc_native_exp2.cl
index 63f28921dc177..5959ea2786a51 100644
--- a/libclc/clc/lib/amdgpu/math/clc_native_exp2.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_native_exp2.cl
@@ -9,9 +9,9 @@
#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_MIN_VECSIZE 1
-#define FUNCTION __clc_native_exp2
-#define __IMPL_FUNCTION __builtin_amdgcn_exp2f
+#define __CLC_FUNCTION __clc_native_exp2
+#define __CLC_IMPL_FUNCTION __builtin_amdgcn_exp2f
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_native_log10.cl b/libclc/clc/lib/amdgpu/math/clc_native_log10.cl
index 0668a635d24d7..c356b22b6b6e0 100644
--- a/libclc/clc/lib/amdgpu/math/clc_native_log10.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_native_log10.cl
@@ -11,5 +11,5 @@
#include <clc/math/clc_native_log2.h>
#define __CLC_BODY <clc_native_log10.inc>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_sqrt_fp64.cl b/libclc/clc/lib/amdgpu/math/clc_sqrt_fp64.cl
index b7cb635a2ae8e..d2790f3a82605 100644
--- a/libclc/clc/lib/amdgpu/math/clc_sqrt_fp64.cl
+++ b/libclc/clc/lib/amdgpu/math/clc_sqrt_fp64.cl
@@ -43,8 +43,8 @@ _CLC_OVERLOAD _CLC_DEF double __clc_sqrt(double x) {
return (x == __builtin_inf() || (x == 0.0)) ? v01 : v23;
}
-#define __DOUBLE_ONLY
-#define FUNCTION __clc_sqrt
+#define __CLC_DOUBLE_ONLY
+#define __CLC_FUNCTION __clc_sqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/clspv/math/clc_sw_fma.cl b/libclc/clc/lib/clspv/math/clc_sw_fma.cl
index 266269644721a..1dc9a0e6407ba 100644
--- a/libclc/clc/lib/clspv/math/clc_sw_fma.cl
+++ b/libclc/clc/lib/clspv/math/clc_sw_fma.cl
@@ -269,7 +269,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_sw_fma(float a, float b, float c) {
((uint)st_fma.mantissa.lo & 0x7fffff));
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_sw_fma
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_sw_fma
#define __CLC_BODY <clc/shared/ternary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_dec.cl b/libclc/clc/lib/generic/atomic/clc_atomic_dec.cl
index f35a9624fd013..7984dba5731ee 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_dec.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_dec.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_dec.h>
-#define FUNCTION __clc_atomic_dec
-#define __IMPL_FUNCTION __scoped_atomic_fetch_add
+#define __CLC_FUNCTION __clc_atomic_dec
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_add
#define __CLC_INC_DEC
#define __CLC_BODY <clc_atomic_def.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_def.inc b/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
index 2c45f49f60848..c1a0731eb8439 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
@@ -31,37 +31,37 @@
#ifdef __CLC_NO_VALUE_ARG
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, int MemoryOrder, \
int MemoryScope) { \
- return __CLC_AS_RETTYPE(__IMPL_FUNCTION( \
+ return __CLC_AS_RETTYPE(__CLC_IMPL_FUNCTION( \
(ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, MemoryOrder, MemoryScope)); \
}
#elif defined(__CLC_INC_DEC)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, int MemoryOrder, \
int MemoryScope) { \
return __CLC_AS_RETTYPE( \
- __IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, (__CLC_GENTYPE)1, \
- MemoryOrder, MemoryScope)); \
+ __CLC_IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, \
+ (__CLC_GENTYPE)1, MemoryOrder, MemoryScope)); \
}
#elif defined(__CLC_RETURN_VOID)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL void FUNCTION(volatile ADDRSPACE __CLC_GENTYPE *Ptr, \
- __CLC_GENTYPE Value, int MemoryOrder, \
- int MemoryScope) { \
- __IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, Value, MemoryOrder, \
- MemoryScope); \
+ _CLC_OVERLOAD _CLC_DECL void __CLC_FUNCTION( \
+ volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Value, \
+ int MemoryOrder, int MemoryScope) { \
+ __CLC_IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, Value, \
+ MemoryOrder, MemoryScope); \
}
#else
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr, __CLC_GENTYPE Value, \
int MemoryOrder, int MemoryScope) { \
return __CLC_AS_RETTYPE( \
- __IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, Value, \
- MemoryOrder, MemoryScope)); \
+ __CLC_IMPL_FUNCTION((ADDRSPACE __CLC_PTR_CASTTYPE *)Ptr, Value, \
+ MemoryOrder, MemoryScope)); \
}
#endif
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_exchange.cl b/libclc/clc/lib/generic/atomic/clc_atomic_exchange.cl
index 52fd11afed6a2..ee80256d3dbb6 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_exchange.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_exchange.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_exchange.h>
-#define FUNCTION __clc_atomic_exchange
-#define __IMPL_FUNCTION __scoped_atomic_exchange_n
+#define __CLC_FUNCTION __clc_atomic_exchange
+#define __CLC_IMPL_FUNCTION __scoped_atomic_exchange_n
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_add.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_add.cl
index 0dc44919627b3..06fa21344ec84 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_add.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_add.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_add.h>
-#define FUNCTION __clc_atomic_fetch_add
-#define __IMPL_FUNCTION __scoped_atomic_fetch_add
+#define __CLC_FUNCTION __clc_atomic_fetch_add
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_add
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_and.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_and.cl
index ec89738bc0f62..7b9750d8d4db7 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_and.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_and.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_and.h>
-#define FUNCTION __clc_atomic_fetch_and
-#define __IMPL_FUNCTION __scoped_atomic_fetch_and
+#define __CLC_FUNCTION __clc_atomic_fetch_and
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_and
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_max.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_max.cl
index 0acac711aa96d..6401d3e9439f0 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_max.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_max.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_max.h>
-#define FUNCTION __clc_atomic_fetch_max
-#define __IMPL_FUNCTION __scoped_atomic_fetch_max
+#define __CLC_FUNCTION __clc_atomic_fetch_max
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_max
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_min.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_min.cl
index 7a098588ec005..51e3904a5c6e3 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_min.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_min.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_min.h>
-#define FUNCTION __clc_atomic_fetch_min
-#define __IMPL_FUNCTION __scoped_atomic_fetch_min
+#define __CLC_FUNCTION __clc_atomic_fetch_min
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_min
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_or.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_or.cl
index e0f48fa408350..e92e351db3f42 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_or.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_or.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_or.h>
-#define FUNCTION __clc_atomic_fetch_or
-#define __IMPL_FUNCTION __scoped_atomic_fetch_or
+#define __CLC_FUNCTION __clc_atomic_fetch_or
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_or
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_sub.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_sub.cl
index a4c2c1da1555c..fbbf7a4def566 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_sub.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_sub.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_sub.h>
-#define FUNCTION __clc_atomic_fetch_sub
-#define __IMPL_FUNCTION __scoped_atomic_fetch_sub
+#define __CLC_FUNCTION __clc_atomic_fetch_sub
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_sub
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_xor.cl b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_xor.cl
index 4424a298178fd..d041fd164d386 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_fetch_xor.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_fetch_xor.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_fetch_xor.h>
-#define FUNCTION __clc_atomic_fetch_xor
-#define __IMPL_FUNCTION __scoped_atomic_fetch_xor
+#define __CLC_FUNCTION __clc_atomic_fetch_xor
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_xor
#define __CLC_BODY <clc_atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_inc.cl b/libclc/clc/lib/generic/atomic/clc_atomic_inc.cl
index 019aa8d9d6dd8..7171f84c30ce0 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_inc.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_inc.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_inc.h>
-#define FUNCTION __clc_atomic_inc
-#define __IMPL_FUNCTION __scoped_atomic_fetch_sub
+#define __CLC_FUNCTION __clc_atomic_inc
+#define __CLC_IMPL_FUNCTION __scoped_atomic_fetch_sub
#define __CLC_INC_DEC
#define __CLC_BODY <clc_atomic_def.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_load.cl b/libclc/clc/lib/generic/atomic/clc_atomic_load.cl
index 1f083073e43ff..f7fe2510569e4 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_load.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_load.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_load.h>
-#define FUNCTION __clc_atomic_load
-#define __IMPL_FUNCTION __scoped_atomic_load_n
+#define __CLC_FUNCTION __clc_atomic_load
+#define __CLC_IMPL_FUNCTION __scoped_atomic_load_n
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <clc_atomic_def.inc>
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_store.cl b/libclc/clc/lib/generic/atomic/clc_atomic_store.cl
index 8fd165b9a83b8..a93d21e8430ce 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_store.cl
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_store.cl
@@ -8,8 +8,8 @@
#include <clc/atomic/clc_atomic_store.h>
-#define FUNCTION __clc_atomic_store
-#define __IMPL_FUNCTION __scoped_atomic_store_n
+#define __CLC_FUNCTION __clc_atomic_store
+#define __CLC_IMPL_FUNCTION __scoped_atomic_store_n
#define __CLC_RETURN_VOID
#define __CLC_BODY <clc_atomic_def.inc>
diff --git a/libclc/clc/lib/generic/common/clc_radians.cl b/libclc/clc/lib/generic/common/clc_radians.cl
index f8a1635ecb5cf..497263a15f516 100644
--- a/libclc/clc/lib/generic/common/clc_radians.cl
+++ b/libclc/clc/lib/generic/common/clc_radians.cl
@@ -9,27 +9,27 @@
#include <clc/clcmacro.h>
#include <clc/internal/clc.h>
-#define RADIANS_SINGLE_DEF(TYPE, LITERAL) \
+#define __CLC_RADIANS_SINGLE_DEF(TYPE, LITERAL) \
_CLC_OVERLOAD _CLC_DEF TYPE __clc_radians(TYPE radians) { \
return (TYPE)LITERAL * radians; \
}
-#define RADIANS_DEF(TYPE, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE##2, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE##3, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE##4, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE##8, LITERAL) \
- RADIANS_SINGLE_DEF(TYPE##16, LITERAL)
+#define __CLC_RADIANS_DEF(TYPE, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE##2, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE##3, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE##4, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE##8, LITERAL) \
+ __CLC_RADIANS_SINGLE_DEF(TYPE##16, LITERAL)
// pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F
-RADIANS_DEF(float, 0x1.1df46ap-6F)
+__CLC_RADIANS_DEF(float, 0x1.1df46ap-6F)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F
-RADIANS_DEF(double, 0x1.1df46a2529d39p-6)
+__CLC_RADIANS_DEF(double, 0x1.1df46a2529d39p-6)
#endif
@@ -37,6 +37,6 @@ RADIANS_DEF(double, 0x1.1df46a2529d39p-6)
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
// pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F
-RADIANS_DEF(half, (half)0x1.1df46a2529d39p-6)
+__CLC_RADIANS_DEF(half, (half)0x1.1df46a2529d39p-6)
#endif
diff --git a/libclc/clc/lib/generic/geometric/clc_fast_distance.cl b/libclc/clc/lib/generic/geometric/clc_fast_distance.cl
index 996039898480c..6b645df0b3ddb 100644
--- a/libclc/clc/lib/generic/geometric/clc_fast_distance.cl
+++ b/libclc/clc/lib/generic/geometric/clc_fast_distance.cl
@@ -9,6 +9,6 @@
#include <clc/geometric/clc_fast_length.h>
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_fast_distance.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/geometric/clc_fast_normalize.cl b/libclc/clc/lib/generic/geometric/clc_fast_normalize.cl
index 85684d0f49bc1..a5883efe7bd90 100644
--- a/libclc/clc/lib/generic/geometric/clc_fast_normalize.cl
+++ b/libclc/clc/lib/generic/geometric/clc_fast_normalize.cl
@@ -10,6 +10,6 @@
#include <clc/geometric/clc_normalize.h>
#include <clc/math/clc_half_rsqrt.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_fast_normalize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_add_sat.cl b/libclc/clc/lib/generic/integer/clc_add_sat.cl
index 8241ee5d547ac..08337bf533fc0 100644
--- a/libclc/clc/lib/generic/integer/clc_add_sat.cl
+++ b/libclc/clc/lib/generic/integer/clc_add_sat.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_add_sat
-#define __IMPL_FUNCTION(x) __builtin_elementwise_add_sat
+#define __CLC_FUNCTION __clc_add_sat
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_add_sat
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_bit_reverse.cl b/libclc/clc/lib/generic/integer/clc_bit_reverse.cl
index 439957383f583..9bf57e2c7d83f 100644
--- a/libclc/clc/lib/generic/integer/clc_bit_reverse.cl
+++ b/libclc/clc/lib/generic/integer/clc_bit_reverse.cl
@@ -8,8 +8,8 @@
#include <clc/integer/clc_bit_reverse.h>
-#define FUNCTION __clc_bit_reverse
-#define __IMPL_FUNCTION(x) __builtin_elementwise_bitreverse
+#define __CLC_FUNCTION __clc_bit_reverse
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_bitreverse
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_clz.cl b/libclc/clc/lib/generic/integer/clc_clz.cl
index c6e1da680b7bd..0d0c80b7cd1ff 100644
--- a/libclc/clc/lib/generic/integer/clc_clz.cl
+++ b/libclc/clc/lib/generic/integer/clc_clz.cl
@@ -42,6 +42,6 @@ _CLC_OVERLOAD _CLC_DEF ulong __clc_clz(ulong x) {
return x ? __builtin_clzl(x) : 64;
}
-#define FUNCTION __clc_clz
+#define __CLC_FUNCTION __clc_clz
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_ctz.cl b/libclc/clc/lib/generic/integer/clc_ctz.cl
index d82d99d539df8..8dbebb3f345a5 100644
--- a/libclc/clc/lib/generic/integer/clc_ctz.cl
+++ b/libclc/clc/lib/generic/integer/clc_ctz.cl
@@ -38,6 +38,6 @@ _CLC_OVERLOAD _CLC_DEF ulong __clc_ctz(ulong x) {
return __builtin_ctzg(x, 64);
}
-#define FUNCTION __clc_ctz
+#define __CLC_FUNCTION __clc_ctz
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_popcount.cl b/libclc/clc/lib/generic/integer/clc_popcount.cl
index 078ceecc97691..2781ead638c97 100644
--- a/libclc/clc/lib/generic/integer/clc_popcount.cl
+++ b/libclc/clc/lib/generic/integer/clc_popcount.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_popcount
-#define __IMPL_FUNCTION(x) __builtin_elementwise_popcount
+#define __CLC_FUNCTION __clc_popcount
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_popcount
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_sub_sat.cl b/libclc/clc/lib/generic/integer/clc_sub_sat.cl
index e664f04b17481..8a7ffd06f8b0b 100644
--- a/libclc/clc/lib/generic/integer/clc_sub_sat.cl
+++ b/libclc/clc/lib/generic/integer/clc_sub_sat.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_sub_sat
-#define __IMPL_FUNCTION(x) __builtin_elementwise_sub_sat
+#define __CLC_FUNCTION __clc_sub_sat
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_sub_sat
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_atan2.inc b/libclc/clc/lib/generic/math/clc_atan2.inc
index 61ffeebbc5d11..19eaaeee0092d 100644
--- a/libclc/clc/lib/generic/math/clc_atan2.inc
+++ b/libclc/clc/lib/generic/math/clc_atan2.inc
@@ -131,8 +131,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_atan2(__CLC_GENTYPE y,
{
__CLC_GENTYPE val = vbyu > 0.0625 ? vbyu : 0.063;
__CLC_INTN index = __CLC_CONVERT_INTN(__clc_fma(256.0, val, 0.5));
- q1 = USE_TABLE(atan_jby256_tbl_head, index - 16);
- q2 = USE_TABLE(atan_jby256_tbl_tail, index - 16);
+ q1 = __CLC_USE_TABLE(atan_jby256_tbl_head, index - 16);
+ q2 = __CLC_USE_TABLE(atan_jby256_tbl_tail, index - 16);
__CLC_GENTYPE c = __CLC_CONVERT_GENTYPE(index) * 0x1.0p-8;
// We're going to scale u and v by 2^(-u_exponent) to bring them close to 1
diff --git a/libclc/clc/lib/generic/math/clc_atan2pi.inc b/libclc/clc/lib/generic/math/clc_atan2pi.inc
index 79b2551e077cc..9f901947887d8 100644
--- a/libclc/clc/lib/generic/math/clc_atan2pi.inc
+++ b/libclc/clc/lib/generic/math/clc_atan2pi.inc
@@ -110,8 +110,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_atan2pi(__CLC_GENTYPE y,
{
__CLC_GENTYPE val = vbyu > 0.0625 ? vbyu : 0.063;
__CLC_INTN index = __CLC_CONVERT_INTN(__clc_fma(256.0, val, 0.5));
- q1 = USE_TABLE(atan_jby256_tbl_head, (index - 16));
- q2 = USE_TABLE(atan_jby256_tbl_tail, (index - 16));
+ q1 = __CLC_USE_TABLE(atan_jby256_tbl_head, (index - 16));
+ q2 = __CLC_USE_TABLE(atan_jby256_tbl_tail, (index - 16));
__CLC_GENTYPE c = __CLC_CONVERT_GENTYPE(index) * 0x1.0p-8;
// We're going to scale u and v by 2^(-u_exponent) to bring them close to 1
diff --git a/libclc/clc/lib/generic/math/clc_cbrt.inc b/libclc/clc/lib/generic/math/clc_cbrt.inc
index 2aba2484e33fc..ce0e0fe453169 100644
--- a/libclc/clc/lib/generic/math/clc_cbrt.inc
+++ b/libclc/clc/lib/generic/math/clc_cbrt.inc
@@ -32,7 +32,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cbrt(__CLC_GENTYPE x) {
__CLC_AS_GENTYPE(indx | 0x3f000000);
indx >>= 16;
- __CLC_GENTYPE r = f * USE_TABLE(log_inv_tbl, __CLC_AS_INTN(indx));
+ __CLC_GENTYPE r = f * __CLC_USE_TABLE(log_inv_tbl, __CLC_AS_INTN(indx));
__CLC_GENTYPE poly = __clc_mad(__clc_mad(r, 0x1.f9add4p-5f, -0x1.c71c72p-4f),
r * r, r * 0x1.555556p-2f);
@@ -52,8 +52,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cbrt(__CLC_GENTYPE x) {
remH = rem == 2 ? 0x1.964000p+0f : remH;
remT = rem == 2 ? 0x1.fea53ep-12f : remT;
- __CLC_GENTYPE cbrtH = USE_TABLE(cbrt_tbl_head, __CLC_AS_INTN(indx));
- __CLC_GENTYPE cbrtT = USE_TABLE(cbrt_tbl_tail, __CLC_AS_INTN(indx));
+ __CLC_GENTYPE cbrtH = __CLC_USE_TABLE(cbrt_tbl_head, __CLC_AS_INTN(indx));
+ __CLC_GENTYPE cbrtT = __CLC_USE_TABLE(cbrt_tbl_tail, __CLC_AS_INTN(indx));
__CLC_GENTYPE bH = cbrtH * remH;
__CLC_GENTYPE bT =
@@ -97,7 +97,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cbrt(__CLC_GENTYPE x) {
__CLC_GENTYPE F = __CLC_CONVERT_GENTYPE(index) * 0x1.0p-9;
__CLC_GENTYPE f = Y - F;
- __CLC_GENTYPE r = f * USE_TABLE(cbrt_inv_tbl, index - 256);
+ __CLC_GENTYPE r = f * __CLC_USE_TABLE(cbrt_inv_tbl, index - 256);
__CLC_GENTYPE z =
r * __clc_fma(
@@ -112,11 +112,11 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cbrt(__CLC_GENTYPE x) {
-0x1.c71c71c71c71cp-4),
0x1.5555555555555p-2);
- __CLC_GENTYPE Rem_h = USE_TABLE(cbrt_rem_tbl_head, rem + 2);
- __CLC_GENTYPE Rem_t = USE_TABLE(cbrt_rem_tbl_tail, rem + 2);
+ __CLC_GENTYPE Rem_h = __CLC_USE_TABLE(cbrt_rem_tbl_head, rem + 2);
+ __CLC_GENTYPE Rem_t = __CLC_USE_TABLE(cbrt_rem_tbl_tail, rem + 2);
- __CLC_GENTYPE F_h = USE_TABLE(cbrt_dbl_tbl_head, index - 256);
- __CLC_GENTYPE F_t = USE_TABLE(cbrt_dbl_tbl_tail, index - 256);
+ __CLC_GENTYPE F_h = __CLC_USE_TABLE(cbrt_dbl_tbl_head, index - 256);
+ __CLC_GENTYPE F_t = __CLC_USE_TABLE(cbrt_dbl_tbl_tail, index - 256);
__CLC_GENTYPE b_h = F_h * Rem_h;
__CLC_GENTYPE b_t = __clc_fma(Rem_t, F_h, __clc_fma(F_t, Rem_h, F_t * Rem_t));
diff --git a/libclc/clc/lib/generic/math/clc_ceil.cl b/libclc/clc/lib/generic/math/clc_ceil.cl
index b06cb364b58d9..e48ad1a482ef7 100644
--- a/libclc/clc/lib/generic/math/clc_ceil.cl
+++ b/libclc/clc/lib/generic/math/clc_ceil.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_ceil
-#define __IMPL_FUNCTION(x) __builtin_elementwise_ceil
+#define __CLC_FUNCTION __clc_ceil
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_ceil
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_copysign.cl b/libclc/clc/lib/generic/math/clc_copysign.cl
index 06f126b16dfde..89829e2375ea3 100644
--- a/libclc/clc/lib/generic/math/clc_copysign.cl
+++ b/libclc/clc/lib/generic/math/clc_copysign.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_copysign
-#define __IMPL_FUNCTION(x) __builtin_elementwise_copysign
+#define __CLC_FUNCTION __clc_copysign
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_copysign
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_cosh.inc b/libclc/clc/lib/generic/math/clc_cosh.inc
index a9fa1bb14140c..c80b1a38c7768 100644
--- a/libclc/clc/lib/generic/math/clc_cosh.inc
+++ b/libclc/clc/lib/generic/math/clc_cosh.inc
@@ -71,8 +71,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cosh(__CLC_GENTYPE x) {
0.500000000000000005911074e0f);
cdy = __clc_mad(cdy, dy2, 1.0f);
- __CLC_GENTYPE sinhcoshh = USE_TABLE(sinhcosh_tbl_head, ind);
- __CLC_GENTYPE sinhcosht = USE_TABLE(sinhcosh_tbl_tail, ind);
+ __CLC_GENTYPE sinhcoshh = __CLC_USE_TABLE(sinhcosh_tbl_head, ind);
+ __CLC_GENTYPE sinhcosht = __CLC_USE_TABLE(sinhcosh_tbl_tail, ind);
__CLC_GENTYPE z = __clc_mad(sinhcoshh, sdy, sinhcosht * cdy);
// When exp(-x) is insignificant compared to exp(x), return exp(x)/2
@@ -162,10 +162,10 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cosh(__CLC_GENTYPE x) {
// At this point sinh(dy) is approximated by dy + sdy,
// and cosh(dy) is approximated by 1 + cdy.
- __CLC_GENTYPE cl = USE_TABLE(cosh_tbl_head, ind);
- __CLC_GENTYPE ct = USE_TABLE(cosh_tbl_tail, ind);
- __CLC_GENTYPE sl = USE_TABLE(sinh_tbl_head, ind);
- __CLC_GENTYPE st = USE_TABLE(sinh_tbl_tail, ind);
+ __CLC_GENTYPE cl = __CLC_USE_TABLE(cosh_tbl_head, ind);
+ __CLC_GENTYPE ct = __CLC_USE_TABLE(cosh_tbl_tail, ind);
+ __CLC_GENTYPE sl = __CLC_USE_TABLE(sinh_tbl_head, ind);
+ __CLC_GENTYPE st = __CLC_USE_TABLE(sinh_tbl_tail, ind);
__CLC_GENTYPE z =
__clc_fma(
diff --git a/libclc/clc/lib/generic/math/clc_ep_log.inc b/libclc/clc/lib/generic/math/clc_ep_log.inc
index f51e487bedcaa..d8cc886ffc745 100644
--- a/libclc/clc/lib/generic/math/clc_ep_log.inc
+++ b/libclc/clc/lib/generic/math/clc_ep_log.inc
@@ -58,8 +58,8 @@ _CLC_DEF _CLC_OVERLOAD void __clc_ep_log(__CLC_GENTYPE x,
__CLC_GENTYPE f2 = f - f1;
__CLC_GENTYPE u2 = MATH_DIVIDE(f2, __clc_fma(0.5, f2, f1));
- __CLC_GENTYPE z1 = USE_TABLE(ln_tbl_lo, (index - 64));
- __CLC_GENTYPE q = USE_TABLE(ln_tbl_hi, (index - 64));
+ __CLC_GENTYPE z1 = __CLC_USE_TABLE(ln_tbl_lo, (index - 64));
+ __CLC_GENTYPE q = __CLC_USE_TABLE(ln_tbl_hi, (index - 64));
z1 = near_one ? r : z1;
q = near_one ? 0.0 : q;
diff --git a/libclc/clc/lib/generic/math/clc_erf.cl b/libclc/clc/lib/generic/math/clc_erf.cl
index bea392445c93c..34c7d586131e2 100644
--- a/libclc/clc/lib/generic/math/clc_erf.cl
+++ b/libclc/clc/lib/generic/math/clc_erf.cl
@@ -506,6 +506,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_erf(half x) {
#endif
-#define FUNCTION __clc_erf
+#define __CLC_FUNCTION __clc_erf
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_erfc.cl b/libclc/clc/lib/generic/math/clc_erfc.cl
index fab6960046028..7922807818ea2 100644
--- a/libclc/clc/lib/generic/math/clc_erfc.cl
+++ b/libclc/clc/lib/generic/math/clc_erfc.cl
@@ -517,6 +517,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_erfc(half x) {
#endif
-#define FUNCTION __clc_erfc
+#define __CLC_FUNCTION __clc_erfc
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_exp10.inc b/libclc/clc/lib/generic/math/clc_exp10.inc
index 96bc5331fef17..8bf4ec4c0b37d 100644
--- a/libclc/clc/lib/generic/math/clc_exp10.inc
+++ b/libclc/clc/lib/generic/math/clc_exp10.inc
@@ -69,7 +69,7 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_exp10(__CLC_GENTYPE x) {
0x1.000000p-1f),
r * r, r);
- __CLC_GENTYPE two_to_jby64 = USE_TABLE(exp_tbl, j);
+ __CLC_GENTYPE two_to_jby64 = __CLC_USE_TABLE(exp_tbl, j);
z2 = __clc_mad(two_to_jby64, z2, two_to_jby64);
__CLC_GENTYPE z2s = z2 * __CLC_AS_GENTYPE((__CLC_UINTN)0x1 << (m + 149));
@@ -122,8 +122,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_exp10(__CLC_GENTYPE x) {
0x1.0000000000000p-1),
1.0);
- __CLC_GENTYPE tv0 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE tv1 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE tv0 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE tv1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
z2 = __clc_fma(tv0 + tv1, z2, tv1) + tv0;
__CLC_INTN small_value =
diff --git a/libclc/clc/lib/generic/math/clc_exp_helper.cl b/libclc/clc/lib/generic/math/clc_exp_helper.cl
index 92ff8f7fe4e6f..1670b73b6c980 100644
--- a/libclc/clc/lib/generic/math/clc_exp_helper.cl
+++ b/libclc/clc/lib/generic/math/clc_exp_helper.cl
@@ -14,7 +14,7 @@
#include <clc/math/tables.h>
#include <clc/relational/clc_isnan.h>
-#define __DOUBLE_ONLY
+#define __CLC_DOUBLE_ONLY
#define __CLC_BODY <clc_exp_helper.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_exp_helper.inc b/libclc/clc/lib/generic/math/clc_exp_helper.inc
index 70ced7e9ea485..4ccf2d12b8cf5 100644
--- a/libclc/clc/lib/generic/math/clc_exp_helper.inc
+++ b/libclc/clc/lib/generic/math/clc_exp_helper.inc
@@ -29,8 +29,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_exp_helper(__CLC_GENTYPE x,
0x1.0000000000000p-1),
1.0);
- __CLC_GENTYPE tv0 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE tv1 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE tv0 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE tv1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
z2 = __clc_fma(tv0 + tv1, z2, tv1) + tv0;
__CLC_INTN small_value =
diff --git a/libclc/clc/lib/generic/math/clc_expm1.inc b/libclc/clc/lib/generic/math/clc_expm1.inc
index 6abee9b3f0cc9..a7ff90ea86ca0 100644
--- a/libclc/clc/lib/generic/math/clc_expm1.inc
+++ b/libclc/clc/lib/generic/math/clc_expm1.inc
@@ -37,8 +37,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_expm1(__CLC_GENTYPE x) {
r);
__CLC_GENTYPE m2 = __CLC_AS_GENTYPE((m + EXPBIAS_SP32) << EXPSHIFTBITS_SP32);
- __CLC_GENTYPE exp_head = USE_TABLE(exp_tbl_ep_head, j);
- __CLC_GENTYPE exp_tail = USE_TABLE(exp_tbl_ep_tail, j);
+ __CLC_GENTYPE exp_head = __CLC_USE_TABLE(exp_tbl_ep_head, j);
+ __CLC_GENTYPE exp_tail = __CLC_USE_TABLE(exp_tbl_ep_tail, j);
__CLC_GENTYPE two_to_jby64_h = exp_head * m2;
__CLC_GENTYPE two_to_jby64_t = exp_tail * m2;
@@ -108,8 +108,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_expm1(__CLC_GENTYPE x) {
__CLC_INTN j = n & 0x3f;
__CLC_INTN m = n >> 6;
- __CLC_GENTYPE f1 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE f2 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE f1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE f2 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
__CLC_GENTYPE f = f1 + f2;
__CLC_GENTYPE dn = __CLC_CONVERT_GENTYPE(-n);
diff --git a/libclc/clc/lib/generic/math/clc_fabs.cl b/libclc/clc/lib/generic/math/clc_fabs.cl
index a0f0f3af07e25..e0c7685bfdb64 100644
--- a/libclc/clc/lib/generic/math/clc_fabs.cl
+++ b/libclc/clc/lib/generic/math/clc_fabs.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_fabs
-#define __IMPL_FUNCTION(x) __builtin_elementwise_abs
+#define __CLC_FUNCTION __clc_fabs
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_abs
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_floor.cl b/libclc/clc/lib/generic/math/clc_floor.cl
index a14adb98297e7..f31bed2e9ee64 100644
--- a/libclc/clc/lib/generic/math/clc_floor.cl
+++ b/libclc/clc/lib/generic/math/clc_floor.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_floor
-#define __IMPL_FUNCTION(x) __builtin_elementwise_floor
+#define __CLC_FUNCTION __clc_floor
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_floor
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_fmax.cl b/libclc/clc/lib/generic/math/clc_fmax.cl
index b334207365b98..0fdbaa5eef5f6 100644
--- a/libclc/clc/lib/generic/math/clc_fmax.cl
+++ b/libclc/clc/lib/generic/math/clc_fmax.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_fmax
-#define __IMPL_FUNCTION(x) __builtin_elementwise_maximumnum
+#define __CLC_FUNCTION __clc_fmax
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_maximumnum
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_fmin.cl b/libclc/clc/lib/generic/math/clc_fmin.cl
index d21bb8d076790..572d54b128a6f 100644
--- a/libclc/clc/lib/generic/math/clc_fmin.cl
+++ b/libclc/clc/lib/generic/math/clc_fmin.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_fmin
-#define __IMPL_FUNCTION(x) __builtin_elementwise_minimumnum
+#define __CLC_FUNCTION __clc_fmin
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_minimumnum
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_fmod.cl b/libclc/clc/lib/generic/math/clc_fmod.cl
index 3162ef60d46ef..3cb01e67292ed 100644
--- a/libclc/clc/lib/generic/math/clc_fmod.cl
+++ b/libclc/clc/lib/generic/math/clc_fmod.cl
@@ -64,11 +64,11 @@ _CLC_DEF _CLC_OVERLOAD float __clc_fmod(float x, float y) {
return xr;
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_fmod
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_fmod
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#ifdef cl_khr_fp64
@@ -176,11 +176,11 @@ _CLC_DEF _CLC_OVERLOAD double __clc_fmod(double x, double y) {
return ret;
}
-#define __DOUBLE_ONLY
-#define FUNCTION __clc_fmod
+#define __CLC_DOUBLE_ONLY
+#define __CLC_FUNCTION __clc_fmod
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif
@@ -189,8 +189,8 @@ _CLC_DEF _CLC_OVERLOAD double __clc_fmod(double x, double y) {
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
// Forward the half version of this builtin onto the float one
-#define __HALF_ONLY
-#define FUNCTION __clc_fmod
+#define __CLC_HALF_ONLY
+#define __CLC_FUNCTION __clc_fmod
#define __CLC_BODY <clc/math/binary_def_via_fp32.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_fract.inc b/libclc/clc/lib/generic/math/clc_fract.inc
index f0466e339b341..5b12c74f293f2 100644
--- a/libclc/clc/lib/generic/math/clc_fract.inc
+++ b/libclc/clc/lib/generic/math/clc_fract.inc
@@ -23,7 +23,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract(__CLC_GENTYPE x,
return r;
}
-#define FRACT_DEF(addrspace) \
+#define __CLC_FRACT_DEF(addrspace) \
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract( \
__CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) { \
__CLC_GENTYPE private_iptr; \
@@ -32,10 +32,10 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_fract(__CLC_GENTYPE x,
return ret; \
}
-FRACT_DEF(local);
-FRACT_DEF(global);
+__CLC_FRACT_DEF(local);
+__CLC_FRACT_DEF(global);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FRACT_DEF(generic);
+__CLC_FRACT_DEF(generic);
#endif
#undef MIN_CONSTANT
diff --git a/libclc/clc/lib/generic/math/clc_half_cos.cl b/libclc/clc/lib/generic/math/clc_half_cos.cl
index 79a7ee7b483f4..4420ad31afae5 100644
--- a/libclc/clc/lib/generic/math/clc_half_cos.cl
+++ b/libclc/clc/lib/generic/math/clc_half_cos.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_cos.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_cos
-#define __IMPL_FUNCTION(x) __clc_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_cos
+#define __CLC_IMPL_FUNCTION(x) __clc_cos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_divide.cl b/libclc/clc/lib/generic/math/clc_half_divide.cl
index 88676a4ac7856..16af197d29a75 100644
--- a/libclc/clc/lib/generic/math/clc_half_divide.cl
+++ b/libclc/clc/lib/generic/math/clc_half_divide.cl
@@ -8,7 +8,7 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_divide.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_exp.cl b/libclc/clc/lib/generic/math/clc_half_exp.cl
index b53454580e3ce..4b4717672d368 100644
--- a/libclc/clc/lib/generic/math/clc_half_exp.cl
+++ b/libclc/clc/lib/generic/math/clc_half_exp.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_exp.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp
-#define __IMPL_FUNCTION(x) __clc_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp
+#define __CLC_IMPL_FUNCTION(x) __clc_exp
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_exp10.cl b/libclc/clc/lib/generic/math/clc_half_exp10.cl
index 7bd107bf59e85..5bacca1ee0b7d 100644
--- a/libclc/clc/lib/generic/math/clc_half_exp10.cl
+++ b/libclc/clc/lib/generic/math/clc_half_exp10.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_exp10.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp10
-#define __IMPL_FUNCTION(x) __clc_exp10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp10
+#define __CLC_IMPL_FUNCTION(x) __clc_exp10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_exp2.cl b/libclc/clc/lib/generic/math/clc_half_exp2.cl
index a20d79bfff6e3..9a8f2f980c5a7 100644
--- a/libclc/clc/lib/generic/math/clc_half_exp2.cl
+++ b/libclc/clc/lib/generic/math/clc_half_exp2.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_exp2.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_exp2
-#define __IMPL_FUNCTION(x) __clc_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_exp2
+#define __CLC_IMPL_FUNCTION(x) __clc_exp2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_log.cl b/libclc/clc/lib/generic/math/clc_half_log.cl
index 26b2c756c9889..160b193e8040c 100644
--- a/libclc/clc/lib/generic/math/clc_half_log.cl
+++ b/libclc/clc/lib/generic/math/clc_half_log.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_log.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log
-#define __IMPL_FUNCTION(x) __clc_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log
+#define __CLC_IMPL_FUNCTION(x) __clc_log
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_log10.cl b/libclc/clc/lib/generic/math/clc_half_log10.cl
index 36f5bf55bb531..83d57db1bdf2f 100644
--- a/libclc/clc/lib/generic/math/clc_half_log10.cl
+++ b/libclc/clc/lib/generic/math/clc_half_log10.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_log10.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log10
-#define __IMPL_FUNCTION(x) __clc_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log10
+#define __CLC_IMPL_FUNCTION(x) __clc_log10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_log2.cl b/libclc/clc/lib/generic/math/clc_half_log2.cl
index cbf1d350dd8e2..7de0053fd7507 100644
--- a/libclc/clc/lib/generic/math/clc_half_log2.cl
+++ b/libclc/clc/lib/generic/math/clc_half_log2.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_log2.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_log2
-#define __IMPL_FUNCTION(x) __clc_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_log2
+#define __CLC_IMPL_FUNCTION(x) __clc_log2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_powr.cl b/libclc/clc/lib/generic/math/clc_half_powr.cl
index f7ef2074b840e..7065377ede66c 100644
--- a/libclc/clc/lib/generic/math/clc_half_powr.cl
+++ b/libclc/clc/lib/generic/math/clc_half_powr.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_powr.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_powr
-#define __IMPL_FUNCTION(x) __clc_powr
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_powr
+#define __CLC_IMPL_FUNCTION(x) __clc_powr
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_recip.cl b/libclc/clc/lib/generic/math/clc_half_recip.cl
index 0ae1e922d489f..a988ad5e05a8f 100644
--- a/libclc/clc/lib/generic/math/clc_half_recip.cl
+++ b/libclc/clc/lib/generic/math/clc_half_recip.cl
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_half_recip.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_rsqrt.cl b/libclc/clc/lib/generic/math/clc_half_rsqrt.cl
index 7e5d9e0526851..4e0cdd252f656 100644
--- a/libclc/clc/lib/generic/math/clc_half_rsqrt.cl
+++ b/libclc/clc/lib/generic/math/clc_half_rsqrt.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_rsqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_rsqrt
-#define __IMPL_FUNCTION(x) __clc_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_rsqrt
+#define __CLC_IMPL_FUNCTION(x) __clc_rsqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_sin.cl b/libclc/clc/lib/generic/math/clc_half_sin.cl
index ef333dae3797c..acc5d43156ab8 100644
--- a/libclc/clc/lib/generic/math/clc_half_sin.cl
+++ b/libclc/clc/lib/generic/math/clc_half_sin.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_sin.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_sin
-#define __IMPL_FUNCTION(x) __clc_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_sin
+#define __CLC_IMPL_FUNCTION(x) __clc_sin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_sqrt.cl b/libclc/clc/lib/generic/math/clc_half_sqrt.cl
index 293eb81196b63..01e779960df6c 100644
--- a/libclc/clc/lib/generic/math/clc_half_sqrt.cl
+++ b/libclc/clc/lib/generic/math/clc_half_sqrt.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_sqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_sqrt
-#define __IMPL_FUNCTION(x) __clc_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_sqrt
+#define __CLC_IMPL_FUNCTION(x) __clc_sqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_half_tan.cl b/libclc/clc/lib/generic/math/clc_half_tan.cl
index ecc9f8f328311..1427fe02555f1 100644
--- a/libclc/clc/lib/generic/math/clc_half_tan.cl
+++ b/libclc/clc/lib/generic/math/clc_half_tan.cl
@@ -8,9 +8,9 @@
#include <clc/math/clc_tan.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_half_tan
-#define __IMPL_FUNCTION(x) __clc_tan
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_half_tan
+#define __CLC_IMPL_FUNCTION(x) __clc_tan
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_ldexp.cl b/libclc/clc/lib/generic/math/clc_ldexp.cl
index cb4185d89c729..a5327c58e424a 100644
--- a/libclc/clc/lib/generic/math/clc_ldexp.cl
+++ b/libclc/clc/lib/generic/math/clc_ldexp.cl
@@ -131,7 +131,7 @@ _CLC_OVERLOAD _CLC_DEF_ldexp half __clc_ldexp(half x, int n) {
#endif
-#define FUNCTION __clc_ldexp
+#define __CLC_FUNCTION __clc_ldexp
#define __CLC_DEF_SPEC _CLC_DEF_ldexp
#define __CLC_ARG2_TYPE int
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
diff --git a/libclc/clc/lib/generic/math/clc_log.cl b/libclc/clc/lib/generic/math/clc_log.cl
index cf5628f206cad..7eb0180de971e 100644
--- a/libclc/clc/lib/generic/math/clc_log.cl
+++ b/libclc/clc/lib/generic/math/clc_log.cl
@@ -39,6 +39,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_log(half x) {
#endif // cl_khr_fp16
-#define FUNCTION __clc_log
+#define __CLC_FUNCTION __clc_log
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_log10.cl b/libclc/clc/lib/generic/math/clc_log10.cl
index f5f0e8cc70837..35489f4675629 100644
--- a/libclc/clc/lib/generic/math/clc_log10.cl
+++ b/libclc/clc/lib/generic/math/clc_log10.cl
@@ -22,6 +22,6 @@
#include "clc_log_base.h"
#undef COMPILING_LOG10
-#define FUNCTION __clc_log10
+#define __CLC_FUNCTION __clc_log10
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_log1p.inc b/libclc/clc/lib/generic/math/clc_log1p.inc
index 8c7dcfc48c18e..2dd616818c715 100644
--- a/libclc/clc/lib/generic/math/clc_log1p.inc
+++ b/libclc/clc/lib/generic/math/clc_log1p.inc
@@ -56,7 +56,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_log1p(__CLC_GENTYPE x) {
__CLC_GENTYPE f = mf > 24.0f ? fg24 : fl24;
indx = indx >> 16;
- __CLC_GENTYPE r = f * USE_TABLE(log_inv_tbl, __CLC_CONVERT_INTN(indx));
+ __CLC_GENTYPE r = f * __CLC_USE_TABLE(log_inv_tbl, __CLC_CONVERT_INTN(indx));
// 1/3, 1/2
__CLC_GENTYPE poly =
@@ -65,8 +65,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_log1p(__CLC_GENTYPE x) {
const __CLC_GENTYPE LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234
const __CLC_GENTYPE LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833
- __CLC_GENTYPE tv0 = USE_TABLE(loge_tbl_lo, __CLC_AS_INTN(indx));
- __CLC_GENTYPE tv1 = USE_TABLE(loge_tbl_hi, __CLC_AS_INTN(indx));
+ __CLC_GENTYPE tv0 = __CLC_USE_TABLE(loge_tbl_lo, __CLC_AS_INTN(indx));
+ __CLC_GENTYPE tv1 = __CLC_USE_TABLE(loge_tbl_hi, __CLC_AS_INTN(indx));
__CLC_GENTYPE z1 = __clc_mad(mf, LOG2_HEAD, tv0);
__CLC_GENTYPE z2 = __clc_mad(mf, LOG2_TAIL, -poly) + tv1;
__CLC_GENTYPE z = z1 + z2;
@@ -108,8 +108,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_log1p(__CLC_GENTYPE x) {
f2 = __CLC_CONVERT_LONGN(xexp <= -2 || (xexp >= MANTLENGTH_DP64 + 8)) ? f2temp
: f2;
- __CLC_GENTYPE z1 = USE_TABLE(ln_tbl_lo, j);
- __CLC_GENTYPE q = USE_TABLE(ln_tbl_hi, j);
+ __CLC_GENTYPE z1 = __CLC_USE_TABLE(ln_tbl_lo, j);
+ __CLC_GENTYPE q = __CLC_USE_TABLE(ln_tbl_hi, j);
__CLC_GENTYPE u = MATH_DIVIDE(f2, __clc_fma(0.5, f2, f1));
__CLC_GENTYPE v = u * u;
diff --git a/libclc/clc/lib/generic/math/clc_log2.cl b/libclc/clc/lib/generic/math/clc_log2.cl
index 335488af2f3de..d9d8cef542557 100644
--- a/libclc/clc/lib/generic/math/clc_log2.cl
+++ b/libclc/clc/lib/generic/math/clc_log2.cl
@@ -22,6 +22,6 @@
#include "clc_log_base.h"
#undef COMPILING_LOG2
-#define FUNCTION __clc_log2
+#define __CLC_FUNCTION __clc_log2
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_log_base.h b/libclc/clc/lib/generic/math/clc_log_base.h
index 9418535db827d..ba92679dbaaf4 100644
--- a/libclc/clc/lib/generic/math/clc_log_base.h
+++ b/libclc/clc/lib/generic/math/clc_log_base.h
@@ -142,21 +142,21 @@ __clc_log(float x)
__clc_as_float(0x3f000000 | (xin & MANTBITS_SP32));
indx = indx >> 16;
- r = f * USE_TABLE(log_inv_tbl, indx);
+ r = f * __CLC_USE_TABLE(log_inv_tbl, indx);
// 1/3, 1/2
float poly = __clc_mad(__clc_mad(r, 0x1.555556p-2f, 0.5f), r * r, r);
#if defined(COMPILING_LOG2)
- float2 tv = USE_TABLE(log2_tbl, indx);
+ float2 tv = __CLC_USE_TABLE(log2_tbl, indx);
z1 = tv.s0 + mf;
z2 = __clc_mad(poly, -LOG2E, tv.s1);
#elif defined(COMPILING_LOG10)
- float2 tv = USE_TABLE(log10_tbl, indx);
+ float2 tv = __CLC_USE_TABLE(log10_tbl, indx);
z1 = __clc_mad(mf, LOG10_2_HEAD, tv.s0);
z2 = __clc_mad(poly, -LOG10E, mf * LOG10_2_TAIL) + tv.s1;
#else
- float2 tv = USE_TABLE(log_tbl, indx);
+ float2 tv = __CLC_USE_TABLE(log_tbl, indx);
z1 = __clc_mad(mf, LOG2_HEAD, tv.s0);
z2 = __clc_mad(mf, LOG2_TAIL, -poly) + tv.s1;
#endif
@@ -261,8 +261,8 @@ __clc_log(double x)
int index = __clc_as_int2(ux).hi >> 13;
index = ((0x80 | (index & 0x7e)) >> 1) + (index & 0x1);
- double z1 = USE_TABLE(ln_tbl_lo, index - 64);
- double q = USE_TABLE(ln_tbl_hi, index - 64);
+ double z1 = __CLC_USE_TABLE(ln_tbl_lo, index - 64);
+ double q = __CLC_USE_TABLE(ln_tbl_hi, index - 64);
double f1 = index * 0x1.0p-7;
double f2 = f - f1;
diff --git a/libclc/clc/lib/generic/math/clc_modf.inc b/libclc/clc/lib/generic/math/clc_modf.inc
index 962d859ce9f68..4344c65a12bed 100644
--- a/libclc/clc/lib/generic/math/clc_modf.inc
+++ b/libclc/clc/lib/generic/math/clc_modf.inc
@@ -11,7 +11,7 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_modf(__CLC_GENTYPE x,
return __clc_copysign(__clc_isinf(x) ? __CLC_FP_LIT(0.0) : x - *iptr, x);
}
-#define CLC_MODF_DEF(addrspace) \
+#define __CLC_MODF_DEF(addrspace) \
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_modf( \
__CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) { \
__CLC_GENTYPE private_iptr; \
@@ -20,11 +20,11 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_modf(__CLC_GENTYPE x,
return ret; \
}
-CLC_MODF_DEF(local);
-CLC_MODF_DEF(global);
+__CLC_MODF_DEF(local);
+__CLC_MODF_DEF(global);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_MODF_DEF(generic);
+__CLC_MODF_DEF(generic);
#endif
-#undef CLC_MODF_DEF
+#undef __CLC_MODF_DEF
diff --git a/libclc/clc/lib/generic/math/clc_native_cos.cl b/libclc/clc/lib/generic/math/clc_native_cos.cl
index 2e63e9c9493f1..4e9a6c91b4260 100644
--- a/libclc/clc/lib/generic/math/clc_native_cos.cl
+++ b/libclc/clc/lib/generic/math/clc_native_cos.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_cos
-#define __IMPL_FUNCTION(x) __builtin_elementwise_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_cos
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_cos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_divide.cl b/libclc/clc/lib/generic/math/clc_native_divide.cl
index 005089b1ba15d..abec9add4fd62 100644
--- a/libclc/clc/lib/generic/math/clc_native_divide.cl
+++ b/libclc/clc/lib/generic/math/clc_native_divide.cl
@@ -8,7 +8,7 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_native_divide.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_exp.cl b/libclc/clc/lib/generic/math/clc_native_exp.cl
index 2f50a0aefac92..63b4e56913972 100644
--- a/libclc/clc/lib/generic/math/clc_native_exp.cl
+++ b/libclc/clc/lib/generic/math/clc_native_exp.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_exp
-#define __IMPL_FUNCTION(x) __builtin_elementwise_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_exp
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_exp
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_exp10.cl b/libclc/clc/lib/generic/math/clc_native_exp10.cl
index 7ca5d1992c61c..2819cd59c4be9 100644
--- a/libclc/clc/lib/generic/math/clc_native_exp10.cl
+++ b/libclc/clc/lib/generic/math/clc_native_exp10.cl
@@ -10,7 +10,7 @@
#include <clc/internal/clc.h>
#include <clc/math/clc_native_exp2.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_native_exp10.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_exp2.cl b/libclc/clc/lib/generic/math/clc_native_exp2.cl
index 25f557306c35b..a995b0347cac4 100644
--- a/libclc/clc/lib/generic/math/clc_native_exp2.cl
+++ b/libclc/clc/lib/generic/math/clc_native_exp2.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_exp2
-#define __IMPL_FUNCTION(x) __builtin_elementwise_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_exp2
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_exp2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_log.cl b/libclc/clc/lib/generic/math/clc_native_log.cl
index b9b9d274f8b9f..617908277fb6a 100644
--- a/libclc/clc/lib/generic/math/clc_native_log.cl
+++ b/libclc/clc/lib/generic/math/clc_native_log.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log
-#define __IMPL_FUNCTION(x) __builtin_elementwise_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_log10.cl b/libclc/clc/lib/generic/math/clc_native_log10.cl
index 221aa406466c4..0558f8cb7049b 100644
--- a/libclc/clc/lib/generic/math/clc_native_log10.cl
+++ b/libclc/clc/lib/generic/math/clc_native_log10.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log10
-#define __IMPL_FUNCTION(x) __builtin_elementwise_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log10
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_log2.cl b/libclc/clc/lib/generic/math/clc_native_log2.cl
index c3008ce242c74..c897ac07acb45 100644
--- a/libclc/clc/lib/generic/math/clc_native_log2.cl
+++ b/libclc/clc/lib/generic/math/clc_native_log2.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_log2
-#define __IMPL_FUNCTION(x) __builtin_elementwise_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_log2
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_log2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_powr.cl b/libclc/clc/lib/generic/math/clc_native_powr.cl
index 7c7dcaf8c508e..dac9b7edf78b9 100644
--- a/libclc/clc/lib/generic/math/clc_native_powr.cl
+++ b/libclc/clc/lib/generic/math/clc_native_powr.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_native_exp2.h>
#include <clc/math/clc_native_log2.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_native_powr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_recip.cl b/libclc/clc/lib/generic/math/clc_native_recip.cl
index 4377f10b1543f..75d832c8467ee 100644
--- a/libclc/clc/lib/generic/math/clc_native_recip.cl
+++ b/libclc/clc/lib/generic/math/clc_native_recip.cl
@@ -8,7 +8,7 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_native_recip.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_rsqrt.cl b/libclc/clc/lib/generic/math/clc_native_rsqrt.cl
index d5e6fcdae491f..9b88e72126f88 100644
--- a/libclc/clc/lib/generic/math/clc_native_rsqrt.cl
+++ b/libclc/clc/lib/generic/math/clc_native_rsqrt.cl
@@ -10,5 +10,5 @@
#include <clc/math/clc_native_sqrt.h>
#define __CLC_BODY <clc_native_rsqrt.inc>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_sin.cl b/libclc/clc/lib/generic/math/clc_native_sin.cl
index 533f8d726d41a..941342f387a1a 100644
--- a/libclc/clc/lib/generic/math/clc_native_sin.cl
+++ b/libclc/clc/lib/generic/math/clc_native_sin.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_sin
-#define __IMPL_FUNCTION(x) __builtin_elementwise_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_sin
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_sin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_sqrt.cl b/libclc/clc/lib/generic/math/clc_native_sqrt.cl
index e0f028e988b42..cc18a4b7ba1d3 100644
--- a/libclc/clc/lib/generic/math/clc_native_sqrt.cl
+++ b/libclc/clc/lib/generic/math/clc_native_sqrt.cl
@@ -8,9 +8,9 @@
#include <clc/internal/clc.h>
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_sqrt
-#define __IMPL_FUNCTION(x) __builtin_elementwise_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_sqrt
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_sqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_native_tan.cl b/libclc/clc/lib/generic/math/clc_native_tan.cl
index a9ac46688c8f3..6b69067be388e 100644
--- a/libclc/clc/lib/generic/math/clc_native_tan.cl
+++ b/libclc/clc/lib/generic/math/clc_native_tan.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_native_cos.h>
#include <clc/math/clc_native_sin.h>
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_native_tan.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_nextafter.cl b/libclc/clc/lib/generic/math/clc_nextafter.cl
index 6fc699ce711a7..40e1b5a2c57f9 100644
--- a/libclc/clc/lib/generic/math/clc_nextafter.cl
+++ b/libclc/clc/lib/generic/math/clc_nextafter.cl
@@ -14,67 +14,69 @@
// This file provides OpenCL C implementations of __clc_nextafter for
// targets that don't support the clang builtin.
-#define CLC_AS_TYPE(x) __clc_as_##x
+#define __CLC_CLC_AS_TYPE(x) __clc_as_##x
-#define NEXTAFTER(FLOAT_TYPE, UINT_TYPE, INT_TYPE, INT_TYPE_SCALAR) \
+#define __CLC_NEXTAFTER(FLOAT_TYPE, UINT_TYPE, INT_TYPE, INT_TYPE_SCALAR) \
_CLC_OVERLOAD _CLC_DEF FLOAT_TYPE __clc_nextafter(FLOAT_TYPE x, \
FLOAT_TYPE y) { \
const UINT_TYPE sign_bit = (UINT_TYPE)1 \
<< (sizeof(INT_TYPE_SCALAR) * 8 - 1); \
- UINT_TYPE ix = CLC_AS_TYPE(UINT_TYPE)(x); \
+ UINT_TYPE ix = __CLC_CLC_AS_TYPE(UINT_TYPE)(x); \
FLOAT_TYPE absx = __clc_fabs(x); \
UINT_TYPE mxu = sign_bit - ix; \
- INT_TYPE mx = CLC_AS_TYPE(INT_TYPE)(mxu); \
- mx = CLC_AS_TYPE(INT_TYPE)(ix) < (INT_TYPE)0 ? mx \
- : CLC_AS_TYPE(INT_TYPE)(ix); \
- UINT_TYPE iy = CLC_AS_TYPE(UINT_TYPE)(y); \
+ INT_TYPE mx = __CLC_CLC_AS_TYPE(INT_TYPE)(mxu); \
+ mx = __CLC_CLC_AS_TYPE(INT_TYPE)(ix) < (INT_TYPE)0 \
+ ? mx \
+ : __CLC_CLC_AS_TYPE(INT_TYPE)(ix); \
+ UINT_TYPE iy = __CLC_CLC_AS_TYPE(UINT_TYPE)(y); \
FLOAT_TYPE absy = __clc_fabs(y); \
UINT_TYPE myu = sign_bit - iy; \
- INT_TYPE my = CLC_AS_TYPE(INT_TYPE)(myu); \
- my = CLC_AS_TYPE(INT_TYPE)(iy) < (INT_TYPE)0 ? my \
- : CLC_AS_TYPE(INT_TYPE)(iy); \
- INT_TYPE t = mx + (mx < my ? (INT_TYPE)1 : (INT_TYPE)-1); \
- UINT_TYPE r = sign_bit - CLC_AS_TYPE(UINT_TYPE)(t); \
+ INT_TYPE my = __CLC_CLC_AS_TYPE(INT_TYPE)(myu); \
+ my = __CLC_CLC_AS_TYPE(INT_TYPE)(iy) < (INT_TYPE)0 \
+ ? my \
+ : __CLC_CLC_AS_TYPE(INT_TYPE)(iy); \
+ INT_TYPE t = mx + (mx < my ? (INT_TYPE)1 : (INT_TYPE) - 1); \
+ UINT_TYPE r = sign_bit - __CLC_CLC_AS_TYPE(UINT_TYPE)(t); \
r = (t < (INT_TYPE)0 || (t == (INT_TYPE)0 && mx < my)) \
? r \
- : CLC_AS_TYPE(UINT_TYPE)(t); \
+ : __CLC_CLC_AS_TYPE(UINT_TYPE)(t); \
r = __clc_isnan(x) ? ix : r; \
r = __clc_isnan(y) ? iy : r; \
- r = ((CLC_AS_TYPE(UINT_TYPE)(absx) | CLC_AS_TYPE(UINT_TYPE)(absy)) == \
- (UINT_TYPE)0 || \
+ r = ((__CLC_CLC_AS_TYPE(UINT_TYPE)(absx) | \
+ __CLC_CLC_AS_TYPE(UINT_TYPE)(absy)) == (UINT_TYPE)0 || \
ix == iy) \
? iy \
: r; \
- return CLC_AS_TYPE(FLOAT_TYPE)(r); \
+ return __CLC_CLC_AS_TYPE(FLOAT_TYPE)(r); \
}
-NEXTAFTER(float, uint, int, int)
-NEXTAFTER(float2, uint2, int2, int)
-NEXTAFTER(float3, uint3, int3, int)
-NEXTAFTER(float4, uint4, int4, int)
-NEXTAFTER(float8, uint8, int8, int)
-NEXTAFTER(float16, uint16, int16, int)
+__CLC_NEXTAFTER(float, uint, int, int)
+__CLC_NEXTAFTER(float2, uint2, int2, int)
+__CLC_NEXTAFTER(float3, uint3, int3, int)
+__CLC_NEXTAFTER(float4, uint4, int4, int)
+__CLC_NEXTAFTER(float8, uint8, int8, int)
+__CLC_NEXTAFTER(float16, uint16, int16, int)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-NEXTAFTER(double, ulong, long, long)
-NEXTAFTER(double2, ulong2, long2, long)
-NEXTAFTER(double3, ulong3, long3, long)
-NEXTAFTER(double4, ulong4, long4, long)
-NEXTAFTER(double8, ulong8, long8, long)
-NEXTAFTER(double16, ulong16, long16, long)
+__CLC_NEXTAFTER(double, ulong, long, long)
+__CLC_NEXTAFTER(double2, ulong2, long2, long)
+__CLC_NEXTAFTER(double3, ulong3, long3, long)
+__CLC_NEXTAFTER(double4, ulong4, long4, long)
+__CLC_NEXTAFTER(double8, ulong8, long8, long)
+__CLC_NEXTAFTER(double16, ulong16, long16, long)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-NEXTAFTER(half, ushort, short, short)
-NEXTAFTER(half2, ushort2, short2, short)
-NEXTAFTER(half3, ushort3, short3, short)
-NEXTAFTER(half4, ushort4, short4, short)
-NEXTAFTER(half8, ushort8, short8, short)
-NEXTAFTER(half16, ushort16, short16, short)
+__CLC_NEXTAFTER(half, ushort, short, short)
+__CLC_NEXTAFTER(half2, ushort2, short2, short)
+__CLC_NEXTAFTER(half3, ushort3, short3, short)
+__CLC_NEXTAFTER(half4, ushort4, short4, short)
+__CLC_NEXTAFTER(half8, ushort8, short8, short)
+__CLC_NEXTAFTER(half16, ushort16, short16, short)
#endif
diff --git a/libclc/clc/lib/generic/math/clc_pow.inc b/libclc/clc/lib/generic/math/clc_pow.inc
index 8b1f820268ba0..35cbcdae8ffff 100644
--- a/libclc/clc/lib/generic/math/clc_pow.inc
+++ b/libclc/clc/lib/generic/math/clc_pow.inc
@@ -103,8 +103,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
__CLC_AS_GENTYPE(0x3f000000 | (ixn & MANTBITS_SP32));
indx = indx >> 16;
- __CLC_GENTYPE rh = f * USE_TABLE(log_inv_tbl_ep_head, indx);
- __CLC_GENTYPE rt = f * USE_TABLE(log_inv_tbl_ep_tail, indx);
+ __CLC_GENTYPE rh = f * __CLC_USE_TABLE(log_inv_tbl_ep_head, indx);
+ __CLC_GENTYPE rt = f * __CLC_USE_TABLE(log_inv_tbl_ep_tail, indx);
r = rh + rt;
poly = __clc_mad(r, __clc_mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) *
@@ -113,8 +113,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
const __CLC_GENTYPE LOG2_HEAD = 0x1.62e000p-1f; /* 0.693115234 */
const __CLC_GENTYPE LOG2_TAIL = 0x1.0bfbe8p-15f; /* 0.0000319461833 */
- __CLC_GENTYPE logel = USE_TABLE(loge_tbl_lo, indx);
- __CLC_GENTYPE logeh = USE_TABLE(loge_tbl_hi, indx);
+ __CLC_GENTYPE logel = __CLC_USE_TABLE(loge_tbl_lo, indx);
+ __CLC_GENTYPE logeh = __CLC_USE_TABLE(loge_tbl_hi, indx);
__CLC_GENTYPE lth = -r;
__CLC_GENTYPE ltt = __clc_mad(mfn, LOG2_TAIL, -poly) + logeh;
__CLC_GENTYPE lt = lth + ltt;
@@ -161,8 +161,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
0x1.000000p-1f),
r * r, r);
- __CLC_GENTYPE exp_head = USE_TABLE(exp_tbl_ep_head, j);
- __CLC_GENTYPE exp_tail = USE_TABLE(exp_tbl_ep_tail, j);
+ __CLC_GENTYPE exp_head = __CLC_USE_TABLE(exp_tbl_ep_head, j);
+ __CLC_GENTYPE exp_tail = __CLC_USE_TABLE(exp_tbl_ep_tail, j);
__CLC_GENTYPE expylogx =
__clc_mad(exp_head, poly, __clc_mad(exp_tail, poly, exp_tail)) + exp_head;
@@ -275,8 +275,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
__CLC_GENTYPE F = __CLC_AS_GENTYPE(rax | 0x3FE0000000000000L);
__CLC_GENTYPE Y = __CLC_AS_GENTYPE(mantissa | 0x3FE0000000000000L);
__CLC_GENTYPE f = F - Y;
- __CLC_GENTYPE log_h = USE_TABLE(log_f_inv_tbl_head, index);
- __CLC_GENTYPE log_t = USE_TABLE(log_f_inv_tbl_tail, index);
+ __CLC_GENTYPE log_h = __CLC_USE_TABLE(log_f_inv_tbl_head, index);
+ __CLC_GENTYPE log_t = __CLC_USE_TABLE(log_f_inv_tbl_tail, index);
__CLC_GENTYPE f_inv = (log_h + log_t) * f;
__CLC_GENTYPE r1 =
__CLC_AS_GENTYPE(__CLC_AS_ULONGN(f_inv) & 0xfffffffff8000000L);
@@ -296,8 +296,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
__CLC_GENTYPE poly0t = r1 - poly0h + hr1r1;
poly = __clc_fma(r1, r2, __clc_fma(0.5 * r2, r2, poly)) + r2 + poly0t;
- log_h = USE_TABLE(powlog_tbl_head, index);
- log_t = USE_TABLE(powlog_tbl_tail, index);
+ log_h = __CLC_USE_TABLE(powlog_tbl_head, index);
+ log_t = __CLC_USE_TABLE(powlog_tbl_tail, index);
__CLC_GENTYPE resT_t = __clc_fma(xexp, real_log2_tail, +log_t) - poly;
__CLC_GENTYPE resT = resT_t - poly0h;
@@ -345,8 +345,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pow(__CLC_GENTYPE x,
__CLC_INTN j = n & 0x0000003f;
__CLC_INTN m = n >> 6;
- __CLC_GENTYPE f1 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE f2 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE f1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE f2 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
__CLC_GENTYPE f = f1 + f2;
__CLC_GENTYPE r1 = __clc_fma(dn, -lnof2_by_64_head, v);
diff --git a/libclc/clc/lib/generic/math/clc_pown.inc b/libclc/clc/lib/generic/math/clc_pown.inc
index 483fd2faf2717..1a681b5e4b397 100644
--- a/libclc/clc/lib/generic/math/clc_pown.inc
+++ b/libclc/clc/lib/generic/math/clc_pown.inc
@@ -104,8 +104,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
__CLC_AS_GENTYPE(0x3f000000 | (ixn & MANTBITS_SP32));
indx = indx >> 16;
- __CLC_GENTYPE rh = f * USE_TABLE(log_inv_tbl_ep_head, indx);
- __CLC_GENTYPE rt = f * USE_TABLE(log_inv_tbl_ep_tail, indx);
+ __CLC_GENTYPE rh = f * __CLC_USE_TABLE(log_inv_tbl_ep_head, indx);
+ __CLC_GENTYPE rt = f * __CLC_USE_TABLE(log_inv_tbl_ep_tail, indx);
r = rh + rt;
poly = __clc_mad(r, __clc_mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) *
@@ -114,8 +114,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
const __CLC_GENTYPE LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234
const __CLC_GENTYPE LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833
- __CLC_GENTYPE logel = USE_TABLE(loge_tbl_lo, indx);
- __CLC_GENTYPE logeh = USE_TABLE(loge_tbl_hi, indx);
+ __CLC_GENTYPE logel = __CLC_USE_TABLE(loge_tbl_lo, indx);
+ __CLC_GENTYPE logeh = __CLC_USE_TABLE(loge_tbl_hi, indx);
__CLC_GENTYPE lth = -r;
__CLC_GENTYPE ltt = __clc_mad(mfn, LOG2_TAIL, -poly) + logeh;
__CLC_GENTYPE lt = lth + ltt;
@@ -162,8 +162,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
0x1.000000p-1f),
r * r, r);
- __CLC_GENTYPE exp_head = USE_TABLE(exp_tbl_ep_head, j);
- __CLC_GENTYPE exp_tail = USE_TABLE(exp_tbl_ep_tail, j);
+ __CLC_GENTYPE exp_head = __CLC_USE_TABLE(exp_tbl_ep_head, j);
+ __CLC_GENTYPE exp_tail = __CLC_USE_TABLE(exp_tbl_ep_tail, j);
__CLC_GENTYPE expylogx =
__clc_mad(exp_head, poly, __clc_mad(exp_tail, poly, exp_tail)) + exp_head;
@@ -256,8 +256,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
__CLC_GENTYPE F = __CLC_AS_GENTYPE(rax | 0x3FE0000000000000L);
__CLC_GENTYPE Y = __CLC_AS_GENTYPE(mantissa | 0x3FE0000000000000L);
__CLC_GENTYPE f = F - Y;
- __CLC_GENTYPE log_h = USE_TABLE(log_f_inv_tbl_head, index);
- __CLC_GENTYPE log_t = USE_TABLE(log_f_inv_tbl_tail, index);
+ __CLC_GENTYPE log_h = __CLC_USE_TABLE(log_f_inv_tbl_head, index);
+ __CLC_GENTYPE log_t = __CLC_USE_TABLE(log_f_inv_tbl_tail, index);
__CLC_GENTYPE f_inv = (log_h + log_t) * f;
__CLC_GENTYPE r1 =
__CLC_AS_GENTYPE(__CLC_AS_ULONGN(f_inv) & 0xfffffffff8000000L);
@@ -277,8 +277,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
__CLC_GENTYPE poly0t = r1 - poly0h + hr1r1;
poly = __clc_fma(r1, r2, __clc_fma(0.5 * r2, r2, poly)) + r2 + poly0t;
- log_h = USE_TABLE(powlog_tbl_head, index);
- log_t = USE_TABLE(powlog_tbl_tail, index);
+ log_h = __CLC_USE_TABLE(powlog_tbl_head, index);
+ log_t = __CLC_USE_TABLE(powlog_tbl_tail, index);
__CLC_GENTYPE resT_t = __clc_fma(xexp, real_log2_tail, +log_t) - poly;
__CLC_GENTYPE resT = resT_t - poly0h;
@@ -332,8 +332,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_pown(__CLC_GENTYPE x,
__CLC_INTN j = n & 0x0000003f;
__CLC_INTN m = n >> 6;
- __CLC_GENTYPE f1 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE f2 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE f1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE f2 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
__CLC_GENTYPE f = f1 + f2;
__CLC_GENTYPE r1 = __clc_fma(dn, -lnof2_by_64_head, v);
diff --git a/libclc/clc/lib/generic/math/clc_powr.inc b/libclc/clc/lib/generic/math/clc_powr.inc
index 1244f7f6ac5d6..b94dbfdcbdeb7 100644
--- a/libclc/clc/lib/generic/math/clc_powr.inc
+++ b/libclc/clc/lib/generic/math/clc_powr.inc
@@ -102,8 +102,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
__CLC_AS_GENTYPE(0x3f000000 | (ixn & MANTBITS_SP32));
indx = indx >> 16;
- __CLC_GENTYPE rh = f * USE_TABLE(log_inv_tbl_ep_head, indx);
- __CLC_GENTYPE rt = f * USE_TABLE(log_inv_tbl_ep_tail, indx);
+ __CLC_GENTYPE rh = f * __CLC_USE_TABLE(log_inv_tbl_ep_head, indx);
+ __CLC_GENTYPE rt = f * __CLC_USE_TABLE(log_inv_tbl_ep_tail, indx);
r = rh + rt;
poly = __clc_mad(r, __clc_mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) *
@@ -112,8 +112,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
const __CLC_GENTYPE LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234
const __CLC_GENTYPE LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833
- __CLC_GENTYPE logel = USE_TABLE(loge_tbl_lo, indx);
- __CLC_GENTYPE logeh = USE_TABLE(loge_tbl_hi, indx);
+ __CLC_GENTYPE logel = __CLC_USE_TABLE(loge_tbl_lo, indx);
+ __CLC_GENTYPE logeh = __CLC_USE_TABLE(loge_tbl_hi, indx);
__CLC_GENTYPE lth = -r;
__CLC_GENTYPE ltt = __clc_mad(mfn, LOG2_TAIL, -poly) + logeh;
__CLC_GENTYPE lt = lth + ltt;
@@ -159,8 +159,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
0x1.000000p-1f),
r * r, r);
- __CLC_GENTYPE exp_head = USE_TABLE(exp_tbl_ep_head, j);
- __CLC_GENTYPE exp_tail = USE_TABLE(exp_tbl_ep_tail, j);
+ __CLC_GENTYPE exp_head = __CLC_USE_TABLE(exp_tbl_ep_head, j);
+ __CLC_GENTYPE exp_tail = __CLC_USE_TABLE(exp_tbl_ep_tail, j);
__CLC_GENTYPE expylogx =
__clc_mad(exp_head, poly, __clc_mad(exp_tail, poly, exp_tail)) + exp_head;
@@ -261,8 +261,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
__CLC_GENTYPE F = __CLC_AS_GENTYPE(rax | 0x3FE0000000000000L);
__CLC_GENTYPE Y = __CLC_AS_GENTYPE(mantissa | 0x3FE0000000000000L);
__CLC_GENTYPE f = F - Y;
- __CLC_GENTYPE log_h = USE_TABLE(log_f_inv_tbl_head, index);
- __CLC_GENTYPE log_t = USE_TABLE(log_f_inv_tbl_tail, index);
+ __CLC_GENTYPE log_h = __CLC_USE_TABLE(log_f_inv_tbl_head, index);
+ __CLC_GENTYPE log_t = __CLC_USE_TABLE(log_f_inv_tbl_tail, index);
__CLC_GENTYPE f_inv = (log_h + log_t) * f;
__CLC_GENTYPE r1 =
__CLC_AS_GENTYPE(__CLC_AS_ULONGN(f_inv) & 0xfffffffff8000000L);
@@ -282,8 +282,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
__CLC_GENTYPE poly0t = r1 - poly0h + hr1r1;
poly = __clc_fma(r1, r2, __clc_fma(0.5 * r2, r2, poly)) + r2 + poly0t;
- log_h = USE_TABLE(powlog_tbl_head, index);
- log_t = USE_TABLE(powlog_tbl_tail, index);
+ log_h = __CLC_USE_TABLE(powlog_tbl_head, index);
+ log_t = __CLC_USE_TABLE(powlog_tbl_tail, index);
__CLC_GENTYPE resT_t = __clc_fma(xexp, real_log2_tail, +log_t) - poly;
__CLC_GENTYPE resT = resT_t - poly0h;
@@ -331,8 +331,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_powr(__CLC_GENTYPE x,
__CLC_INTN j = n & 0x0000003f;
__CLC_INTN m = n >> 6;
- __CLC_GENTYPE f1 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE f2 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE f1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE f2 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
__CLC_GENTYPE f = f1 + f2;
__CLC_GENTYPE r1 = __clc_fma(dn, -lnof2_by_64_head, v);
diff --git a/libclc/clc/lib/generic/math/clc_remainder.cl b/libclc/clc/lib/generic/math/clc_remainder.cl
index 2b3d185a8bee6..488dde73f67a0 100644
--- a/libclc/clc/lib/generic/math/clc_remainder.cl
+++ b/libclc/clc/lib/generic/math/clc_remainder.cl
@@ -74,11 +74,11 @@ _CLC_DEF _CLC_OVERLOAD float __clc_remainder(float x, float y) {
return xr;
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_remainder
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_remainder
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#ifdef cl_khr_fp64
@@ -212,11 +212,11 @@ _CLC_DEF _CLC_OVERLOAD double __clc_remainder(double x, double y) {
return ret;
}
-#define __DOUBLE_ONLY
-#define FUNCTION __clc_remainder
+#define __CLC_DOUBLE_ONLY
+#define __CLC_FUNCTION __clc_remainder
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif
@@ -225,8 +225,8 @@ _CLC_DEF _CLC_OVERLOAD double __clc_remainder(double x, double y) {
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
// Forward the half version of this builtin onto the float one
-#define __HALF_ONLY
-#define FUNCTION __clc_remainder
+#define __CLC_HALF_ONLY
+#define __CLC_FUNCTION __clc_remainder
#define __CLC_BODY <clc/math/binary_def_via_fp32.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_remquo.inc b/libclc/clc/lib/generic/math/clc_remquo.inc
index 28f51c4e2fc23..3a76ffed7f039 100644
--- a/libclc/clc/lib/generic/math/clc_remquo.inc
+++ b/libclc/clc/lib/generic/math/clc_remquo.inc
@@ -74,7 +74,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_remquo(float x, float y,
}
// remquo signature is special, we don't have macro for this
-#define __VEC_REMQUO(TYPE, VEC_SIZE, HALF_VEC_SIZE) \
+#define __CLC_VEC_REMQUO(TYPE, VEC_SIZE, HALF_VEC_SIZE) \
_CLC_DEF _CLC_OVERLOAD TYPE##VEC_SIZE __clc_remquo( \
TYPE##VEC_SIZE x, TYPE##VEC_SIZE y, \
__CLC_ADDRESS_SPACE int##VEC_SIZE *quo) { \
@@ -87,7 +87,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_remquo(float x, float y,
return ret; \
}
-#define __VEC3_REMQUO(TYPE) \
+#define __CLC_VEC3_REMQUO(TYPE) \
_CLC_DEF _CLC_OVERLOAD TYPE##3 __clc_remquo( \
TYPE##3 x, TYPE##3 y, __CLC_ADDRESS_SPACE int##3 * quo) { \
int2 lo; \
@@ -99,11 +99,11 @@ _CLC_DEF _CLC_OVERLOAD float __clc_remquo(float x, float y,
(*quo).s2 = hi; \
return ret; \
}
-__VEC_REMQUO(float, 2, )
-__VEC3_REMQUO(float)
-__VEC_REMQUO(float, 4, 2)
-__VEC_REMQUO(float, 8, 4)
-__VEC_REMQUO(float, 16, 8)
+__CLC_VEC_REMQUO(float, 2, )
+__CLC_VEC3_REMQUO(float)
+__CLC_VEC_REMQUO(float, 4, 2)
+__CLC_VEC_REMQUO(float, 8, 4)
+__CLC_VEC_REMQUO(float, 16, 8)
#ifdef cl_khr_fp64
@@ -246,11 +246,11 @@ _CLC_DEF _CLC_OVERLOAD double __clc_remquo(double x, double y,
*pquo = quo;
return ret;
}
-__VEC_REMQUO(double, 2, )
-__VEC3_REMQUO(double)
-__VEC_REMQUO(double, 4, 2)
-__VEC_REMQUO(double, 8, 4)
-__VEC_REMQUO(double, 16, 8)
+__CLC_VEC_REMQUO(double, 2, )
+__CLC_VEC3_REMQUO(double)
+__CLC_VEC_REMQUO(double, 4, 2)
+__CLC_VEC_REMQUO(double, 8, 4)
+__CLC_VEC_REMQUO(double, 16, 8)
#endif
@@ -262,10 +262,10 @@ _CLC_OVERLOAD _CLC_DEF half __clc_remquo(half x, half y,
__CLC_ADDRESS_SPACE int *pquo) {
return (half)__clc_remquo((float)x, (float)y, pquo);
}
-__VEC_REMQUO(half, 2, )
-__VEC3_REMQUO(half)
-__VEC_REMQUO(half, 4, 2)
-__VEC_REMQUO(half, 8, 4)
-__VEC_REMQUO(half, 16, 8)
+__CLC_VEC_REMQUO(half, 2, )
+__CLC_VEC3_REMQUO(half)
+__CLC_VEC_REMQUO(half, 4, 2)
+__CLC_VEC_REMQUO(half, 8, 4)
+__CLC_VEC_REMQUO(half, 16, 8)
#endif
diff --git a/libclc/clc/lib/generic/math/clc_rint.cl b/libclc/clc/lib/generic/math/clc_rint.cl
index b3f94490e3b5a..e3aaae0ffec6f 100644
--- a/libclc/clc/lib/generic/math/clc_rint.cl
+++ b/libclc/clc/lib/generic/math/clc_rint.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_rint
-#define __IMPL_FUNCTION(x) __builtin_elementwise_rint
+#define __CLC_FUNCTION __clc_rint
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_rint
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_rootn.inc b/libclc/clc/lib/generic/math/clc_rootn.inc
index 996f88f145357..fd3d0becb0dff 100644
--- a/libclc/clc/lib/generic/math/clc_rootn.inc
+++ b/libclc/clc/lib/generic/math/clc_rootn.inc
@@ -103,8 +103,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
__CLC_AS_GENTYPE(0x3f000000 | (ixn & MANTBITS_SP32));
indx = indx >> 16;
- __CLC_GENTYPE rh = f * USE_TABLE(log_inv_tbl_ep_head, indx);
- __CLC_GENTYPE rt = f * USE_TABLE(log_inv_tbl_ep_tail, indx);
+ __CLC_GENTYPE rh = f * __CLC_USE_TABLE(log_inv_tbl_ep_head, indx);
+ __CLC_GENTYPE rt = f * __CLC_USE_TABLE(log_inv_tbl_ep_tail, indx);
;
r = rh + rt;
@@ -116,9 +116,10 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
const __CLC_GENTYPE LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833
__CLC_GENTYPE lth = -r;
__CLC_GENTYPE ltt =
- __clc_mad(mfn, LOG2_TAIL, -poly) + USE_TABLE(loge_tbl_hi, indx);
+ __clc_mad(mfn, LOG2_TAIL, -poly) + __CLC_USE_TABLE(loge_tbl_hi, indx);
__CLC_GENTYPE lt = lth + ltt;
- __CLC_GENTYPE lh = __clc_mad(mfn, LOG2_HEAD, USE_TABLE(loge_tbl_lo, indx));
+ __CLC_GENTYPE lh =
+ __clc_mad(mfn, LOG2_HEAD, __CLC_USE_TABLE(loge_tbl_lo, indx));
__CLC_GENTYPE l = lh + lt;
// Select near 1 or not
@@ -165,8 +166,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
0x1.000000p-1f),
r * r, r);
- __CLC_GENTYPE exph = USE_TABLE(exp_tbl_ep_head, j);
- __CLC_GENTYPE expt = USE_TABLE(exp_tbl_ep_tail, j);
+ __CLC_GENTYPE exph = __CLC_USE_TABLE(exp_tbl_ep_head, j);
+ __CLC_GENTYPE expt = __CLC_USE_TABLE(exp_tbl_ep_tail, j);
__CLC_GENTYPE expylogx =
__clc_mad(exph, poly, __clc_mad(expt, poly, expt)) + exph;
@@ -263,8 +264,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
__CLC_GENTYPE F = __CLC_AS_GENTYPE(rax | 0x3FE0000000000000L);
__CLC_GENTYPE Y = __CLC_AS_GENTYPE(mantissa | 0x3FE0000000000000L);
__CLC_GENTYPE f = F - Y;
- __CLC_GENTYPE log_h = USE_TABLE(log_f_inv_tbl_head, index);
- __CLC_GENTYPE log_t = USE_TABLE(log_f_inv_tbl_tail, index);
+ __CLC_GENTYPE log_h = __CLC_USE_TABLE(log_f_inv_tbl_head, index);
+ __CLC_GENTYPE log_t = __CLC_USE_TABLE(log_f_inv_tbl_tail, index);
__CLC_GENTYPE f_inv = (log_h + log_t) * f;
__CLC_GENTYPE r1 =
__CLC_AS_GENTYPE(__CLC_AS_ULONGN(f_inv) & 0xfffffffff8000000L);
@@ -284,8 +285,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
__CLC_GENTYPE poly0t = r1 - poly0h + hr1r1;
poly = __clc_fma(r1, r2, __clc_fma(0.5 * r2, r2, poly)) + r2 + poly0t;
- log_h = USE_TABLE(powlog_tbl_head, index);
- log_t = USE_TABLE(powlog_tbl_tail, index);
+ log_h = __CLC_USE_TABLE(powlog_tbl_head, index);
+ log_t = __CLC_USE_TABLE(powlog_tbl_tail, index);
__CLC_GENTYPE resT_t = __clc_fma(xexp, real_log2_tail, +log_t) - poly;
__CLC_GENTYPE resT = resT_t - poly0h;
@@ -338,8 +339,8 @@ _CLC_DEF _CLC_OVERLOAD __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE x,
__CLC_INTN j = n & 0x0000003f;
__CLC_INTN m = n >> 6;
- __CLC_GENTYPE f1 = USE_TABLE(two_to_jby64_ep_tbl_head, j);
- __CLC_GENTYPE f2 = USE_TABLE(two_to_jby64_ep_tbl_tail, j);
+ __CLC_GENTYPE f1 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_head, j);
+ __CLC_GENTYPE f2 = __CLC_USE_TABLE(two_to_jby64_ep_tbl_tail, j);
__CLC_GENTYPE f = f1 + f2;
__CLC_GENTYPE r1 = __clc_fma(dn, -lnof2_by_64_head, v);
diff --git a/libclc/clc/lib/generic/math/clc_round.cl b/libclc/clc/lib/generic/math/clc_round.cl
index 8c298d8c34835..5ed8d08ba4f45 100644
--- a/libclc/clc/lib/generic/math/clc_round.cl
+++ b/libclc/clc/lib/generic/math/clc_round.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_round
-#define __IMPL_FUNCTION(x) __builtin_elementwise_round
+#define __CLC_FUNCTION __clc_round
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_round
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_sincos_helpers.cl b/libclc/clc/lib/generic/math/clc_sincos_helpers.cl
index 0ea1195fffa70..19705c42f6f07 100644
--- a/libclc/clc/lib/generic/math/clc_sincos_helpers.cl
+++ b/libclc/clc/lib/generic/math/clc_sincos_helpers.cl
@@ -18,16 +18,16 @@
#define bitalign(hi, lo, shift) ((hi) << (32 - (shift))) | ((lo) >> (shift));
-#define FULL_MUL(A, B, HI, LO) \
+#define __CLC_FULL_MUL(A, B, HI, LO) \
LO = A * B; \
HI = __clc_mul_hi(A, B)
-#define FULL_MAD(A, B, C, HI, LO) \
+#define __CLC_FULL_MAD(A, B, C, HI, LO) \
LO = ((A) * (B) + (C)); \
HI = __clc_mul_hi(A, B); \
HI += LO < C ? 1U : 0U;
-#define __FLOAT_ONLY
+#define __CLC_FLOAT_ONLY
#define __CLC_BODY <clc_sincos_helpers.inc>
#include <clc/math/gentype.inc>
@@ -45,7 +45,7 @@
((__CLC_CONVERT_LONGN((src0)) << 32) | __CLC_CONVERT_LONGN((src1))) >> \
(((src2) & 3) * 8)))
-#define __DOUBLE_ONLY
+#define __CLC_DOUBLE_ONLY
#define __CLC_BODY <clc_sincos_helpers_fp64.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_sincos_helpers.inc b/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
index 29c742136b7e9..bddc0998cf950 100644
--- a/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
+++ b/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
@@ -175,13 +175,13 @@ _CLC_DEF _CLC_OVERLOAD __CLC_INTN __clc_argReductionLargeS(
__CLC_UINTN p0, p1, p2, p3, p4, p5, p6, p7, c0, c1;
- FULL_MUL(xm, b0, c0, p0);
- FULL_MAD(xm, b1, c0, c1, p1);
- FULL_MAD(xm, b2, c1, c0, p2);
- FULL_MAD(xm, b3, c0, c1, p3);
- FULL_MAD(xm, b4, c1, c0, p4);
- FULL_MAD(xm, b5, c0, c1, p5);
- FULL_MAD(xm, b6, c1, p7, p6);
+ __CLC_FULL_MUL(xm, b0, c0, p0);
+ __CLC_FULL_MAD(xm, b1, c0, c1, p1);
+ __CLC_FULL_MAD(xm, b2, c1, c0, p2);
+ __CLC_FULL_MAD(xm, b3, c0, c1, p3);
+ __CLC_FULL_MAD(xm, b4, c1, c0, p4);
+ __CLC_FULL_MAD(xm, b5, c0, c1, p5);
+ __CLC_FULL_MAD(xm, b6, c1, p7, p6);
__CLC_UINTN fbits = (__CLC_UINTN)224 + (__CLC_UINTN)23 - __CLC_AS_UINTN(xe);
diff --git a/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc b/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
index 9b5776d9b05e9..8fae90c9cc5a5 100644
--- a/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
+++ b/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
@@ -67,11 +67,11 @@ __clc_remainder_piby2_large(__CLC_DOUBLEN x, private __CLC_DOUBLEN *r,
// The following extracts 192 consecutive bits of 2/pi aligned on an arbitrary
// byte boundary
- __CLC_ULONGN q0 = USE_TABLE(pibits_tbl, j16);
- __CLC_ULONGN q1 = USE_TABLE(pibits_tbl, (j16 + 8));
- __CLC_ULONGN q2 = USE_TABLE(pibits_tbl, (j16 + 16));
- __CLC_ULONGN q3 = USE_TABLE(pibits_tbl, (j16 + 24));
- __CLC_ULONGN q4 = USE_TABLE(pibits_tbl, (j16 + 32));
+ __CLC_ULONGN q0 = __CLC_USE_TABLE(pibits_tbl, j16);
+ __CLC_ULONGN q1 = __CLC_USE_TABLE(pibits_tbl, (j16 + 8));
+ __CLC_ULONGN q2 = __CLC_USE_TABLE(pibits_tbl, (j16 + 16));
+ __CLC_ULONGN q3 = __CLC_USE_TABLE(pibits_tbl, (j16 + 24));
+ __CLC_ULONGN q4 = __CLC_USE_TABLE(pibits_tbl, (j16 + 32));
__CLC_UINTN q0s0 = __CLC_CONVERT_UINTN(q0);
__CLC_UINTN q0s1 = __CLC_CONVERT_UINTN(q0 >> 32);
diff --git a/libclc/clc/lib/generic/math/clc_sinh.inc b/libclc/clc/lib/generic/math/clc_sinh.inc
index 799cc32105084..d39059166ffb3 100644
--- a/libclc/clc/lib/generic/math/clc_sinh.inc
+++ b/libclc/clc/lib/generic/math/clc_sinh.inc
@@ -69,8 +69,8 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_sinh(__CLC_GENTYPE x) {
0.500000000000000005911074e0f);
cdy = __clc_mad(cdy, dy2, 1.0f);
- __CLC_GENTYPE sinhcoshh = USE_TABLE(sinhcosh_tbl_head, ind);
- __CLC_GENTYPE sinhcosht = USE_TABLE(sinhcosh_tbl_tail, ind);
+ __CLC_GENTYPE sinhcoshh = __CLC_USE_TABLE(sinhcosh_tbl_head, ind);
+ __CLC_GENTYPE sinhcosht = __CLC_USE_TABLE(sinhcosh_tbl_tail, ind);
__CLC_GENTYPE z = __clc_mad(sinhcosht, sdy, sinhcoshh * cdy);
z = __CLC_AS_GENTYPE(xs | __CLC_AS_UINTN(z));
@@ -167,10 +167,10 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_sinh(__CLC_GENTYPE x) {
__CLC_AS_GENTYPE(__CLC_AS_ULONGN(dy) & 0xfffffffff8000000UL);
__CLC_GENTYPE sdy2 = sdy + (dy - sdy1);
- __CLC_GENTYPE cl = USE_TABLE(cosh_tbl_head, ind);
- __CLC_GENTYPE ct = USE_TABLE(cosh_tbl_tail, ind);
- __CLC_GENTYPE sl = USE_TABLE(sinh_tbl_head, ind);
- __CLC_GENTYPE st = USE_TABLE(sinh_tbl_tail, ind);
+ __CLC_GENTYPE cl = __CLC_USE_TABLE(cosh_tbl_head, ind);
+ __CLC_GENTYPE ct = __CLC_USE_TABLE(cosh_tbl_tail, ind);
+ __CLC_GENTYPE sl = __CLC_USE_TABLE(sinh_tbl_head, ind);
+ __CLC_GENTYPE st = __CLC_USE_TABLE(sinh_tbl_tail, ind);
__CLC_GENTYPE z =
__clc_fma(cl, sdy1,
diff --git a/libclc/clc/lib/generic/math/clc_sw_fma.cl b/libclc/clc/lib/generic/math/clc_sw_fma.cl
index ee4734078d698..550ca5e18f3f8 100644
--- a/libclc/clc/lib/generic/math/clc_sw_fma.cl
+++ b/libclc/clc/lib/generic/math/clc_sw_fma.cl
@@ -160,7 +160,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_sw_fma(float a, float b, float c) {
((uint)st_fma.mantissa & 0x7fffff));
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_sw_fma
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_sw_fma
#define __CLC_BODY <clc/shared/ternary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_tables.cl b/libclc/clc/lib/generic/math/clc_tables.cl
index 7db00532c8be5..67a17525014db 100644
--- a/libclc/clc/lib/generic/math/clc_tables.cl
+++ b/libclc/clc/lib/generic/math/clc_tables.cl
@@ -9,7 +9,7 @@
#include <clc/internal/clc.h>
#include <clc/math/tables.h>
-DECLARE_TABLE(float, LOG_INV_TBL_EP_HEAD, 129) = {
+__CLC_DECLARE_TABLE(float, LOG_INV_TBL_EP_HEAD, 129) = {
0x1.000000p+1f, 0x1.fc0000p+0f, 0x1.f80000p+0f, 0x1.f40000p+0f,
0x1.f00000p+0f, 0x1.ec0000p+0f, 0x1.e80000p+0f, 0x1.e40000p+0f,
0x1.e00000p+0f, 0x1.de0000p+0f, 0x1.da0000p+0f, 0x1.d60000p+0f,
@@ -45,9 +45,9 @@ DECLARE_TABLE(float, LOG_INV_TBL_EP_HEAD, 129) = {
0x1.000000p+0f,
};
-CLC_TABLE_FUNCTION(float, LOG_INV_TBL_EP_HEAD, log_inv_tbl_ep_head);
+__CLC_TABLE_FUNCTION_VEC(float, LOG_INV_TBL_EP_HEAD, log_inv_tbl_ep_head);
-DECLARE_TABLE(float, LOG_INV_TBL_EP_TAIL, 129) = {
+__CLC_DECLARE_TABLE(float, LOG_INV_TBL_EP_TAIL, 129) = {
0x0.000000p+0f, 0x1.fc07f0p-14f, 0x1.f81f82p-12f, 0x1.196792p-10f,
0x1.f07c20p-10f, 0x1.80f660p-9f, 0x1.131ac0p-8f, 0x1.73ac90p-8f,
0x1.e1e1e2p-8f, 0x1.75b8fep-10f, 0x1.cc0ed8p-9f, 0x1.7b654cp-8f,
@@ -82,9 +82,9 @@ DECLARE_TABLE(float, LOG_INV_TBL_EP_TAIL, 129) = {
0x1.041042p-12f, 0x1.091b52p-8f, 0x1.020408p-14f, 0x1.010102p-8f,
0x0.000000p+0f,
};
-CLC_TABLE_FUNCTION(float, LOG_INV_TBL_EP_TAIL, log_inv_tbl_ep_tail);
+__CLC_TABLE_FUNCTION_VEC(float, LOG_INV_TBL_EP_TAIL, log_inv_tbl_ep_tail);
-DECLARE_TABLE(float, LOGE_TBL_LO, 129) = {
+__CLC_DECLARE_TABLE(float, LOGE_TBL_LO, 129) = {
0x0.000000p+0f, 0x1.fe0000p-8f, 0x1.fc0000p-7f, 0x1.7b8000p-6f,
0x1.f82000p-6f, 0x1.39e000p-5f, 0x1.774000p-5f, 0x1.b42000p-5f,
0x1.f0a000p-5f, 0x1.164000p-4f, 0x1.340000p-4f, 0x1.51a000p-4f,
@@ -120,7 +120,7 @@ DECLARE_TABLE(float, LOGE_TBL_LO, 129) = {
0x1.62e000p-1f,
};
-DECLARE_TABLE(float, LOGE_TBL_HI, 129) = {
+__CLC_DECLARE_TABLE(float, LOGE_TBL_HI, 129) = {
0x0.000000p+0f, 0x1.535882p-23f, 0x1.5161f8p-20f, 0x1.1b07d4p-18f,
0x1.361cf0p-19f, 0x1.0f73fcp-18f, 0x1.63d8cap-19f, 0x1.bae232p-18f,
0x1.86008ap-20f, 0x1.36eea2p-16f, 0x1.d7961ap-16f, 0x1.073f06p-16f,
@@ -156,10 +156,10 @@ DECLARE_TABLE(float, LOGE_TBL_HI, 129) = {
0x1.0bfbe8p-15f,
};
-CLC_TABLE_FUNCTION(float, LOGE_TBL_LO, loge_tbl_lo);
-CLC_TABLE_FUNCTION(float, LOGE_TBL_HI, loge_tbl_hi);
+__CLC_TABLE_FUNCTION_VEC(float, LOGE_TBL_LO, loge_tbl_lo);
+__CLC_TABLE_FUNCTION_VEC(float, LOGE_TBL_HI, loge_tbl_hi);
-DECLARE_TABLE(float, LOG_INV_TBL, 129) = {
+__CLC_DECLARE_TABLE(float, LOG_INV_TBL, 129) = {
0x1.000000p+1f, 0x1.fc07f0p+0f, 0x1.f81f82p+0f, 0x1.f4465ap+0f,
0x1.f07c20p+0f, 0x1.ecc07cp+0f, 0x1.e9131ap+0f, 0x1.e573acp+0f,
0x1.e1e1e2p+0f, 0x1.de5d6ep+0f, 0x1.dae608p+0f, 0x1.d77b66p+0f,
@@ -195,143 +195,142 @@ DECLARE_TABLE(float, LOG_INV_TBL, 129) = {
0x1.000000p+0f,
};
-CLC_TABLE_FUNCTION(float, LOG_INV_TBL, log_inv_tbl);
-
-DECLARE_TABLE(float2, LOG2_TBL, 129) = {
- (float2)(0x0.000000p+0f, 0x0.000000p+0f),
- (float2)(0x1.6f8000p-7f, 0x1.942dbap-17f),
- (float2)(0x1.6e0000p-6f, 0x1.e5a170p-16f),
- (float2)(0x1.118000p-5f, 0x1.347544p-15f),
- (float2)(0x1.6b8000p-5f, 0x1.69bac6p-16f),
- (float2)(0x1.c48000p-5f, 0x1.7eae42p-15f),
- (float2)(0x1.0e8000p-4f, 0x1.9c4fd0p-15f),
- (float2)(0x1.3a8000p-4f, 0x1.17ee92p-15f),
- (float2)(0x1.660000p-4f, 0x1.fb7d64p-15f),
- (float2)(0x1.918000p-4f, 0x1.42dc8cp-17f),
- (float2)(0x1.bc8000p-4f, 0x1.0902b6p-18f),
- (float2)(0x1.e70000p-4f, 0x1.7608bep-15f),
- (float2)(0x1.088000p-3f, 0x1.162336p-13f),
- (float2)(0x1.1d8000p-3f, 0x1.3465d4p-13f),
- (float2)(0x1.328000p-3f, 0x1.74f13cp-14f),
- (float2)(0x1.470000p-3f, 0x1.aa7e60p-13f),
- (float2)(0x1.5c0000p-3f, 0x1.a39fbcp-19f),
- (float2)(0x1.700000p-3f, 0x1.d0b53ap-13f),
- (float2)(0x1.848000p-3f, 0x1.0af40ap-13f),
- (float2)(0x1.988000p-3f, 0x1.b741dep-13f),
- (float2)(0x1.ac8000p-3f, 0x1.d78b6cp-13f),
- (float2)(0x1.c08000p-3f, 0x1.6db376p-13f),
- (float2)(0x1.d48000p-3f, 0x1.ee4c32p-15f),
- (float2)(0x1.e80000p-3f, 0x1.02f9d2p-13f),
- (float2)(0x1.fb8000p-3f, 0x1.05ae40p-13f),
- (float2)(0x1.078000p-2f, 0x1.0adbb0p-14f),
- (float2)(0x1.110000p-2f, 0x1.83ed68p-13f),
- (float2)(0x1.1a8000p-2f, 0x1.016ca4p-12f),
- (float2)(0x1.240000p-2f, 0x1.01eac2p-12f),
- (float2)(0x1.2d8000p-2f, 0x1.887e26p-13f),
- (float2)(0x1.370000p-2f, 0x1.24cea4p-14f),
- (float2)(0x1.400000p-2f, 0x1.918ec6p-12f),
- (float2)(0x1.498000p-2f, 0x1.3c25e6p-13f),
- (float2)(0x1.528000p-2f, 0x1.6f7f12p-12f),
- (float2)(0x1.5c0000p-2f, 0x1.a39fbcp-18f),
- (float2)(0x1.650000p-2f, 0x1.8fe466p-14f),
- (float2)(0x1.6e0000p-2f, 0x1.10e6cep-13f),
- (float2)(0x1.770000p-2f, 0x1.d2ba7ep-14f),
- (float2)(0x1.800000p-2f, 0x1.4ac62cp-15f),
- (float2)(0x1.888000p-2f, 0x1.a71cb8p-12f),
- (float2)(0x1.918000p-2f, 0x1.dd448ep-13f),
- (float2)(0x1.9a8000p-2f, 0x1.1c8f10p-21f),
- (float2)(0x1.a30000p-2f, 0x1.bb053ep-13f),
- (float2)(0x1.ab8000p-2f, 0x1.861e5ep-12f),
- (float2)(0x1.b40000p-2f, 0x1.fafdcep-12f),
- (float2)(0x1.bd0000p-2f, 0x1.e5d3cep-15f),
- (float2)(0x1.c58000p-2f, 0x1.2fad28p-14f),
- (float2)(0x1.ce0000p-2f, 0x1.492474p-15f),
- (float2)(0x1.d60000p-2f, 0x1.d4f80cp-12f),
- (float2)(0x1.de8000p-2f, 0x1.4ff510p-12f),
- (float2)(0x1.e70000p-2f, 0x1.3550f2p-13f),
- (float2)(0x1.ef0000p-2f, 0x1.b59ccap-12f),
- (float2)(0x1.f78000p-2f, 0x1.42b464p-13f),
- (float2)(0x1.ff8000p-2f, 0x1.5e66a0p-12f),
- (float2)(0x1.038000p-1f, 0x1.f6a2e4p-11f),
- (float2)(0x1.080000p-1f, 0x1.39e4fep-14f),
- (float2)(0x1.0c0000p-1f, 0x1.0500d6p-13f),
- (float2)(0x1.100000p-1f, 0x1.13b152p-13f),
- (float2)(0x1.140000p-1f, 0x1.93f542p-14f),
- (float2)(0x1.180000p-1f, 0x1.467b94p-16f),
- (float2)(0x1.1b8000p-1f, 0x1.cc47a4p-11f),
- (float2)(0x1.1f8000p-1f, 0x1.78f4c2p-11f),
- (float2)(0x1.238000p-1f, 0x1.107508p-11f),
- (float2)(0x1.278000p-1f, 0x1.2602c2p-12f),
- (float2)(0x1.2b8000p-1f, 0x1.a39fbcp-20f),
- (float2)(0x1.2f0000p-1f, 0x1.5a1d7ap-11f),
- (float2)(0x1.330000p-1f, 0x1.3e355ap-12f),
- (float2)(0x1.368000p-1f, 0x1.cffedap-11f),
- (float2)(0x1.3a8000p-1f, 0x1.d9fd50p-12f),
- (float2)(0x1.3e0000p-1f, 0x1.f64de6p-11f),
- (float2)(0x1.420000p-1f, 0x1.d83f4cp-12f),
- (float2)(0x1.458000p-1f, 0x1.cea628p-11f),
- (float2)(0x1.498000p-1f, 0x1.3c25e6p-12f),
- (float2)(0x1.4d0000p-1f, 0x1.5a96ccp-11f),
- (float2)(0x1.510000p-1f, 0x1.18708ap-17f),
- (float2)(0x1.548000p-1f, 0x1.374652p-12f),
- (float2)(0x1.580000p-1f, 0x1.2089a6p-11f),
- (float2)(0x1.5b8000p-1f, 0x1.93432cp-11f),
- (float2)(0x1.5f0000p-1f, 0x1.f3fd06p-11f),
- (float2)(0x1.630000p-1f, 0x1.0b8f54p-13f),
- (float2)(0x1.668000p-1f, 0x1.004722p-12f),
- (float2)(0x1.6a0000p-1f, 0x1.57cf2cp-12f),
- (float2)(0x1.6d8000p-1f, 0x1.8cb53ap-12f),
- (float2)(0x1.710000p-1f, 0x1.9f4d8ap-12f),
- (float2)(0x1.748000p-1f, 0x1.8feb26p-12f),
- (float2)(0x1.780000p-1f, 0x1.5edfeep-12f),
- (float2)(0x1.7b8000p-1f, 0x1.0c7c9ap-12f),
- (float2)(0x1.7f0000p-1f, 0x1.322182p-13f),
- (float2)(0x1.828000p-1f, 0x1.3ab7cep-18f),
- (float2)(0x1.858000p-1f, 0x1.a82c2cp-11f),
- (float2)(0x1.890000p-1f, 0x1.3dd2c0p-11f),
- (float2)(0x1.8c8000p-1f, 0x1.871da4p-12f),
- (float2)(0x1.900000p-1f, 0x1.cc2c00p-14f),
- (float2)(0x1.930000p-1f, 0x1.9fdb68p-11f),
- (float2)(0x1.968000p-1f, 0x1.ed6956p-12f),
- (float2)(0x1.9a0000p-1f, 0x1.f1a760p-14f),
- (float2)(0x1.9d0000p-1f, 0x1.767f54p-11f),
- (float2)(0x1.a08000p-1f, 0x1.3f6d26p-12f),
- (float2)(0x1.a38000p-1f, 0x1.b9fce2p-11f),
- (float2)(0x1.a70000p-1f, 0x1.8ae816p-12f),
- (float2)(0x1.aa0000p-1f, 0x1.c23d60p-11f),
- (float2)(0x1.ad8000p-1f, 0x1.60f388p-12f),
- (float2)(0x1.b08000p-1f, 0x1.9049aep-11f),
- (float2)(0x1.b40000p-1f, 0x1.8734a8p-13f),
- (float2)(0x1.b70000p-1f, 0x1.2523d4p-11f),
- (float2)(0x1.ba0000p-1f, 0x1.da6ce6p-11f),
- (float2)(0x1.bd8000p-1f, 0x1.038e62p-12f),
- (float2)(0x1.c08000p-1f, 0x1.1b511ep-11f),
- (float2)(0x1.c38000p-1f, 0x1.a728b8p-11f),
- (float2)(0x1.c70000p-1f, 0x1.2b5d22p-14f),
- (float2)(0x1.ca0000p-1f, 0x1.2c6e54p-12f),
- (float2)(0x1.cd0000p-1f, 0x1.f35064p-12f),
- (float2)(0x1.d00000p-1f, 0x1.4fdb48p-11f),
- (float2)(0x1.d30000p-1f, 0x1.98ec9ep-11f),
- (float2)(0x1.d60000p-1f, 0x1.d4f80cp-11f),
- (float2)(0x1.d98000p-1f, 0x1.0643d6p-17f),
- (float2)(0x1.dc8000p-1f, 0x1.33567ep-14f),
- (float2)(0x1.df8000p-1f, 0x1.e0410cp-14f),
- (float2)(0x1.e28000p-1f, 0x1.142e0ep-13f),
- (float2)(0x1.e58000p-1f, 0x1.063c88p-13f),
- (float2)(0x1.e88000p-1f, 0x1.8d66c4p-14f),
- (float2)(0x1.eb8000p-1f, 0x1.57e32ap-15f),
- (float2)(0x1.ee0000p-1f, 0x1.ed1c6cp-11f),
- (float2)(0x1.f10000p-1f, 0x1.b8a076p-11f),
- (float2)(0x1.f40000p-1f, 0x1.7822f2p-11f),
- (float2)(0x1.f70000p-1f, 0x1.2bbc3ap-11f),
- (float2)(0x1.fa0000p-1f, 0x1.a708bap-12f),
- (float2)(0x1.fd0000p-1f, 0x1.be4c7ep-13f),
- (float2)(0x1.000000p+0f, 0x0.000000p+0f)
-};
-
-TABLE_FUNCTION(float2, LOG2_TBL, log2_tbl);
-
-DECLARE_TABLE(float2, LOG10_TBL, 129) = {
+__CLC_TABLE_FUNCTION_VEC(float, LOG_INV_TBL, log_inv_tbl);
+
+__CLC_DECLARE_TABLE(float2, LOG2_TBL,
+ 129) = {(float2)(0x0.000000p+0f, 0x0.000000p+0f),
+ (float2)(0x1.6f8000p-7f, 0x1.942dbap-17f),
+ (float2)(0x1.6e0000p-6f, 0x1.e5a170p-16f),
+ (float2)(0x1.118000p-5f, 0x1.347544p-15f),
+ (float2)(0x1.6b8000p-5f, 0x1.69bac6p-16f),
+ (float2)(0x1.c48000p-5f, 0x1.7eae42p-15f),
+ (float2)(0x1.0e8000p-4f, 0x1.9c4fd0p-15f),
+ (float2)(0x1.3a8000p-4f, 0x1.17ee92p-15f),
+ (float2)(0x1.660000p-4f, 0x1.fb7d64p-15f),
+ (float2)(0x1.918000p-4f, 0x1.42dc8cp-17f),
+ (float2)(0x1.bc8000p-4f, 0x1.0902b6p-18f),
+ (float2)(0x1.e70000p-4f, 0x1.7608bep-15f),
+ (float2)(0x1.088000p-3f, 0x1.162336p-13f),
+ (float2)(0x1.1d8000p-3f, 0x1.3465d4p-13f),
+ (float2)(0x1.328000p-3f, 0x1.74f13cp-14f),
+ (float2)(0x1.470000p-3f, 0x1.aa7e60p-13f),
+ (float2)(0x1.5c0000p-3f, 0x1.a39fbcp-19f),
+ (float2)(0x1.700000p-3f, 0x1.d0b53ap-13f),
+ (float2)(0x1.848000p-3f, 0x1.0af40ap-13f),
+ (float2)(0x1.988000p-3f, 0x1.b741dep-13f),
+ (float2)(0x1.ac8000p-3f, 0x1.d78b6cp-13f),
+ (float2)(0x1.c08000p-3f, 0x1.6db376p-13f),
+ (float2)(0x1.d48000p-3f, 0x1.ee4c32p-15f),
+ (float2)(0x1.e80000p-3f, 0x1.02f9d2p-13f),
+ (float2)(0x1.fb8000p-3f, 0x1.05ae40p-13f),
+ (float2)(0x1.078000p-2f, 0x1.0adbb0p-14f),
+ (float2)(0x1.110000p-2f, 0x1.83ed68p-13f),
+ (float2)(0x1.1a8000p-2f, 0x1.016ca4p-12f),
+ (float2)(0x1.240000p-2f, 0x1.01eac2p-12f),
+ (float2)(0x1.2d8000p-2f, 0x1.887e26p-13f),
+ (float2)(0x1.370000p-2f, 0x1.24cea4p-14f),
+ (float2)(0x1.400000p-2f, 0x1.918ec6p-12f),
+ (float2)(0x1.498000p-2f, 0x1.3c25e6p-13f),
+ (float2)(0x1.528000p-2f, 0x1.6f7f12p-12f),
+ (float2)(0x1.5c0000p-2f, 0x1.a39fbcp-18f),
+ (float2)(0x1.650000p-2f, 0x1.8fe466p-14f),
+ (float2)(0x1.6e0000p-2f, 0x1.10e6cep-13f),
+ (float2)(0x1.770000p-2f, 0x1.d2ba7ep-14f),
+ (float2)(0x1.800000p-2f, 0x1.4ac62cp-15f),
+ (float2)(0x1.888000p-2f, 0x1.a71cb8p-12f),
+ (float2)(0x1.918000p-2f, 0x1.dd448ep-13f),
+ (float2)(0x1.9a8000p-2f, 0x1.1c8f10p-21f),
+ (float2)(0x1.a30000p-2f, 0x1.bb053ep-13f),
+ (float2)(0x1.ab8000p-2f, 0x1.861e5ep-12f),
+ (float2)(0x1.b40000p-2f, 0x1.fafdcep-12f),
+ (float2)(0x1.bd0000p-2f, 0x1.e5d3cep-15f),
+ (float2)(0x1.c58000p-2f, 0x1.2fad28p-14f),
+ (float2)(0x1.ce0000p-2f, 0x1.492474p-15f),
+ (float2)(0x1.d60000p-2f, 0x1.d4f80cp-12f),
+ (float2)(0x1.de8000p-2f, 0x1.4ff510p-12f),
+ (float2)(0x1.e70000p-2f, 0x1.3550f2p-13f),
+ (float2)(0x1.ef0000p-2f, 0x1.b59ccap-12f),
+ (float2)(0x1.f78000p-2f, 0x1.42b464p-13f),
+ (float2)(0x1.ff8000p-2f, 0x1.5e66a0p-12f),
+ (float2)(0x1.038000p-1f, 0x1.f6a2e4p-11f),
+ (float2)(0x1.080000p-1f, 0x1.39e4fep-14f),
+ (float2)(0x1.0c0000p-1f, 0x1.0500d6p-13f),
+ (float2)(0x1.100000p-1f, 0x1.13b152p-13f),
+ (float2)(0x1.140000p-1f, 0x1.93f542p-14f),
+ (float2)(0x1.180000p-1f, 0x1.467b94p-16f),
+ (float2)(0x1.1b8000p-1f, 0x1.cc47a4p-11f),
+ (float2)(0x1.1f8000p-1f, 0x1.78f4c2p-11f),
+ (float2)(0x1.238000p-1f, 0x1.107508p-11f),
+ (float2)(0x1.278000p-1f, 0x1.2602c2p-12f),
+ (float2)(0x1.2b8000p-1f, 0x1.a39fbcp-20f),
+ (float2)(0x1.2f0000p-1f, 0x1.5a1d7ap-11f),
+ (float2)(0x1.330000p-1f, 0x1.3e355ap-12f),
+ (float2)(0x1.368000p-1f, 0x1.cffedap-11f),
+ (float2)(0x1.3a8000p-1f, 0x1.d9fd50p-12f),
+ (float2)(0x1.3e0000p-1f, 0x1.f64de6p-11f),
+ (float2)(0x1.420000p-1f, 0x1.d83f4cp-12f),
+ (float2)(0x1.458000p-1f, 0x1.cea628p-11f),
+ (float2)(0x1.498000p-1f, 0x1.3c25e6p-12f),
+ (float2)(0x1.4d0000p-1f, 0x1.5a96ccp-11f),
+ (float2)(0x1.510000p-1f, 0x1.18708ap-17f),
+ (float2)(0x1.548000p-1f, 0x1.374652p-12f),
+ (float2)(0x1.580000p-1f, 0x1.2089a6p-11f),
+ (float2)(0x1.5b8000p-1f, 0x1.93432cp-11f),
+ (float2)(0x1.5f0000p-1f, 0x1.f3fd06p-11f),
+ (float2)(0x1.630000p-1f, 0x1.0b8f54p-13f),
+ (float2)(0x1.668000p-1f, 0x1.004722p-12f),
+ (float2)(0x1.6a0000p-1f, 0x1.57cf2cp-12f),
+ (float2)(0x1.6d8000p-1f, 0x1.8cb53ap-12f),
+ (float2)(0x1.710000p-1f, 0x1.9f4d8ap-12f),
+ (float2)(0x1.748000p-1f, 0x1.8feb26p-12f),
+ (float2)(0x1.780000p-1f, 0x1.5edfeep-12f),
+ (float2)(0x1.7b8000p-1f, 0x1.0c7c9ap-12f),
+ (float2)(0x1.7f0000p-1f, 0x1.322182p-13f),
+ (float2)(0x1.828000p-1f, 0x1.3ab7cep-18f),
+ (float2)(0x1.858000p-1f, 0x1.a82c2cp-11f),
+ (float2)(0x1.890000p-1f, 0x1.3dd2c0p-11f),
+ (float2)(0x1.8c8000p-1f, 0x1.871da4p-12f),
+ (float2)(0x1.900000p-1f, 0x1.cc2c00p-14f),
+ (float2)(0x1.930000p-1f, 0x1.9fdb68p-11f),
+ (float2)(0x1.968000p-1f, 0x1.ed6956p-12f),
+ (float2)(0x1.9a0000p-1f, 0x1.f1a760p-14f),
+ (float2)(0x1.9d0000p-1f, 0x1.767f54p-11f),
+ (float2)(0x1.a08000p-1f, 0x1.3f6d26p-12f),
+ (float2)(0x1.a38000p-1f, 0x1.b9fce2p-11f),
+ (float2)(0x1.a70000p-1f, 0x1.8ae816p-12f),
+ (float2)(0x1.aa0000p-1f, 0x1.c23d60p-11f),
+ (float2)(0x1.ad8000p-1f, 0x1.60f388p-12f),
+ (float2)(0x1.b08000p-1f, 0x1.9049aep-11f),
+ (float2)(0x1.b40000p-1f, 0x1.8734a8p-13f),
+ (float2)(0x1.b70000p-1f, 0x1.2523d4p-11f),
+ (float2)(0x1.ba0000p-1f, 0x1.da6ce6p-11f),
+ (float2)(0x1.bd8000p-1f, 0x1.038e62p-12f),
+ (float2)(0x1.c08000p-1f, 0x1.1b511ep-11f),
+ (float2)(0x1.c38000p-1f, 0x1.a728b8p-11f),
+ (float2)(0x1.c70000p-1f, 0x1.2b5d22p-14f),
+ (float2)(0x1.ca0000p-1f, 0x1.2c6e54p-12f),
+ (float2)(0x1.cd0000p-1f, 0x1.f35064p-12f),
+ (float2)(0x1.d00000p-1f, 0x1.4fdb48p-11f),
+ (float2)(0x1.d30000p-1f, 0x1.98ec9ep-11f),
+ (float2)(0x1.d60000p-1f, 0x1.d4f80cp-11f),
+ (float2)(0x1.d98000p-1f, 0x1.0643d6p-17f),
+ (float2)(0x1.dc8000p-1f, 0x1.33567ep-14f),
+ (float2)(0x1.df8000p-1f, 0x1.e0410cp-14f),
+ (float2)(0x1.e28000p-1f, 0x1.142e0ep-13f),
+ (float2)(0x1.e58000p-1f, 0x1.063c88p-13f),
+ (float2)(0x1.e88000p-1f, 0x1.8d66c4p-14f),
+ (float2)(0x1.eb8000p-1f, 0x1.57e32ap-15f),
+ (float2)(0x1.ee0000p-1f, 0x1.ed1c6cp-11f),
+ (float2)(0x1.f10000p-1f, 0x1.b8a076p-11f),
+ (float2)(0x1.f40000p-1f, 0x1.7822f2p-11f),
+ (float2)(0x1.f70000p-1f, 0x1.2bbc3ap-11f),
+ (float2)(0x1.fa0000p-1f, 0x1.a708bap-12f),
+ (float2)(0x1.fd0000p-1f, 0x1.be4c7ep-13f),
+ (float2)(0x1.000000p+0f, 0x0.000000p+0f)};
+
+__CLC_TABLE_FUNCTION(float2, LOG2_TBL, log2_tbl);
+
+__CLC_DECLARE_TABLE(float2, LOG10_TBL, 129) = {
(float2)(0x0.000000p+0f, 0x0.000000p+0f),
(float2)(0x1.ba8000p-9f, 0x1.f51c88p-19f),
(float2)(0x1.b90000p-8f, 0x1.1da93ep-18f),
@@ -463,10 +462,9 @@ DECLARE_TABLE(float2, LOG10_TBL, 129) = {
(float2)(0x1.340000p-2f, 0x1.04d426p-12f),
};
-TABLE_FUNCTION(float2, LOG10_TBL, log10_tbl);
-
+__CLC_TABLE_FUNCTION(float2, LOG10_TBL, log10_tbl);
-DECLARE_TABLE(float, EXP_TBL, 65) = {
+__CLC_DECLARE_TABLE(float, EXP_TBL, 65) = {
0x1.000000p+0f, 0x1.02c9a4p+0f, 0x1.059b0ep+0f, 0x1.087452p+0f,
0x1.0b5586p+0f, 0x1.0e3ec4p+0f, 0x1.11301ep+0f, 0x1.1429aap+0f,
0x1.172b84p+0f, 0x1.1a35bep+0f, 0x1.1d4874p+0f, 0x1.2063b8p+0f,
@@ -486,9 +484,9 @@ DECLARE_TABLE(float, EXP_TBL, 65) = {
0x1.000000p+1f,
};
-CLC_TABLE_FUNCTION(float, EXP_TBL, exp_tbl);
+__CLC_TABLE_FUNCTION_VEC(float, EXP_TBL, exp_tbl);
-DECLARE_TABLE(float, EXP_TBL_EP_HEAD, 65) = {
+__CLC_DECLARE_TABLE(float, EXP_TBL_EP_HEAD, 65) = {
0x1.000000p+0f, 0x1.02c000p+0f, 0x1.058000p+0f, 0x1.084000p+0f,
0x1.0b4000p+0f, 0x1.0e0000p+0f, 0x1.110000p+0f, 0x1.140000p+0f,
0x1.170000p+0f, 0x1.1a0000p+0f, 0x1.1d4000p+0f, 0x1.204000p+0f,
@@ -508,9 +506,9 @@ DECLARE_TABLE(float, EXP_TBL_EP_HEAD, 65) = {
0x1.000000p+1f,
};
-CLC_TABLE_FUNCTION(float, EXP_TBL_EP_HEAD, exp_tbl_ep_head);
+__CLC_TABLE_FUNCTION_VEC(float, EXP_TBL_EP_HEAD, exp_tbl_ep_head);
-DECLARE_TABLE(float, EXP_TBL_EP_TAIL, 65) = {
+__CLC_DECLARE_TABLE(float, EXP_TBL_EP_TAIL, 65) = {
0x0.000000p+0f, 0x1.347ceep-13f, 0x1.b0d314p-12f, 0x1.a28c3ap-11f,
0x1.586cf8p-12f, 0x1.f61968p-11f, 0x1.80e808p-11f, 0x1.4d5754p-11f,
0x1.5c1e3ep-11f, 0x1.adf5b6p-11f, 0x1.0e62d0p-13f, 0x1.1dc430p-11f,
@@ -530,9 +528,9 @@ DECLARE_TABLE(float, EXP_TBL_EP_TAIL, 65) = {
0x0.000000p+0f,
};
-CLC_TABLE_FUNCTION(float, EXP_TBL_EP_TAIL, exp_tbl_ep_tail);
+__CLC_TABLE_FUNCTION_VEC(float, EXP_TBL_EP_TAIL, exp_tbl_ep_tail);
-DECLARE_TABLE(float, CBRT_TBL_HEAD, 129) = {
+__CLC_DECLARE_TABLE(float, CBRT_TBL_HEAD, 129) = {
0x1.000000p+0f, 0x1.008000p+0f, 0x1.014000p+0f, 0x1.01c000p+0f,
0x1.028000p+0f, 0x1.034000p+0f, 0x1.03c000p+0f, 0x1.048000p+0f,
0x1.050000p+0f, 0x1.05c000p+0f, 0x1.068000p+0f, 0x1.070000p+0f,
@@ -568,9 +566,9 @@ DECLARE_TABLE(float, CBRT_TBL_HEAD, 129) = {
0x1.428000p+0f,
};
-CLC_TABLE_FUNCTION(float, CBRT_TBL_HEAD, cbrt_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(float, CBRT_TBL_HEAD, cbrt_tbl_head);
-DECLARE_TABLE(float, CBRT_TBL_TAIL, 129) = {
+__CLC_DECLARE_TABLE(float, CBRT_TBL_TAIL, 129) = {
0x0.000000p+0f, 0x1.51cb0ap-11f, 0x1.39221ep-12f, 0x1.e06908p-11f,
0x1.1d6978p-11f, 0x1.4ea1bep-13f, 0x1.833b8ep-11f, 0x1.587002p-12f,
0x1.ceb290p-11f, 0x1.d57f34p-12f, 0x1.cc53acp-21f, 0x1.0fe098p-11f,
@@ -606,10 +604,10 @@ DECLARE_TABLE(float, CBRT_TBL_TAIL, 129) = {
0x1.45f31ap-13f,
};
-CLC_TABLE_FUNCTION(float, CBRT_TBL_TAIL, cbrt_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(float, CBRT_TBL_TAIL, cbrt_tbl_tail);
// Tabulated values of sinh(i) and cosh(i) for i = 0,...,36.
-DECLARE_TABLE(float, SINHCOSH_TBL_HEAD, 37) = {
+__CLC_DECLARE_TABLE(float, SINHCOSH_TBL_HEAD, 37) = {
0x0.000000p+0f, 0x1.2cd9fcp+0f, 0x1.d03cf6p+1f, 0x1.40926ep+3f,
0x1.b4a380p+4f, 0x1.28d016p+6f, 0x1.936d22p+7f, 0x1.122876p+9f,
0x1.749ea6p+10f, 0x1.fa7158p+11f, 0x1.5829dcp+13f, 0x1.d3c448p+14f,
@@ -622,9 +620,9 @@ DECLARE_TABLE(float, SINHCOSH_TBL_HEAD, 37) = {
0x1.ea215ap+50f,
};
-CLC_TABLE_FUNCTION(float, SINHCOSH_TBL_HEAD, sinhcosh_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(float, SINHCOSH_TBL_HEAD, sinhcosh_tbl_head);
-DECLARE_TABLE(float, SINHCOSH_TBL_TAIL, 37) = {
+__CLC_DECLARE_TABLE(float, SINHCOSH_TBL_TAIL, 37) = {
0x1.000000p+0f, 0x1.8b0756p+0f, 0x1.e18fa0p+1f, 0x1.422a4ap+3f,
0x1.b4ee86p+4f, 0x1.28d6fcp+6f, 0x1.936e68p+7f, 0x1.122894p+9f,
0x1.749eaap+10f, 0x1.fa7158p+11f, 0x1.5829dep+13f, 0x1.d3c448p+14f,
@@ -637,13 +635,13 @@ DECLARE_TABLE(float, SINHCOSH_TBL_TAIL, 37) = {
0x1.ea215ap+50f,
};
-CLC_TABLE_FUNCTION(float, SINHCOSH_TBL_TAIL, sinhcosh_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(float, SINHCOSH_TBL_TAIL, sinhcosh_tbl_tail);
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-DECLARE_TABLE(double, LN_TBL_LO, 65) = {
+__CLC_DECLARE_TABLE(double, LN_TBL_LO, 65) = {
0x0.0000000000000p+0, 0x1.fc0a800000000p-7, 0x1.f829800000000p-6,
0x1.7745800000000p-5, 0x1.f0a3000000000p-5, 0x1.341d700000000p-4,
0x1.6f0d200000000p-4, 0x1.a926d00000000p-4, 0x1.e270700000000p-4,
@@ -668,9 +666,9 @@ DECLARE_TABLE(double, LN_TBL_LO, 65) = {
0x1.5ee02a0000000p-1, 0x1.62e42e0000000p-1,
};
-CLC_TABLE_FUNCTION(double, LN_TBL_LO, ln_tbl_lo);
+__CLC_TABLE_FUNCTION_VEC(double, LN_TBL_LO, ln_tbl_lo);
-DECLARE_TABLE(double, LN_TBL_HI, 65) = {
+__CLC_DECLARE_TABLE(double, LN_TBL_HI, 65) = {
0x0.0000000000000p+0, 0x1.61f807c79f3dbp-28, 0x1.873c1980267c8p-25,
0x1.ec65b9f88c69ep-26, 0x1.8022c54cc2f99p-26, 0x1.2c37a3a125330p-25,
0x1.15cad69737c93p-25, 0x1.d256ab1b285e9p-27, 0x1.b8abcb97a7aa2p-26,
@@ -695,14 +693,14 @@ DECLARE_TABLE(double, LN_TBL_HI, 65) = {
0x1.2482ceae1ac12p-26, 0x1.efa39ef35793cp-25,
};
-CLC_TABLE_FUNCTION(double, LN_TBL_HI, ln_tbl_hi);
+__CLC_TABLE_FUNCTION_VEC(double, LN_TBL_HI, ln_tbl_hi);
// Arrays atan_jby256_head and atan_jby256_tail contain leading and trailing
// parts respectively of precomputed values of atan(j/256), for j = 16, 17, ...,
// 256. atan_jby256_head contains the first 21 bits of precision, and
// atan_jby256_tail contains a further 53 bits precision.
-DECLARE_TABLE(double, ATAN_JBY256_TBL_HEAD, 241) = {
+__CLC_DECLARE_TABLE(double, ATAN_JBY256_TBL_HEAD, 241) = {
0x1.ff55b00000000p-5, 0x1.0f99e00000000p-4, 0x1.1f86d00000000p-4,
0x1.2f71900000000p-4, 0x1.3f59f00000000p-4, 0x1.4f3fd00000000p-4,
0x1.5f23200000000p-4, 0x1.6f03b00000000p-4, 0x1.7ee1800000000p-4,
@@ -786,9 +784,9 @@ DECLARE_TABLE(double, ATAN_JBY256_TBL_HEAD, 241) = {
0x1.921fb00000000p-1,
};
-CLC_TABLE_FUNCTION(double, ATAN_JBY256_TBL_HEAD, atan_jby256_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, ATAN_JBY256_TBL_HEAD, atan_jby256_tbl_head);
-DECLARE_TABLE(double, ATAN_JBY256_TBL_TAIL, 241) = {
+__CLC_DECLARE_TABLE(double, ATAN_JBY256_TBL_TAIL, 241) = {
0x1.6e59fbd38db2cp-26, 0x1.4e3aa54dedf96p-25, 0x1.7e105ab1bda88p-25,
0x1.8c5254d013fd0p-27, 0x1.cf8ab3ad62670p-29, 0x1.9dca4bec80468p-26,
0x1.3f4b5ec98a8dap-26, 0x1.b9d49619d81fep-25, 0x1.3017887460934p-27,
@@ -872,9 +870,9 @@ DECLARE_TABLE(double, ATAN_JBY256_TBL_TAIL, 241) = {
0x1.5110b4611a626p-23,
};
-CLC_TABLE_FUNCTION(double, ATAN_JBY256_TBL_TAIL, atan_jby256_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, ATAN_JBY256_TBL_TAIL, atan_jby256_tbl_tail);
-DECLARE_TABLE(double, LOG_F_INV_TBL_HEAD, 258) = {
+__CLC_DECLARE_TABLE(double, LOG_F_INV_TBL_HEAD, 258) = {
0x1.0000000000000p+1, 0x1.fe00000000000p+0, 0x1.fc00000000000p+0,
0x1.fa00000000000p+0, 0x1.f800000000000p+0, 0x1.f600000000000p+0,
0x1.f400000000000p+0, 0x1.f200000000000p+0, 0x1.f000000000000p+0,
@@ -963,9 +961,9 @@ DECLARE_TABLE(double, LOG_F_INV_TBL_HEAD, 258) = {
0x1.0000000000000p+0, 0x1.0000000000000p+0,
};
-CLC_TABLE_FUNCTION(double, LOG_F_INV_TBL_HEAD, log_f_inv_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, LOG_F_INV_TBL_HEAD, log_f_inv_tbl_head);
-DECLARE_TABLE(double, LOG_F_INV_TBL_TAIL, 258) = {
+__CLC_DECLARE_TABLE(double, LOG_F_INV_TBL_TAIL, 258) = {
0x0.0000000000000p+0, 0x1.fe01fe01fe020p-16, 0x1.fc07f01fc07f0p-14,
0x1.1caa01fa11caap-12, 0x1.f81f81f81f820p-12, 0x1.8856506ddaba6p-11,
0x1.196792909c560p-10, 0x1.7d9108c2ad433p-10, 0x1.f07c1f07c1f08p-10,
@@ -1054,9 +1052,9 @@ DECLARE_TABLE(double, LOG_F_INV_TBL_TAIL, 258) = {
0x1.0080402010080p-9, 0x0.0000000000000p+0,
};
-CLC_TABLE_FUNCTION(double, LOG_F_INV_TBL_TAIL, log_f_inv_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, LOG_F_INV_TBL_TAIL, log_f_inv_tbl_tail);
-DECLARE_TABLE(double, POWLOG_TBL_HEAD, 258) = {
+__CLC_DECLARE_TABLE(double, POWLOG_TBL_HEAD, 258) = {
0x0.0000000000000p+0, 0x1.ff00aa0000000p-9, 0x1.fe02a60000000p-8,
0x1.7dc4750000000p-7, 0x1.fc0a8b0000000p-7, 0x1.3cea440000000p-6,
0x1.7b91b00000000p-6, 0x1.b9fc020000000p-6, 0x1.f829b00000000p-6,
@@ -1145,9 +1143,9 @@ DECLARE_TABLE(double, POWLOG_TBL_HEAD, 258) = {
0x1.61e3ef0000000p-1, 0x1.62e42e0000000p-1, 0x0.0000000000000p+0,
};
-CLC_TABLE_FUNCTION(double, POWLOG_TBL_HEAD, powlog_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, POWLOG_TBL_HEAD, powlog_tbl_head);
-DECLARE_TABLE(double, POWLOG_TBL_TAIL, 258) = {
+__CLC_DECLARE_TABLE(double, POWLOG_TBL_TAIL, 258) = {
0x0.0000000000000p+0, 0x1.5885e0250435ap-36, 0x1.620cf11f86ed2p-33,
0x1.f0214edba4a25p-32, 0x1.f807c79f3db4ep-36, 0x1.a352ba779a52bp-33,
0x1.f56c46aa49fd5p-32, 0x1.ebe465fef5196p-32, 0x1.cf0660099f1f8p-31,
@@ -1236,9 +1234,9 @@ DECLARE_TABLE(double, POWLOG_TBL_TAIL, 258) = {
0x1.b48c8cd2f246cp-26, 0x1.efa39ef35793cp-25, 0x0.0000000000000p+0,
};
-CLC_TABLE_FUNCTION(double, POWLOG_TBL_TAIL, powlog_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, POWLOG_TBL_TAIL, powlog_tbl_tail);
-DECLARE_TABLE(double, TWO_TO_JBY64_EP_HEAD, 64) = {
+__CLC_DECLARE_TABLE(double, TWO_TO_JBY64_EP_HEAD, 64) = {
0x1.0000000000000p+0, 0x1.02c9a30000000p+0, 0x1.059b0d0000000p+0,
0x1.0874510000000p+0, 0x1.0b55860000000p+0, 0x1.0e3ec30000000p+0,
0x1.11301d0000000p+0, 0x1.1429aa0000000p+0, 0x1.172b830000000p+0,
@@ -1263,9 +1261,10 @@ DECLARE_TABLE(double, TWO_TO_JBY64_EP_HEAD, 64) = {
0x1.fa7c180000000p+0,
};
-CLC_TABLE_FUNCTION(double, TWO_TO_JBY64_EP_HEAD, two_to_jby64_ep_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, TWO_TO_JBY64_EP_HEAD,
+ two_to_jby64_ep_tbl_head);
-DECLARE_TABLE(double, TWO_TO_JBY64_EP_TAIL, 64) = {
+__CLC_DECLARE_TABLE(double, TWO_TO_JBY64_EP_TAIL, 64) = {
0x0.0000000000000p+0, 0x1.cef00c1dcdef9p-25, 0x1.8ac2ba1d73e2ap-27,
0x1.0eb37901186bep-25, 0x1.9f3121ec53172p-25, 0x1.69e8d10103a17p-27,
0x1.25b50a4ebbf1ap-32, 0x1.d525bbf668203p-25, 0x1.8faa2f5b9bef9p-25,
@@ -1290,9 +1289,10 @@ DECLARE_TABLE(double, TWO_TO_JBY64_EP_TAIL, 64) = {
0x1.9e90d82e90a7ep-28,
};
-CLC_TABLE_FUNCTION(double, TWO_TO_JBY64_EP_TAIL, two_to_jby64_ep_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, TWO_TO_JBY64_EP_TAIL,
+ two_to_jby64_ep_tbl_tail);
-DECLARE_TABLE(double, CBRT_INV_TBL, 257) = {
+__CLC_DECLARE_TABLE(double, CBRT_INV_TBL, 257) = {
0x1.0000000000000p+1, 0x1.fe01fe01fe020p+0, 0x1.fc07f01fc07f0p+0,
0x1.fa11caa01fa12p+0, 0x1.f81f81f81f820p+0, 0x1.f6310aca0dbb5p+0,
0x1.f44659e4a4271p+0, 0x1.f25f644230ab5p+0, 0x1.f07c1f07c1f08p+0,
@@ -1381,9 +1381,9 @@ DECLARE_TABLE(double, CBRT_INV_TBL, 257) = {
0x1.0080402010080p+0, 0x1.0000000000000p+0,
};
-CLC_TABLE_FUNCTION(double, CBRT_INV_TBL, cbrt_inv_tbl);
+__CLC_TABLE_FUNCTION_VEC(double, CBRT_INV_TBL, cbrt_inv_tbl);
-DECLARE_TABLE(double, CBRT_DBL_TBL_HEAD, 257) = {
+__CLC_DECLARE_TABLE(double, CBRT_DBL_TBL_HEAD, 257) = {
0x1.0000000000000p+0, 0x1.0055380000000p+0, 0x1.00aa390000000p+0,
0x1.00ff010000000p+0, 0x1.0153920000000p+0, 0x1.01a7eb0000000p+0,
0x1.01fc0d0000000p+0, 0x1.024ff80000000p+0, 0x1.02a3ad0000000p+0,
@@ -1472,9 +1472,9 @@ DECLARE_TABLE(double, CBRT_DBL_TBL_HEAD, 257) = {
0x1.4254640000000p+0, 0x1.428a2f0000000p+0,
};
-CLC_TABLE_FUNCTION(double, CBRT_DBL_TBL_HEAD, cbrt_dbl_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, CBRT_DBL_TBL_HEAD, cbrt_dbl_tbl_head);
-DECLARE_TABLE(double, CBRT_DBL_TBL_TAIL, 257) = {
+__CLC_DECLARE_TABLE(double, CBRT_DBL_TBL_TAIL, 257) = {
0x0.0000000000000p+0, 0x1.e6a24c81e4294p-25, 0x1.8548511e3a785p-26,
0x1.4eb9336ec07f6p-25, 0x1.0ea64b8b750e1p-27, 0x1.61637cff8a53cp-27,
0x1.0733bf7bd1943p-27, 0x1.666911345ccedp-26, 0x1.77b7a3f592f14p-27,
@@ -1563,23 +1563,23 @@ DECLARE_TABLE(double, CBRT_DBL_TBL_TAIL, 257) = {
0x1.dc43f1ed210b4p-25, 0x1.31ae515c447bbp-25,
};
-CLC_TABLE_FUNCTION(double, CBRT_DBL_TBL_TAIL, cbrt_dbl_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, CBRT_DBL_TBL_TAIL, cbrt_dbl_tbl_tail);
-DECLARE_TABLE(double, CBRT_REM_TBL_HEAD, 5) = {
+__CLC_DECLARE_TABLE(double, CBRT_REM_TBL_HEAD, 5) = {
0x1.428a2f0000000p-1, 0x1.965fea0000000p-1, 0x1.0000000000000p+0,
0x1.428a2f0000000p+0, 0x1.965fea0000000p+0,
};
-CLC_TABLE_FUNCTION(double, CBRT_REM_TBL_HEAD, cbrt_rem_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, CBRT_REM_TBL_HEAD, cbrt_rem_tbl_head);
-DECLARE_TABLE(double, CBRT_REM_TBL_TAIL, 5) = {
+__CLC_DECLARE_TABLE(double, CBRT_REM_TBL_TAIL, 5) = {
0x1.31ae515c447bbp-26, 0x1.4f5b8f20ac166p-27, 0x0.0000000000000p+0,
0x1.31ae515c447bbp-25, 0x1.4f5b8f20ac166p-26,
};
-CLC_TABLE_FUNCTION(double, CBRT_REM_TBL_TAIL, cbrt_rem_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, CBRT_REM_TBL_TAIL, cbrt_rem_tbl_tail);
-DECLARE_TABLE(double, SINH_TBL_HEAD, 37) = {
+__CLC_DECLARE_TABLE(double, SINH_TBL_HEAD, 37) = {
0x0.0000000000000p+0, 0x1.2cd9fc0000000p+0, 0x1.d03cf60000000p+1,
0x1.40926e0000000p+3, 0x1.b4a3800000000p+4, 0x1.28d0160000000p+6,
0x1.936d228000000p+7, 0x1.1228768000000p+9, 0x1.749ea50000000p+10,
@@ -1595,7 +1595,7 @@ DECLARE_TABLE(double, SINH_TBL_HEAD, 37) = {
0x1.ea215a0000000p+50,
};
-DECLARE_TABLE(double, SINH_TBL_TAIL, 37) = {
+__CLC_DECLARE_TABLE(double, SINH_TBL_TAIL, 37) = {
0x0.0000000000000p+0, 0x1.13ae6096a0092p-26, 0x1.db70cfb79a640p-26,
0x1.c2526b66dc067p-23, 0x1.b81b18647f380p-23, 0x1.bc1cdd1e1eb08p-20,
0x1.d9f201534fb09p-19, 0x1.d1c064a4e9954p-18, 0x1.4eca65d06ea74p-18,
@@ -1611,7 +1611,7 @@ DECLARE_TABLE(double, SINH_TBL_TAIL, 37) = {
0x1.d20d76744835cp+22,
};
-DECLARE_TABLE(double, COSH_TBL_HEAD, 37) = {
+__CLC_DECLARE_TABLE(double, COSH_TBL_HEAD, 37) = {
0x1.0000000000000p+0, 0x1.8b07550000000p+0, 0x1.e18fa08000000p+1,
0x1.422a490000000p+3, 0x1.b4ee858000000p+4, 0x1.28d6fc8000000p+6,
0x1.936e678000000p+7, 0x1.1228948000000p+9, 0x1.749eaa8000000p+10,
@@ -1627,7 +1627,7 @@ DECLARE_TABLE(double, COSH_TBL_HEAD, 37) = {
0x1.ea215a0000000p+50,
};
-DECLARE_TABLE(double, COSH_TBL_TAIL, 37) = {
+__CLC_DECLARE_TABLE(double, COSH_TBL_TAIL, 37) = {
0x0.0000000000000p+0, 0x1.d9f5504c2bd28p-28, 0x1.7cb66f0a4c9fdp-25,
0x1.f58617928e588p-23, 0x1.bc7d000c38d48p-25, 0x1.f7f9d4e329998p-21,
0x1.6e6e464885269p-19, 0x1.ba3a8b946c154p-19, 0x1.3f4e76110d5a4p-18,
@@ -1643,12 +1643,12 @@ DECLARE_TABLE(double, COSH_TBL_TAIL, 37) = {
0x1.d20d76744835cp+22,
};
-CLC_TABLE_FUNCTION(double, SINH_TBL_HEAD, sinh_tbl_head);
-CLC_TABLE_FUNCTION(double, SINH_TBL_TAIL, sinh_tbl_tail);
-CLC_TABLE_FUNCTION(double, COSH_TBL_HEAD, cosh_tbl_head);
-CLC_TABLE_FUNCTION(double, COSH_TBL_TAIL, cosh_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, SINH_TBL_HEAD, sinh_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, SINH_TBL_TAIL, sinh_tbl_tail);
+__CLC_TABLE_FUNCTION_VEC(double, COSH_TBL_HEAD, cosh_tbl_head);
+__CLC_TABLE_FUNCTION_VEC(double, COSH_TBL_TAIL, cosh_tbl_tail);
-DECLARE_TABLE(uchar, PIBITS_TBL, ) = {
+__CLC_DECLARE_TABLE(uchar, PIBITS_TBL, ) = {
224, 241, 27, 193, 12, 88, 33, 116, 53, 126, 196, 126, 237, 175, 169,
75, 74, 41, 222, 231, 28, 244, 236, 197, 151, 175, 31, 235, 158, 212,
181, 168, 127, 121, 154, 253, 24, 61, 221, 38, 44, 159, 60, 251, 217,
@@ -1661,25 +1661,25 @@ DECLARE_TABLE(uchar, PIBITS_TBL, ) = {
119, 211, 212, 71, 95, 157, 240, 167, 84, 16, 57, 185, 13, 230, 139,
2, 0, 0, 0, 0, 0, 0, 0};
-_CLC_DEF _CLC_OVERLOAD ulong TABLE_MANGLE(pibits_tbl)(int idx) {
+_CLC_DEF _CLC_OVERLOAD ulong __CLC_TABLE_MANGLE(pibits_tbl)(int idx) {
return *(__constant ulong *)(PIBITS_TBL + idx);
}
-_CLC_DEF _CLC_OVERLOAD ulong2 TABLE_MANGLE(pibits_tbl)(int2 idx) {
+_CLC_DEF _CLC_OVERLOAD ulong2 __CLC_TABLE_MANGLE(pibits_tbl)(int2 idx) {
return (ulong2){*(__constant ulong *)(PIBITS_TBL + idx.s0),
*(__constant ulong *)(PIBITS_TBL + idx.s1)};
}
-_CLC_DEF _CLC_OVERLOAD ulong3 TABLE_MANGLE(pibits_tbl)(int3 idx) {
+_CLC_DEF _CLC_OVERLOAD ulong3 __CLC_TABLE_MANGLE(pibits_tbl)(int3 idx) {
return (ulong3){*(__constant ulong *)(PIBITS_TBL + idx.s0),
*(__constant ulong *)(PIBITS_TBL + idx.s1),
*(__constant ulong *)(PIBITS_TBL + idx.s2)};
}
-_CLC_DEF _CLC_OVERLOAD ulong4 TABLE_MANGLE(pibits_tbl)(int4 idx) {
+_CLC_DEF _CLC_OVERLOAD ulong4 __CLC_TABLE_MANGLE(pibits_tbl)(int4 idx) {
return (ulong4){*(__constant ulong *)(PIBITS_TBL + idx.s0),
*(__constant ulong *)(PIBITS_TBL + idx.s1),
*(__constant ulong *)(PIBITS_TBL + idx.s2),
*(__constant ulong *)(PIBITS_TBL + idx.s3)};
}
-_CLC_DEF _CLC_OVERLOAD ulong8 TABLE_MANGLE(pibits_tbl)(int8 idx) {
+_CLC_DEF _CLC_OVERLOAD ulong8 __CLC_TABLE_MANGLE(pibits_tbl)(int8 idx) {
return (ulong8){*(__constant ulong *)(PIBITS_TBL + idx.s0),
*(__constant ulong *)(PIBITS_TBL + idx.s1),
*(__constant ulong *)(PIBITS_TBL + idx.s2),
@@ -1689,7 +1689,7 @@ _CLC_DEF _CLC_OVERLOAD ulong8 TABLE_MANGLE(pibits_tbl)(int8 idx) {
*(__constant ulong *)(PIBITS_TBL + idx.s6),
*(__constant ulong *)(PIBITS_TBL + idx.s7)};
}
-_CLC_DEF _CLC_OVERLOAD ulong16 TABLE_MANGLE(pibits_tbl)(int16 idx) {
+_CLC_DEF _CLC_OVERLOAD ulong16 __CLC_TABLE_MANGLE(pibits_tbl)(int16 idx) {
return (ulong16){*(__constant ulong *)(PIBITS_TBL + idx.s0),
*(__constant ulong *)(PIBITS_TBL + idx.s1),
*(__constant ulong *)(PIBITS_TBL + idx.s2),
diff --git a/libclc/clc/lib/generic/math/clc_tgamma.cl b/libclc/clc/lib/generic/math/clc_tgamma.cl
index 83b09cc33ecc2..c379cd16b5a62 100644
--- a/libclc/clc/lib/generic/math/clc_tgamma.cl
+++ b/libclc/clc/lib/generic/math/clc_tgamma.cl
@@ -65,6 +65,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_tgamma(half x) {
#endif
-#define FUNCTION __clc_tgamma
+#define __CLC_FUNCTION __clc_tgamma
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/math/clc_trunc.cl b/libclc/clc/lib/generic/math/clc_trunc.cl
index 6261d04cd26de..d9c54a1888d94 100644
--- a/libclc/clc/lib/generic/math/clc_trunc.cl
+++ b/libclc/clc/lib/generic/math/clc_trunc.cl
@@ -8,8 +8,8 @@
#include <clc/internal/clc.h>
-#define FUNCTION __clc_trunc
-#define __IMPL_FUNCTION(x) __builtin_elementwise_trunc
+#define __CLC_FUNCTION __clc_trunc
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_trunc
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/generic/relational/clc_bitselect.cl b/libclc/clc/lib/generic/relational/clc_bitselect.cl
index 2976b8947e544..9c6e82e6be4be 100644
--- a/libclc/clc/lib/generic/relational/clc_bitselect.cl
+++ b/libclc/clc/lib/generic/relational/clc_bitselect.cl
@@ -12,7 +12,7 @@
#define __CLC_BODY <clc_bitselect.inc>
#include <clc/integer/gentype.inc>
-#define FLOAT_BITSELECT(f_type, i_type, width) \
+#define __CLC_FLOAT_BITSELECT(f_type, i_type, width) \
_CLC_OVERLOAD _CLC_DEF f_type##width __clc_bitselect( \
f_type##width x, f_type##width y, f_type##width z) { \
return __clc_as_##f_type##width(__clc_bitselect( \
@@ -20,33 +20,33 @@
__clc_as_##i_type##width(z))); \
}
-FLOAT_BITSELECT(float, uint, )
-FLOAT_BITSELECT(float, uint, 2)
-FLOAT_BITSELECT(float, uint, 3)
-FLOAT_BITSELECT(float, uint, 4)
-FLOAT_BITSELECT(float, uint, 8)
-FLOAT_BITSELECT(float, uint, 16)
+__CLC_FLOAT_BITSELECT(float, uint, )
+__CLC_FLOAT_BITSELECT(float, uint, 2)
+__CLC_FLOAT_BITSELECT(float, uint, 3)
+__CLC_FLOAT_BITSELECT(float, uint, 4)
+__CLC_FLOAT_BITSELECT(float, uint, 8)
+__CLC_FLOAT_BITSELECT(float, uint, 16)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-FLOAT_BITSELECT(double, ulong, )
-FLOAT_BITSELECT(double, ulong, 2)
-FLOAT_BITSELECT(double, ulong, 3)
-FLOAT_BITSELECT(double, ulong, 4)
-FLOAT_BITSELECT(double, ulong, 8)
-FLOAT_BITSELECT(double, ulong, 16)
+__CLC_FLOAT_BITSELECT(double, ulong, )
+__CLC_FLOAT_BITSELECT(double, ulong, 2)
+__CLC_FLOAT_BITSELECT(double, ulong, 3)
+__CLC_FLOAT_BITSELECT(double, ulong, 4)
+__CLC_FLOAT_BITSELECT(double, ulong, 8)
+__CLC_FLOAT_BITSELECT(double, ulong, 16)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-FLOAT_BITSELECT(half, ushort, )
-FLOAT_BITSELECT(half, ushort, 2)
-FLOAT_BITSELECT(half, ushort, 3)
-FLOAT_BITSELECT(half, ushort, 4)
-FLOAT_BITSELECT(half, ushort, 8)
-FLOAT_BITSELECT(half, ushort, 16)
+__CLC_FLOAT_BITSELECT(half, ushort, )
+__CLC_FLOAT_BITSELECT(half, ushort, 2)
+__CLC_FLOAT_BITSELECT(half, ushort, 3)
+__CLC_FLOAT_BITSELECT(half, ushort, 4)
+__CLC_FLOAT_BITSELECT(half, ushort, 8)
+__CLC_FLOAT_BITSELECT(half, ushort, 16)
#endif
diff --git a/libclc/clc/lib/generic/relational/clc_signbit.cl b/libclc/clc/lib/generic/relational/clc_signbit.cl
index d8736a72b394f..cb7000ddb0757 100644
--- a/libclc/clc/lib/generic/relational/clc_signbit.cl
+++ b/libclc/clc/lib/generic/relational/clc_signbit.cl
@@ -9,50 +9,54 @@
#include <clc/internal/clc.h>
#include <clc/relational/relational.h>
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
- return (RET_TYPE)((RET_TYPE){FUNCTION(x.lo), FUNCTION(x.hi)} != \
- (RET_TYPE)0); \
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE, __CLC_FUNCTION, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
+ return (RET_TYPE)((RET_TYPE){__CLC_FUNCTION(x.lo), \
+ __CLC_FUNCTION(x.hi)} != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
- return (RET_TYPE)((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), \
- FUNCTION(x.s2)} != (RET_TYPE)0); \
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE, __CLC_FUNCTION, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
+ return (RET_TYPE)((RET_TYPE){__CLC_FUNCTION(x.s0), __CLC_FUNCTION(x.s1), \
+ __CLC_FUNCTION(x.s2)} != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
- return (RET_TYPE)((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), \
- FUNCTION(x.s2), \
- FUNCTION(x.s3)} != (RET_TYPE)0); \
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE, __CLC_FUNCTION, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
+ return (RET_TYPE)((RET_TYPE){__CLC_FUNCTION(x.s0), __CLC_FUNCTION(x.s1), \
+ __CLC_FUNCTION(x.s2), \
+ __CLC_FUNCTION(x.s3)} != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
- return ( \
- RET_TYPE)((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), \
- FUNCTION(x.s3), FUNCTION(x.s4), FUNCTION(x.s5), \
- FUNCTION(x.s6), FUNCTION(x.s7)} != (RET_TYPE)0); \
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE, __CLC_FUNCTION, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
+ return (RET_TYPE)((RET_TYPE){__CLC_FUNCTION(x.s0), __CLC_FUNCTION(x.s1), \
+ __CLC_FUNCTION(x.s2), __CLC_FUNCTION(x.s3), \
+ __CLC_FUNCTION(x.s4), __CLC_FUNCTION(x.s5), \
+ __CLC_FUNCTION(x.s6), \
+ __CLC_FUNCTION(x.s7)} != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \
- return ( \
- RET_TYPE)((RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), \
- FUNCTION(x.s3), FUNCTION(x.s4), FUNCTION(x.s5), \
- FUNCTION(x.s6), FUNCTION(x.s7), FUNCTION(x.s8), \
- FUNCTION(x.s9), FUNCTION(x.sa), FUNCTION(x.sb), \
- FUNCTION(x.sc), FUNCTION(x.sd), FUNCTION(x.se), \
- FUNCTION(x.sf)} != (RET_TYPE)0); \
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE, __CLC_FUNCTION, ARG_TYPE) \
+ _CLC_DEF _CLC_OVERLOAD RET_TYPE __CLC_FUNCTION(ARG_TYPE x) { \
+ return (RET_TYPE)((RET_TYPE){__CLC_FUNCTION(x.s0), __CLC_FUNCTION(x.s1), \
+ __CLC_FUNCTION(x.s2), __CLC_FUNCTION(x.s3), \
+ __CLC_FUNCTION(x.s4), __CLC_FUNCTION(x.s5), \
+ __CLC_FUNCTION(x.s6), __CLC_FUNCTION(x.s7), \
+ __CLC_FUNCTION(x.s8), __CLC_FUNCTION(x.s9), \
+ __CLC_FUNCTION(x.sa), __CLC_FUNCTION(x.sb), \
+ __CLC_FUNCTION(x.sc), __CLC_FUNCTION(x.sd), \
+ __CLC_FUNCTION(x.se), \
+ __CLC_FUNCTION(x.sf)} != (RET_TYPE)0); \
}
-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, FUNCTION, ARG_TYPE) \
- _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE##2, FUNCTION, ARG_TYPE##2) \
- _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE##3, FUNCTION, ARG_TYPE##3) \
- _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE##4, FUNCTION, ARG_TYPE##4) \
- _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE##8, FUNCTION, ARG_TYPE##8) \
- _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE##16, FUNCTION, ARG_TYPE##16)
+#define _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, __CLC_FUNCTION, \
+ ARG_TYPE) \
+ _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE##2, __CLC_FUNCTION, ARG_TYPE##2) \
+ _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE##3, __CLC_FUNCTION, ARG_TYPE##3) \
+ _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE##4, __CLC_FUNCTION, ARG_TYPE##4) \
+ _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE##8, __CLC_FUNCTION, ARG_TYPE##8) \
+ _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE##16, __CLC_FUNCTION, ARG_TYPE##16)
_CLC_DEF _CLC_OVERLOAD int __clc_signbit(float x) {
return __builtin_signbitf(x);
diff --git a/libclc/clc/lib/generic/shared/clc_vload.cl b/libclc/clc/lib/generic/shared/clc_vload.cl
index e4003e4a96736..5942f10d2de5b 100644
--- a/libclc/clc/lib/generic/shared/clc_vload.cl
+++ b/libclc/clc/lib/generic/shared/clc_vload.cl
@@ -9,7 +9,7 @@
#include <clc/internal/clc.h>
#include <clc/shared/clc_vload.h>
-#define VLOAD_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \
+#define __CLC_VLOAD_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \
_CLC_OVERLOAD _CLC_DEF PRIM_TYPE##2 __clc_vload2( \
size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \
return *( \
@@ -42,89 +42,89 @@
}
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-#define VLOAD_VECTORIZE_GENERIC VLOAD_VECTORIZE
+#define __CLC_VLOAD_VECTORIZE_GENERIC __CLC_VLOAD_VECTORIZE
#else
// The generic address space isn't available, so make the macro do nothing
-#define VLOAD_VECTORIZE_GENERIC(X, Y)
+#define __CLC_VLOAD_VECTORIZE_GENERIC(X, Y)
#endif
-#define VLOAD_ADDR_SPACES(__CLC_SCALAR_GENTYPE) \
- VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __private) \
- VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __local) \
- VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __constant) \
- VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __global) \
- VLOAD_VECTORIZE_GENERIC(__CLC_SCALAR_GENTYPE, __generic)
+#define __CLC_VLOAD_ADDR_SPACES(__CLC_SCALAR_GENTYPE) \
+ __CLC_VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __private) \
+ __CLC_VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __local) \
+ __CLC_VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __constant) \
+ __CLC_VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __global) \
+ __CLC_VLOAD_VECTORIZE_GENERIC(__CLC_SCALAR_GENTYPE, __generic)
-#define VLOAD_TYPES() \
- VLOAD_ADDR_SPACES(char) \
- VLOAD_ADDR_SPACES(uchar) \
- VLOAD_ADDR_SPACES(short) \
- VLOAD_ADDR_SPACES(ushort) \
- VLOAD_ADDR_SPACES(int) \
- VLOAD_ADDR_SPACES(uint) \
- VLOAD_ADDR_SPACES(long) \
- VLOAD_ADDR_SPACES(ulong) \
- VLOAD_ADDR_SPACES(float)
+#define __CLC_VLOAD_TYPES() \
+ __CLC_VLOAD_ADDR_SPACES(char) \
+ __CLC_VLOAD_ADDR_SPACES(uchar) \
+ __CLC_VLOAD_ADDR_SPACES(short) \
+ __CLC_VLOAD_ADDR_SPACES(ushort) \
+ __CLC_VLOAD_ADDR_SPACES(int) \
+ __CLC_VLOAD_ADDR_SPACES(uint) \
+ __CLC_VLOAD_ADDR_SPACES(long) \
+ __CLC_VLOAD_ADDR_SPACES(ulong) \
+ __CLC_VLOAD_ADDR_SPACES(float)
-VLOAD_TYPES()
+__CLC_VLOAD_TYPES()
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-VLOAD_ADDR_SPACES(double)
+__CLC_VLOAD_ADDR_SPACES(double)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-VLOAD_ADDR_SPACES(half)
+__CLC_VLOAD_ADDR_SPACES(half)
#endif
/* vload_half are legal even without cl_khr_fp16 */
/* no vload_half for double */
-#define VEC_LOAD1(val, AS) val = __builtin_load_halff(&mem[offset++]);
-#define VEC_LOAD2(val, AS) \
- VEC_LOAD1(val.lo, AS) \
- VEC_LOAD1(val.hi, AS)
-#define VEC_LOAD3(val, AS) \
- VEC_LOAD1(val.s0, AS) \
- VEC_LOAD1(val.s1, AS) \
- VEC_LOAD1(val.s2, AS)
-#define VEC_LOAD4(val, AS) \
- VEC_LOAD2(val.lo, AS) \
- VEC_LOAD2(val.hi, AS)
-#define VEC_LOAD8(val, AS) \
- VEC_LOAD4(val.lo, AS) \
- VEC_LOAD4(val.hi, AS)
-#define VEC_LOAD16(val, AS) \
- VEC_LOAD8(val.lo, AS) \
- VEC_LOAD8(val.hi, AS)
+#define __CLC_VEC_LOAD1(val, AS) val = __builtin_load_halff(&mem[offset++]);
+#define __CLC_VEC_LOAD2(val, AS) \
+ __CLC_VEC_LOAD1(val.lo, AS) \
+ __CLC_VEC_LOAD1(val.hi, AS)
+#define __CLC_VEC_LOAD3(val, AS) \
+ __CLC_VEC_LOAD1(val.s0, AS) \
+ __CLC_VEC_LOAD1(val.s1, AS) \
+ __CLC_VEC_LOAD1(val.s2, AS)
+#define __CLC_VEC_LOAD4(val, AS) \
+ __CLC_VEC_LOAD2(val.lo, AS) \
+ __CLC_VEC_LOAD2(val.hi, AS)
+#define __CLC_VEC_LOAD8(val, AS) \
+ __CLC_VEC_LOAD4(val.lo, AS) \
+ __CLC_VEC_LOAD4(val.hi, AS)
+#define __CLC_VEC_LOAD16(val, AS) \
+ __CLC_VEC_LOAD8(val.lo, AS) \
+ __CLC_VEC_LOAD8(val.hi, AS)
-#define __FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \
+#define __CLC_FUNC_IMPL(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE __clc_vload_half##SUFFIX(size_t offset, \
const AS half *mem) { \
offset *= VEC_SIZE; \
TYPE __tmp; \
- VEC_LOAD##VEC_SIZE(__tmp, AS) return __tmp; \
+ __CLC_VEC_LOAD##VEC_SIZE(__tmp, AS) return __tmp; \
} \
_CLC_OVERLOAD _CLC_DEF TYPE __clc_vloada_half##SUFFIX(size_t offset, \
const AS half *mem) { \
offset *= OFFSET_SIZE; \
TYPE __tmp; \
- VEC_LOAD##VEC_SIZE(__tmp, AS) return __tmp; \
+ __CLC_VEC_LOAD##VEC_SIZE(__tmp, AS) return __tmp; \
}
-#define FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \
- __FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS)
+#define __CLC_FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \
+ __CLC_FUNC_IMPL(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS)
#define __CLC_BODY "clc_vload_half.inc"
#include <clc/math/gentype.inc>
-#undef FUNC
-#undef __FUNC
-#undef VEC_LOAD16
-#undef VEC_LOAD8
-#undef VEC_LOAD4
-#undef VEC_LOAD3
-#undef VEC_LOAD2
-#undef VEC_LOAD1
-#undef VLOAD_TYPES
-#undef VLOAD_ADDR_SPACES
-#undef VLOAD_VECTORIZE
-#undef VLOAD_VECTORIZE_GENERIC
+#undef __CLC_FUNC
+#undef __CLC_FUNC_IMPL
+#undef __CLC_VEC_LOAD16
+#undef __CLC_VEC_LOAD8
+#undef __CLC_VEC_LOAD4
+#undef __CLC_VEC_LOAD3
+#undef __CLC_VEC_LOAD2
+#undef __CLC_VEC_LOAD1
+#undef __CLC_VLOAD_TYPES
+#undef __CLC_VLOAD_ADDR_SPACES
+#undef __CLC_VLOAD_VECTORIZE
+#undef __CLC_VLOAD_VECTORIZE_GENERIC
diff --git a/libclc/clc/lib/generic/shared/clc_vload_half.inc b/libclc/clc/lib/generic/shared/clc_vload_half.inc
index aaf067d75daac..2d5fdb357b0af 100644
--- a/libclc/clc/lib/generic/shared/clc_vload_half.inc
+++ b/libclc/clc/lib/generic/shared/clc_vload_half.inc
@@ -16,22 +16,25 @@
#define __CLC_OFFSET __CLC_VECSIZE
#endif
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __constant);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE,
+ __private);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE,
+ __constant);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __generic);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE,
+ __generic);
#endif
#undef __CLC_OFFSET
#else
-FUNC(, 1, 1, __CLC_GENTYPE, __private);
-FUNC(, 1, 1, __CLC_GENTYPE, __local);
-FUNC(, 1, 1, __CLC_GENTYPE, __global);
-FUNC(, 1, 1, __CLC_GENTYPE, __constant);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __private);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __local);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __global);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __constant);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(, 1, 1, __CLC_GENTYPE, __generic);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __generic);
#endif
#endif
#endif
diff --git a/libclc/clc/lib/generic/shared/clc_vstore.cl b/libclc/clc/lib/generic/shared/clc_vstore.cl
index adde58aec9153..ac96927395120 100644
--- a/libclc/clc/lib/generic/shared/clc_vstore.cl
+++ b/libclc/clc/lib/generic/shared/clc_vstore.cl
@@ -17,7 +17,7 @@
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
-#define VSTORE_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \
+#define __CLC_VSTORE_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \
typedef PRIM_TYPE##2 less_aligned_##ADDR_SPACE##PRIM_TYPE##2 \
__attribute__((aligned(sizeof(PRIM_TYPE)))); \
_CLC_OVERLOAD _CLC_DEF void __clc_vstore2(PRIM_TYPE##2 vec, size_t offset, \
@@ -58,67 +58,68 @@
}
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-#define VSTORE_VECTORIZE_GENERIC VSTORE_VECTORIZE
+#define __CLC_VSTORE_VECTORIZE_GENERIC __CLC_VSTORE_VECTORIZE
#else
// The generic address space isn't available, so make the macro do nothing
-#define VSTORE_VECTORIZE_GENERIC(X, Y)
+#define __CLC_VSTORE_VECTORIZE_GENERIC(X, Y)
#endif
-#define VSTORE_ADDR_SPACES(__CLC_SCALAR___CLC_GENTYPE) \
- VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __private) \
- VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __local) \
- VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __global) \
- VSTORE_VECTORIZE_GENERIC(__CLC_SCALAR___CLC_GENTYPE, __generic)
+#define __CLC_VSTORE_ADDR_SPACES(__CLC_SCALAR___CLC_GENTYPE) \
+ __CLC_VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __private) \
+ __CLC_VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __local) \
+ __CLC_VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __global) \
+ __CLC_VSTORE_VECTORIZE_GENERIC(__CLC_SCALAR___CLC_GENTYPE, __generic)
-VSTORE_ADDR_SPACES(char)
-VSTORE_ADDR_SPACES(uchar)
-VSTORE_ADDR_SPACES(short)
-VSTORE_ADDR_SPACES(ushort)
-VSTORE_ADDR_SPACES(int)
-VSTORE_ADDR_SPACES(uint)
-VSTORE_ADDR_SPACES(long)
-VSTORE_ADDR_SPACES(ulong)
-VSTORE_ADDR_SPACES(float)
+__CLC_VSTORE_ADDR_SPACES(char)
+__CLC_VSTORE_ADDR_SPACES(uchar)
+__CLC_VSTORE_ADDR_SPACES(short)
+__CLC_VSTORE_ADDR_SPACES(ushort)
+__CLC_VSTORE_ADDR_SPACES(int)
+__CLC_VSTORE_ADDR_SPACES(uint)
+__CLC_VSTORE_ADDR_SPACES(long)
+__CLC_VSTORE_ADDR_SPACES(ulong)
+__CLC_VSTORE_ADDR_SPACES(float)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-VSTORE_ADDR_SPACES(double)
+__CLC_VSTORE_ADDR_SPACES(double)
#endif
#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-VSTORE_ADDR_SPACES(half)
+__CLC_VSTORE_ADDR_SPACES(half)
#endif
-#define VEC_STORE1(val, ROUNDF, BUILTIN) BUILTIN(ROUNDF(val), &mem[offset++]);
+#define __CLC_VEC_STORE1(val, ROUNDF, BUILTIN) \
+ BUILTIN(ROUNDF(val), &mem[offset++]);
-#define VEC_STORE2(val, ROUNDF, BUILTIN) \
- VEC_STORE1(val.lo, ROUNDF, BUILTIN) \
- VEC_STORE1(val.hi, ROUNDF, BUILTIN)
-#define VEC_STORE3(val, ROUNDF, BUILTIN) \
- VEC_STORE1(val.s0, ROUNDF, BUILTIN) \
- VEC_STORE1(val.s1, ROUNDF, BUILTIN) \
- VEC_STORE1(val.s2, ROUNDF, BUILTIN)
-#define VEC_STORE4(val, ROUNDF, BUILTIN) \
- VEC_STORE2(val.lo, ROUNDF, BUILTIN) \
- VEC_STORE2(val.hi, ROUNDF, BUILTIN)
-#define VEC_STORE8(val, ROUNDF, BUILTIN) \
- VEC_STORE4(val.lo, ROUNDF, BUILTIN) \
- VEC_STORE4(val.hi, ROUNDF, BUILTIN)
-#define VEC_STORE16(val, ROUNDF, BUILTIN) \
- VEC_STORE8(val.lo, ROUNDF, BUILTIN) \
- VEC_STORE8(val.hi, ROUNDF, BUILTIN)
+#define __CLC_VEC_STORE2(val, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE1(val.lo, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE1(val.hi, ROUNDF, BUILTIN)
+#define __CLC_VEC_STORE3(val, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE1(val.s0, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE1(val.s1, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE1(val.s2, ROUNDF, BUILTIN)
+#define __CLC_VEC_STORE4(val, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE2(val.lo, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE2(val.hi, ROUNDF, BUILTIN)
+#define __CLC_VEC_STORE8(val, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE4(val.lo, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE4(val.hi, ROUNDF, BUILTIN)
+#define __CLC_VEC_STORE16(val, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE8(val.lo, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE8(val.hi, ROUNDF, BUILTIN)
-#define __FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, ROUNDF, BUILTIN) \
+#define __CLC_XFUNC_IMPL(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, ROUNDF, BUILTIN) \
_CLC_OVERLOAD _CLC_DEF void __clc_vstore_half##SUFFIX( \
TYPE vec, size_t offset, AS half *mem) { \
offset *= VEC_SIZE; \
- VEC_STORE##VEC_SIZE(vec, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE##VEC_SIZE(vec, ROUNDF, BUILTIN) \
} \
_CLC_OVERLOAD _CLC_DEF void __clc_vstorea_half##SUFFIX( \
TYPE vec, size_t offset, AS half *mem) { \
offset *= OFFSET; \
- VEC_STORE##VEC_SIZE(vec, ROUNDF, BUILTIN) \
+ __CLC_VEC_STORE##VEC_SIZE(vec, ROUNDF, BUILTIN) \
}
_CLC_DEF _CLC_OVERLOAD float __clc_noop(float x) { return x; }
@@ -241,28 +242,30 @@ _CLC_DEF _CLC_OVERLOAD double __clc_rte(double x) {
}
#endif
-#define __XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN) \
- __FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, __clc_noop, BUILTIN) \
- __FUNC(SUFFIX##_rtz, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtz, BUILTIN) \
- __FUNC(SUFFIX##_rtn, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtn, BUILTIN) \
- __FUNC(SUFFIX##_rtp, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtp, BUILTIN) \
- __FUNC(SUFFIX##_rte, VEC_SIZE, OFFSET, TYPE, AS, __clc_rte, BUILTIN)
+#define __CLC_XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN) \
+ __CLC_XFUNC_IMPL(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, __clc_noop, BUILTIN) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtz, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtz, \
+ BUILTIN) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtn, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtn, \
+ BUILTIN) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtp, VEC_SIZE, OFFSET, TYPE, AS, __clc_rtp, \
+ BUILTIN) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rte, VEC_SIZE, OFFSET, TYPE, AS, __clc_rte, BUILTIN)
-#define FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN) \
- __XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN)
+#define __CLC_FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN) \
+ __CLC_XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, AS, BUILTIN)
#define __CLC_BODY "clc_vstore_half.inc"
#include <clc/math/gentype.inc>
-#undef FUNC
-#undef __XFUNC
-#undef __FUNC
-#undef VEC_LOAD16
-#undef VEC_LOAD8
-#undef VEC_LOAD4
-#undef VEC_LOAD3
-#undef VEC_LOAD2
-#undef VEC_LOAD1
-#undef DECLARE_HELPER
-#undef VSTORE_ADDR_SPACES
-#undef VSTORE_VECTORIZE
-#undef VSTORE_VECTORIZE_GENERIC
+#undef __CLC_FUNC
+#undef __CLC_XFUNC
+#undef __CLC_XFUNC_IMPL
+#undef __CLC_VEC_STORE16
+#undef __CLC_VEC_STORE8
+#undef __CLC_VEC_STORE4
+#undef __CLC_VEC_STORE3
+#undef __CLC_VEC_STORE2
+#undef __CLC_VEC_STORE1
+#undef __CLC_VSTORE_ADDR_SPACES
+#undef __CLC_VSTORE_VECTORIZE
+#undef __CLC_VSTORE_VECTORIZE_GENERIC
diff --git a/libclc/clc/lib/generic/shared/clc_vstore_half.inc b/libclc/clc/lib/generic/shared/clc_vstore_half.inc
index 02d645357f853..9188f96e29691 100644
--- a/libclc/clc/lib/generic/shared/clc_vstore_half.inc
+++ b/libclc/clc/lib/generic/shared/clc_vstore_half.inc
@@ -25,24 +25,24 @@
#define __CLC_OFFSET __CLC_VECSIZE
#endif
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private,
- STORE_HALF_BUILTIN);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local,
- STORE_HALF_BUILTIN);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global,
- STORE_HALF_BUILTIN);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private,
+ STORE_HALF_BUILTIN);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local,
+ STORE_HALF_BUILTIN);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global,
+ STORE_HALF_BUILTIN);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __generic,
- STORE_HALF_BUILTIN);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __generic,
+ STORE_HALF_BUILTIN);
#endif
#undef __CLC_OFFSET
#else
-FUNC(, 1, 1, __CLC_GENTYPE, __private, STORE_HALF_BUILTIN);
-FUNC(, 1, 1, __CLC_GENTYPE, __local, STORE_HALF_BUILTIN);
-FUNC(, 1, 1, __CLC_GENTYPE, __global, STORE_HALF_BUILTIN);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __private, STORE_HALF_BUILTIN);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __local, STORE_HALF_BUILTIN);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __global, STORE_HALF_BUILTIN);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(, 1, 1, __CLC_GENTYPE, __generic, STORE_HALF_BUILTIN);
+__CLC_FUNC(, 1, 1, __CLC_GENTYPE, __generic, STORE_HALF_BUILTIN);
#endif
#endif
diff --git a/libclc/clc/lib/ptx-nvidiacl/math/clc_log.cl b/libclc/clc/lib/ptx-nvidiacl/math/clc_log.cl
index 9c2778bfd1a7b..4ccdfaf4e3fc9 100644
--- a/libclc/clc/lib/ptx-nvidiacl/math/clc_log.cl
+++ b/libclc/clc/lib/ptx-nvidiacl/math/clc_log.cl
@@ -29,6 +29,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_log(half x) {
#endif
-#define FUNCTION __clc_log
+#define __CLC_FUNCTION __clc_log
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/ptx-nvidiacl/math/clc_rsqrt.cl b/libclc/clc/lib/ptx-nvidiacl/math/clc_rsqrt.cl
index beea123180c5f..786d57046728d 100644
--- a/libclc/clc/lib/ptx-nvidiacl/math/clc_rsqrt.cl
+++ b/libclc/clc/lib/ptx-nvidiacl/math/clc_rsqrt.cl
@@ -29,6 +29,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_rsqrt(half x) {
#endif
-#define FUNCTION __clc_rsqrt
+#define __CLC_FUNCTION __clc_rsqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/ptx-nvidiacl/math/clc_sinpi.cl b/libclc/clc/lib/ptx-nvidiacl/math/clc_sinpi.cl
index 40903ba58b840..78f7038b26443 100644
--- a/libclc/clc/lib/ptx-nvidiacl/math/clc_sinpi.cl
+++ b/libclc/clc/lib/ptx-nvidiacl/math/clc_sinpi.cl
@@ -29,6 +29,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_sinpi(half x) {
#endif
-#define FUNCTION __clc_sinpi
+#define __CLC_FUNCTION __clc_sinpi
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/ptx-nvidiacl/math/clc_sqrt.cl b/libclc/clc/lib/ptx-nvidiacl/math/clc_sqrt.cl
index ea91894b9dcf7..ac86a57fca3d6 100644
--- a/libclc/clc/lib/ptx-nvidiacl/math/clc_sqrt.cl
+++ b/libclc/clc/lib/ptx-nvidiacl/math/clc_sqrt.cl
@@ -29,6 +29,6 @@ _CLC_OVERLOAD _CLC_DEF half __clc_sqrt(half x) {
#endif
-#define FUNCTION __clc_sqrt
+#define __CLC_FUNCTION __clc_sqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/ptx-nvidiacl/relational/clc_isinf.cl b/libclc/clc/lib/ptx-nvidiacl/relational/clc_isinf.cl
index d518efad6a041..93f14d79fe6b2 100644
--- a/libclc/clc/lib/ptx-nvidiacl/relational/clc_isinf.cl
+++ b/libclc/clc/lib/ptx-nvidiacl/relational/clc_isinf.cl
@@ -27,7 +27,7 @@ _CLC_OVERLOAD _CLC_DEF int __clc_isinf(half x) { return __clc_isinf((float)x); }
#endif
-#define FUNCTION __clc_isinf
+#define __CLC_FUNCTION __clc_isinf
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#define __CLC_RET_TYPE __CLC_BIT_INT
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/r600/math/clc_native_rsqrt.cl b/libclc/clc/lib/r600/math/clc_native_rsqrt.cl
index b5966570804c9..da001574afc0c 100644
--- a/libclc/clc/lib/r600/math/clc_native_rsqrt.cl
+++ b/libclc/clc/lib/r600/math/clc_native_rsqrt.cl
@@ -13,7 +13,7 @@ _CLC_OVERLOAD _CLC_DEF float __clc_native_rsqrt(float x) {
return __builtin_r600_recipsqrt_ieeef(x);
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_native_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_native_rsqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/r600/math/clc_rsqrt_override.cl b/libclc/clc/lib/r600/math/clc_rsqrt_override.cl
index 75355df56d32e..f20046b341177 100644
--- a/libclc/clc/lib/r600/math/clc_rsqrt_override.cl
+++ b/libclc/clc/lib/r600/math/clc_rsqrt_override.cl
@@ -13,11 +13,11 @@ _CLC_OVERLOAD _CLC_DEF float __clc_rsqrt(float x) {
return __builtin_r600_recipsqrt_ieeef(x);
}
-#define __FLOAT_ONLY
-#define FUNCTION __clc_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION __clc_rsqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#ifdef cl_khr_fp64
@@ -27,10 +27,10 @@ _CLC_OVERLOAD _CLC_DEF double __clc_rsqrt(double x) {
return __builtin_r600_recipsqrt_ieee(x);
}
-#define __DOUBLE_ONLY
-#define FUNCTION __clc_rsqrt
+#define __CLC_DOUBLE_ONLY
+#define __CLC_FUNCTION __clc_rsqrt
#define __CLC_BODY <clc/shared/unary_def_scalarize.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif
diff --git a/libclc/clc/lib/spirv/math/clc_fmax.cl b/libclc/clc/lib/spirv/math/clc_fmax.cl
index be660fe2b29ba..f63a9d00c642d 100644
--- a/libclc/clc/lib/spirv/math/clc_fmax.cl
+++ b/libclc/clc/lib/spirv/math/clc_fmax.cl
@@ -27,6 +27,6 @@ _CLC_DEF _CLC_OVERLOAD half __clc_fmax(half x, half y) {
}
#endif
-#define FUNCTION __clc_fmax
+#define __CLC_FUNCTION __clc_fmax
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/spirv/math/clc_fmin.cl b/libclc/clc/lib/spirv/math/clc_fmin.cl
index 9f3fa66c0ab7a..ddb0126035f8f 100644
--- a/libclc/clc/lib/spirv/math/clc_fmin.cl
+++ b/libclc/clc/lib/spirv/math/clc_fmin.cl
@@ -27,6 +27,6 @@ _CLC_DEF _CLC_OVERLOAD half __clc_fmin(half x, half y) {
}
#endif
-#define FUNCTION __clc_fmin
+#define __CLC_FUNCTION __clc_fmin
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_add.h b/libclc/opencl/include/clc/opencl/atomic/atom_add.h
index 7f68fca0fc3a5..b26a2a5361b6f 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_add.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_add.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_base_atomics
-#define FUNCTION atom_add
+#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-#define FUNCTION atom_add
+#define __CLC_FUNCTION atom_add
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics
#ifdef cl_khr_int64_base_atomics
-#define FUNCTION atom_add
+#define __CLC_FUNCTION atom_add
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_and.h b/libclc/opencl/include/clc/opencl/atomic/atom_and.h
index 5c40aa4db70ad..eacbd7a33b6ee 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_and.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_and.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_extended_atomics
-#define FUNCTION atom_and
+#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics
#ifdef cl_khr_local_int32_extended_atomics
-#define FUNCTION atom_and
+#define __CLC_FUNCTION atom_and
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics
#ifdef cl_khr_int64_extended_atomics
-#define FUNCTION atom_and
+#define __CLC_FUNCTION atom_and
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_decl_int32.inc b/libclc/opencl/include/clc/opencl/atomic/atom_decl_int32.inc
index b8631ceac3a42..866d8903db816 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_decl_int32.inc
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_decl_int32.inc
@@ -10,12 +10,12 @@
#include <clc/clctypes.h>
#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
- _CLC_OVERLOAD _CLC_DECL TYPE FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
+ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int)
__CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint)
#undef __CLC_DECLARE_ATOM
-#undef FUNCTION
+#undef __CLC_FUNCTION
#undef __CLC_ADDRESS_SPACE
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_decl_int64.inc b/libclc/opencl/include/clc/opencl/atomic/atom_decl_int64.inc
index 3918a7cae006b..146de3412fc2e 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_decl_int64.inc
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_decl_int64.inc
@@ -10,7 +10,7 @@
#include <clc/clctypes.h>
#define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
- _CLC_OVERLOAD _CLC_DECL TYPE FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
+ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
__CLC_DECLARE_ATOM(local, long)
__CLC_DECLARE_ATOM(local, ulong)
@@ -19,4 +19,4 @@ __CLC_DECLARE_ATOM(global, ulong)
#undef __CLC_DECLARE_ATOM
-#undef FUNCTION
+#undef __CLC_FUNCTION
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_max.h b/libclc/opencl/include/clc/opencl/atomic/atom_max.h
index 87c70f20058d9..35a1e2aa06d48 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_max.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_max.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_extended_atomics
-#define FUNCTION atom_max
+#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics
#ifdef cl_khr_local_int32_extended_atomics
-#define FUNCTION atom_max
+#define __CLC_FUNCTION atom_max
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics
#ifdef cl_khr_int64_extended_atomics
-#define FUNCTION atom_max
+#define __CLC_FUNCTION atom_max
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_min.h b/libclc/opencl/include/clc/opencl/atomic/atom_min.h
index 487364c617ab5..ded96a5b29a48 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_min.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_min.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_extended_atomics
-#define FUNCTION atom_min
+#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics
#ifdef cl_khr_local_int32_extended_atomics
-#define FUNCTION atom_min
+#define __CLC_FUNCTION atom_min
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics
#ifdef cl_khr_int64_extended_atomics
-#define FUNCTION atom_min
+#define __CLC_FUNCTION atom_min
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_or.h b/libclc/opencl/include/clc/opencl/atomic/atom_or.h
index 1c3ae6984eead..42a69bd3f7b46 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_or.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_or.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_extended_atomics
-#define FUNCTION atom_or
+#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics
#ifdef cl_khr_local_int32_extended_atomics
-#define FUNCTION atom_or
+#define __CLC_FUNCTION atom_or
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics
#ifdef cl_khr_int64_extended_atomics
-#define FUNCTION atom_or
+#define __CLC_FUNCTION atom_or
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_sub.h b/libclc/opencl/include/clc/opencl/atomic/atom_sub.h
index eb17aa8ce73fe..9763ee6033410 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_sub.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_sub.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_base_atomics
-#define FUNCTION atom_sub
+#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-#define FUNCTION atom_sub
+#define __CLC_FUNCTION atom_sub
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics
#ifdef cl_khr_int64_base_atomics
-#define FUNCTION atom_sub
+#define __CLC_FUNCTION atom_sub
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_xchg.h b/libclc/opencl/include/clc/opencl/atomic/atom_xchg.h
index df17d31d6e67a..ab2c5b5156d68 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_xchg.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_xchg.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_base_atomics
-#define FUNCTION atom_xchg
+#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-#define FUNCTION atom_xchg
+#define __CLC_FUNCTION atom_xchg
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_base_atomics
#ifdef cl_khr_int64_base_atomics
-#define FUNCTION atom_xchg
+#define __CLC_FUNCTION atom_xchg
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atom_xor.h b/libclc/opencl/include/clc/opencl/atomic/atom_xor.h
index 8a97818821582..b33168db72cf0 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atom_xor.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atom_xor.h
@@ -12,19 +12,19 @@
#include <clc/opencl/opencl-base.h>
#ifdef cl_khr_global_int32_extended_atomics
-#define FUNCTION atom_xor
+#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE global
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_global_int32_extended_atomics
#ifdef cl_khr_local_int32_extended_atomics
-#define FUNCTION atom_xor
+#define __CLC_FUNCTION atom_xor
#define __CLC_ADDRESS_SPACE local
#include <clc/opencl/atomic/atom_decl_int32.inc>
#endif // cl_khr_local_int32_extended_atomics
#ifdef cl_khr_int64_extended_atomics
-#define FUNCTION atom_xor
+#define __CLC_FUNCTION atom_xor
#include <clc/opencl/atomic/atom_decl_int64.inc>
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_add.h b/libclc/opencl/include/clc/opencl/atomic/atomic_add.h
index 50fb99d1362fc..edb13bd6bde49 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_add.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_add.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_add
+#define __CLC_FUNCTION atomic_add
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_ADD_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_and.h b/libclc/opencl/include/clc/opencl/atomic/atomic_and.h
index 8ce328c9739aa..4875f5374c692 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_and.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_and.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_and
+#define __CLC_FUNCTION atomic_and
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_AND_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_strong.h b/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_strong.h
index 76eeda7ba3469..59bfa0e87dd8f 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_strong.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_strong.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_STRONG_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_STRONG_H__
-#define FUNCTION atomic_compare_exchange_strong
+#define __CLC_FUNCTION atomic_compare_exchange_strong
#define __CLC_COMPARE_EXCHANGE
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
@@ -19,6 +19,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_COMPARE_EXCHANGE
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_STRONG_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_weak.h b/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_weak.h
index 12788ad03a2d1..7106c3e061d65 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_weak.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_compare_exchange_weak.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_WEAK_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_WEAK_H__
-#define FUNCTION atomic_compare_exchange_weak
+#define __CLC_FUNCTION atomic_compare_exchange_weak
#define __CLC_COMPARE_EXCHANGE
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
@@ -19,6 +19,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_COMPARE_EXCHANGE
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_COMPARE_EXCHANGE_WEAK_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_decl.inc b/libclc/opencl/include/clc/opencl/atomic/atomic_decl.inc
index 1b2bf17bd6dfd..38d250f0693f7 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_decl.inc
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_decl.inc
@@ -10,36 +10,37 @@
#if defined(__opencl_c_fp64) && (defined(cl_khr_int64_base_atomics) && \
defined(cl_khr_int64_extended_atomics))
-#define HAVE_64_ATOMIC
+#define __CLC_HAVE_64_ATOMIC
#endif
-#if defined(__CLC_FPSIZE) && (__CLC_FPSIZE < 64 || defined(HAVE_64_ATOMIC))
-#define HAVE_FP_ATOMIC
+#if defined(__CLC_FPSIZE) && \
+ (__CLC_FPSIZE < 64 || defined(__CLC_HAVE_64_ATOMIC))
+#define __CLC_HAVE_FP_ATOMIC
#endif
#if defined(__CLC_GENSIZE) && \
((__CLC_GENSIZE == 32) || \
- (__CLC_GENSIZE == 64 && defined(HAVE_64_ATOMIC)))
-#define HAVE_INT_ATOMIC
+ (__CLC_GENSIZE == 64 && defined(__CLC_HAVE_64_ATOMIC)))
+#define __CLC_HAVE_INT_ATOMIC
#endif
-#if defined(HAVE_FP_ATOMIC) || defined(HAVE_INT_ATOMIC)
+#if defined(__CLC_HAVE_FP_ATOMIC) || defined(__CLC_HAVE_INT_ATOMIC)
#define __CLC_ATOMIC_GENTYPE __CLC_XCONCAT(atomic_, __CLC_GENTYPE)
#ifdef __CLC_NO_VALUE_ARG
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr);
#elif defined(__CLC_RETURN_VOID)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL void FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL void __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, __CLC_GENTYPE Value);
#elif defined(__CLC_COMPARE_EXCHANGE)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, \
ADDRSPACE __CLC_GENTYPE *Expected, __CLC_GENTYPE Desired);
#else
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, __CLC_GENTYPE Value);
#endif
@@ -51,10 +52,10 @@ __CLC_DEFINE_ATOMIC()
#undef __CLC_DEFINE_ATOMIC
-#endif // HAVE_FP_ATOMIC || HAVE_INT_ATOMIC
+#endif // __CLC_HAVE_FP_ATOMIC || __CLC_HAVE_INT_ATOMIC
-#undef HAVE_INT_ATOMIC
-#undef HAVE_FP_ATOMIC
-#undef HAVE_64_ATOMIC
+#undef __CLC_HAVE_INT_ATOMIC
+#undef __CLC_HAVE_FP_ATOMIC
+#undef __CLC_HAVE_64_ATOMIC
#endif // __CLC_SCALAR
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_decl_legacy.inc b/libclc/opencl/include/clc/opencl/atomic/atomic_decl_legacy.inc
index e060e3aaea161..0cfd4c3eab5f6 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_decl_legacy.inc
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_decl_legacy.inc
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#define __CLC_DECLARE_ATOMIC(ADDRSPACE, TYPE) \
- _CLC_OVERLOAD _CLC_DECL TYPE FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
+ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION(volatile ADDRSPACE TYPE *, TYPE);
#define __CLC_DECLARE_ATOMIC_ADDRSPACE(TYPE) \
__CLC_DECLARE_ATOMIC(global, TYPE) \
@@ -19,4 +19,4 @@ __CLC_DECLARE_ATOMIC_ADDRSPACE(uint)
#undef __CLC_DECLARE_ATOMIC_ADDRSPACE
#undef __CLC_DECLARE_ATOMIC
-#undef FUNCTION
+#undef __CLC_FUNCTION
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_exchange.h b/libclc/opencl/include/clc/opencl/atomic/atomic_exchange.h
index 3949bc13401f2..9d949825b58c3 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_exchange.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_exchange.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_EXCHANGE_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_EXCHANGE_H__
-#define FUNCTION atomic_exchange
+#define __CLC_FUNCTION atomic_exchange
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -17,6 +17,6 @@
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_EXCHANGE_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_add.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_add.h
index 972c1fa69fe7b..bae5a7a7e19bb 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_add.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_add.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_ADD_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_ADD_H__
-#define FUNCTION atomic_fetch_add
+#define __CLC_FUNCTION atomic_fetch_add
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -17,6 +17,6 @@
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_ADD_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_and.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_and.h
index fdac049a74d3f..9f9d2225f910e 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_and.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_and.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_AND_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_AND_H__
-#define FUNCTION atomic_fetch_and
+#define __CLC_FUNCTION atomic_fetch_and
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_AND_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_max.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_max.h
index 513b60fec2727..bef102dc82f48 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_max.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_max.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MAX_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MAX_H__
-#define FUNCTION atomic_fetch_max
+#define __CLC_FUNCTION atomic_fetch_max
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -17,6 +17,6 @@
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MAX_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_min.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_min.h
index c961c4a641656..d7e346dc44368 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_min.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_min.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MIN_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MIN_H__
-#define FUNCTION atomic_fetch_min
+#define __CLC_FUNCTION atomic_fetch_min
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -17,6 +17,6 @@
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_MIN_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_or.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_or.h
index 25923e3647e36..aa00982e15a56 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_or.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_or.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_OR_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_OR_H__
-#define FUNCTION atomic_fetch_or
+#define __CLC_FUNCTION atomic_fetch_or
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_OR_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_sub.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_sub.h
index b307c30a298b3..3d04ed7ba34f8 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_sub.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_sub.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_SUB_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_SUB_H__
-#define FUNCTION atomic_fetch_sub
+#define __CLC_FUNCTION atomic_fetch_sub
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
@@ -17,6 +17,6 @@
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_SUB_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_xor.h b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_xor.h
index 52510d018574d..2cdff08069025 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_xor.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_fetch_xor.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_XOR_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_XOR_H__
-#define FUNCTION atomic_fetch_xor
+#define __CLC_FUNCTION atomic_fetch_xor
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_FETCH_XOR_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_load.h b/libclc/opencl/include/clc/opencl/atomic/atomic_load.h
index 3998a4de9452b..7db259b136ec8 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_load.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_load.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_LOAD_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_LOAD_H__
-#define FUNCTION atomic_load
+#define __CLC_FUNCTION atomic_load
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
@@ -19,6 +19,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_NO_VALUE_ARG
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_LOAD_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_max.h b/libclc/opencl/include/clc/opencl/atomic/atomic_max.h
index 6b95ad7e68d94..e16f4ba7122dc 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_max.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_max.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_max
+#define __CLC_FUNCTION atomic_max
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_MAX_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_min.h b/libclc/opencl/include/clc/opencl/atomic/atomic_min.h
index c1dfacb40b746..d422388614c2a 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_min.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_min.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_min
+#define __CLC_FUNCTION atomic_min
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_MIN_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_or.h b/libclc/opencl/include/clc/opencl/atomic/atomic_or.h
index 30c32fe4889d5..53c9b1e3e89b3 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_or.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_or.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_or
+#define __CLC_FUNCTION atomic_or
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_OR_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_store.h b/libclc/opencl/include/clc/opencl/atomic/atomic_store.h
index 4893a5b88df03..b3cdfc6ffaeae 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_store.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_store.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_ATOMIC_ATOMIC_STORE_H__
#define __CLC_OPENCL_ATOMIC_ATOMIC_STORE_H__
-#define FUNCTION atomic_store
+#define __CLC_FUNCTION atomic_store
#define __CLC_RETURN_VOID
#define __CLC_BODY <clc/opencl/atomic/atomic_decl.inc>
@@ -19,6 +19,6 @@
#include <clc/math/gentype.inc>
#undef __CLC_RETURN_VOID
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_STORE_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_sub.h b/libclc/opencl/include/clc/opencl/atomic/atomic_sub.h
index 1e7ac5505b071..1b77bd7ced462 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_sub.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_sub.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_sub
+#define __CLC_FUNCTION atomic_sub
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_SUB_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_xchg.h b/libclc/opencl/include/clc/opencl/atomic/atomic_xchg.h
index 043d7825483e4..47d4a4638db34 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_xchg.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_xchg.h
@@ -11,10 +11,10 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_xchg
+#define __CLC_FUNCTION atomic_xchg
-_CLC_OVERLOAD _CLC_DECL float FUNCTION(volatile local float *, float);
-_CLC_OVERLOAD _CLC_DECL float FUNCTION(volatile global float *, float);
+_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION(volatile local float *, float);
+_CLC_OVERLOAD _CLC_DECL float __CLC_FUNCTION(volatile global float *, float);
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_XCHG_H__
diff --git a/libclc/opencl/include/clc/opencl/atomic/atomic_xor.h b/libclc/opencl/include/clc/opencl/atomic/atomic_xor.h
index a9bee007b9344..9c808d802594e 100644
--- a/libclc/opencl/include/clc/opencl/atomic/atomic_xor.h
+++ b/libclc/opencl/include/clc/opencl/atomic/atomic_xor.h
@@ -11,7 +11,7 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION atomic_xor
+#define __CLC_FUNCTION atomic_xor
#include <clc/opencl/atomic/atomic_decl_legacy.inc>
#endif // __CLC_OPENCL_ATOMIC_ATOMIC_XOR_H__
diff --git a/libclc/opencl/include/clc/opencl/common/degrees.h b/libclc/opencl/include/clc/opencl/common/degrees.h
index 5bd6f4e8f7fd5..8a3e77e559cfa 100644
--- a/libclc/opencl/include/clc/opencl/common/degrees.h
+++ b/libclc/opencl/include/clc/opencl/common/degrees.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_COMMON_DEGREES_H__
#define __CLC_OPENCL_COMMON_DEGREES_H__
-#define FUNCTION degrees
+#define __CLC_FUNCTION degrees
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_COMMON_DEGREES_H__
diff --git a/libclc/opencl/include/clc/opencl/common/radians.h b/libclc/opencl/include/clc/opencl/common/radians.h
index 3761a7e875be3..accef6eb62609 100644
--- a/libclc/opencl/include/clc/opencl/common/radians.h
+++ b/libclc/opencl/include/clc/opencl/common/radians.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_COMMON_RADIANS_H__
#define __CLC_OPENCL_COMMON_RADIANS_H__
-#define FUNCTION radians
+#define __CLC_FUNCTION radians
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_COMMON_RADIANS_H__
diff --git a/libclc/opencl/include/clc/opencl/common/sign.h b/libclc/opencl/include/clc/opencl/common/sign.h
index 619e68ff1e14d..58669b4e1fc9a 100644
--- a/libclc/opencl/include/clc/opencl/common/sign.h
+++ b/libclc/opencl/include/clc/opencl/common/sign.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_COMMON_SIGN_H__
#define __CLC_OPENCL_COMMON_SIGN_H__
-#define FUNCTION sign
+#define __CLC_FUNCTION sign
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_COMMON_SIGN_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/distance.h b/libclc/opencl/include/clc/opencl/geometric/distance.h
index f9c219c44a49b..dc5abf11c10c0 100644
--- a/libclc/opencl/include/clc/opencl/geometric/distance.h
+++ b/libclc/opencl/include/clc/opencl/geometric/distance.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_GEOMETRIC_DISTANCE_H__
#define __CLC_OPENCL_GEOMETRIC_DISTANCE_H__
-#define FUNCTION distance
+#define __CLC_FUNCTION distance
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_DISTANCE_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/dot.h b/libclc/opencl/include/clc/opencl/geometric/dot.h
index 0b391a10aa075..8cd702961fa41 100644
--- a/libclc/opencl/include/clc/opencl/geometric/dot.h
+++ b/libclc/opencl/include/clc/opencl/geometric/dot.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_GEOMETRIC_DOT_H__
#define __CLC_OPENCL_GEOMETRIC_DOT_H__
-#define FUNCTION dot
+#define __CLC_FUNCTION dot
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_DOT_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/fast_distance.h b/libclc/opencl/include/clc/opencl/geometric/fast_distance.h
index 95b4966dfac1a..3eb7d70cdddd2 100644
--- a/libclc/opencl/include/clc/opencl/geometric/fast_distance.h
+++ b/libclc/opencl/include/clc/opencl/geometric/fast_distance.h
@@ -9,12 +9,12 @@
#ifndef __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__
#define __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__
-#define __FLOAT_ONLY
-#define FUNCTION fast_distance
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fast_distance
#define __CLC_BODY <clc/geometric/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_FAST_DISTANCE_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/fast_length.h b/libclc/opencl/include/clc/opencl/geometric/fast_length.h
index 78ad1fea981c3..ff383de9ec72d 100644
--- a/libclc/opencl/include/clc/opencl/geometric/fast_length.h
+++ b/libclc/opencl/include/clc/opencl/geometric/fast_length.h
@@ -9,12 +9,12 @@
#ifndef __CLC_OPENCL_GEOMETRIC_FAST_LENGTH_H__
#define __CLC_OPENCL_GEOMETRIC_FAST_LENGTH_H__
-#define __FLOAT_ONLY
-#define FUNCTION fast_length
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fast_length
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_FAST_LENGTH_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/fast_normalize.h b/libclc/opencl/include/clc/opencl/geometric/fast_normalize.h
index 7a70dd5df5196..fb677d7d3f791 100644
--- a/libclc/opencl/include/clc/opencl/geometric/fast_normalize.h
+++ b/libclc/opencl/include/clc/opencl/geometric/fast_normalize.h
@@ -9,14 +9,14 @@
#ifndef __CLC_OPENCL_GEOMETRIC_FAST_NORMALIZE_H__
#define __CLC_OPENCL_GEOMETRIC_FAST_NORMALIZE_H__
-#define __FLOAT_ONLY
-#define FUNCTION fast_normalize
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fast_normalize
#define __CLC_GEOMETRIC_RET_GENTYPE
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#undef __CLC_GEOMETRIC_RET_GENTYPE
#endif // __CLC_OPENCL_GEOMETRIC_FAST_NORMALIZE_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/length.h b/libclc/opencl/include/clc/opencl/geometric/length.h
index 5dd6ff5a9cad4..686d554d60420 100644
--- a/libclc/opencl/include/clc/opencl/geometric/length.h
+++ b/libclc/opencl/include/clc/opencl/geometric/length.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_GEOMETRIC_LENGTH_H__
#define __CLC_OPENCL_GEOMETRIC_LENGTH_H__
-#define FUNCTION length
+#define __CLC_FUNCTION length
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_LENGTH_H__
diff --git a/libclc/opencl/include/clc/opencl/geometric/normalize.h b/libclc/opencl/include/clc/opencl/geometric/normalize.h
index 7d3e8fa98f8ed..3ed6dae53269e 100644
--- a/libclc/opencl/include/clc/opencl/geometric/normalize.h
+++ b/libclc/opencl/include/clc/opencl/geometric/normalize.h
@@ -9,13 +9,13 @@
#ifndef __CLC_OPENCL_GEOMETRIC_NORMALIZE_H__
#define __CLC_OPENCL_GEOMETRIC_NORMALIZE_H__
-#define FUNCTION normalize
+#define __CLC_FUNCTION normalize
#define __CLC_GEOMETRIC_RET_GENTYPE
#define __CLC_BODY <clc/geometric/unary_decl.inc>
#include <clc/math/gentype.inc>
#undef __CLC_GEOMETRIC_RET_GENTYPE
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_GEOMETRIC_NORMALIZE_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/add_sat.h b/libclc/opencl/include/clc/opencl/integer/add_sat.h
index cd2c17a096299..e77eee0c0b05a 100644
--- a/libclc/opencl/include/clc/opencl/integer/add_sat.h
+++ b/libclc/opencl/include/clc/opencl/integer/add_sat.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION add_sat
+#define __CLC_FUNCTION add_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_ADD_SAT_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bit_reverse.h b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
index 46b589557631d..9c3e45d08519a 100644
--- a/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
+++ b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
@@ -13,12 +13,12 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION bit_reverse
+#define __CLC_FUNCTION bit_reverse
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
index 0a902b2a21d6d..c6e48d9820dba 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
@@ -13,14 +13,14 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION bitfield_extract_signed
-#define __RETTYPE __CLC_S_GENTYPE
+#define __CLC_FUNCTION bitfield_extract_signed
+#define __CLC_RETTYPE __CLC_S_GENTYPE
#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
#include <clc/integer/gentype.inc>
-#undef __RETTYPE
-#undef FUNCTION
+#undef __CLC_RETTYPE
+#undef __CLC_FUNCTION
#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
index 28064c08b113e..63dd4368f97a6 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
@@ -13,14 +13,14 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION bitfield_extract_unsigned
-#define __RETTYPE __CLC_U_GENTYPE
+#define __CLC_FUNCTION bitfield_extract_unsigned
+#define __CLC_RETTYPE __CLC_U_GENTYPE
#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
#include <clc/integer/gentype.inc>
-#undef __RETTYPE
-#undef FUNCTION
+#undef __CLC_RETTYPE
+#undef __CLC_FUNCTION
#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
index e77d7a4f0b957..40c7d59825852 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
@@ -16,7 +16,7 @@
#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/include/clc/opencl/integer/clz.h b/libclc/opencl/include/clc/opencl/integer/clz.h
index 77032ceeaf0f4..1b47e975b52a1 100644
--- a/libclc/opencl/include/clc/opencl/integer/clz.h
+++ b/libclc/opencl/include/clc/opencl/integer/clz.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION clz
+#define __CLC_FUNCTION clz
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_CLZ_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/ctz.h b/libclc/opencl/include/clc/opencl/integer/ctz.h
index b861225846ee4..ba01161407303 100644
--- a/libclc/opencl/include/clc/opencl/integer/ctz.h
+++ b/libclc/opencl/include/clc/opencl/integer/ctz.h
@@ -13,12 +13,12 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION ctz
+#define __CLC_FUNCTION ctz
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __OPENCL_C_VERSION__ >= CL_VERSION_2_0
diff --git a/libclc/opencl/include/clc/opencl/integer/hadd.h b/libclc/opencl/include/clc/opencl/integer/hadd.h
index c4c8f7daf4014..f200c7019435b 100644
--- a/libclc/opencl/include/clc/opencl/integer/hadd.h
+++ b/libclc/opencl/include/clc/opencl/integer/hadd.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION hadd
+#define __CLC_FUNCTION hadd
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_HADD_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/mad24.h b/libclc/opencl/include/clc/opencl/integer/mad24.h
index daee9a0383477..5bf3d385a432b 100644
--- a/libclc/opencl/include/clc/opencl/integer/mad24.h
+++ b/libclc/opencl/include/clc/opencl/integer/mad24.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION mad24
+#define __CLC_FUNCTION mad24
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype24.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_MAD24_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/mad_hi.h b/libclc/opencl/include/clc/opencl/integer/mad_hi.h
index bbcdcd9c82ebd..98b525ba82689 100644
--- a/libclc/opencl/include/clc/opencl/integer/mad_hi.h
+++ b/libclc/opencl/include/clc/opencl/integer/mad_hi.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION mad_hi
+#define __CLC_FUNCTION mad_hi
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_MAD_HI_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/mad_sat.h b/libclc/opencl/include/clc/opencl/integer/mad_sat.h
index 28045477975ed..9e2afe4f1d9f1 100644
--- a/libclc/opencl/include/clc/opencl/integer/mad_sat.h
+++ b/libclc/opencl/include/clc/opencl/integer/mad_sat.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION mad_sat
+#define __CLC_FUNCTION mad_sat
#define __CLC_BODY <clc/shared/ternary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_MAD_SAT_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/mul24.h b/libclc/opencl/include/clc/opencl/integer/mul24.h
index 6aa799a28b7ec..434da55a71731 100644
--- a/libclc/opencl/include/clc/opencl/integer/mul24.h
+++ b/libclc/opencl/include/clc/opencl/integer/mul24.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION mul24
+#define __CLC_FUNCTION mul24
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype24.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_MUL24_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/mul_hi.h b/libclc/opencl/include/clc/opencl/integer/mul_hi.h
index ed7ac7319cab8..7a9317f94cd24 100644
--- a/libclc/opencl/include/clc/opencl/integer/mul_hi.h
+++ b/libclc/opencl/include/clc/opencl/integer/mul_hi.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION mul_hi
+#define __CLC_FUNCTION mul_hi
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_MUL_HI_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/popcount.h b/libclc/opencl/include/clc/opencl/integer/popcount.h
index 43d5bc0f0b335..112640c7ce635 100644
--- a/libclc/opencl/include/clc/opencl/integer/popcount.h
+++ b/libclc/opencl/include/clc/opencl/integer/popcount.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION popcount
+#define __CLC_FUNCTION popcount
#define __CLC_BODY <clc/shared/unary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_POPCOUNT_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/rhadd.h b/libclc/opencl/include/clc/opencl/integer/rhadd.h
index 2c93c100cf02f..5ed8b27df8fce 100644
--- a/libclc/opencl/include/clc/opencl/integer/rhadd.h
+++ b/libclc/opencl/include/clc/opencl/integer/rhadd.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_INTEGER_RHADD_H__
#define __CLC_OPENCL_INTEGER_RHADD_H__
-#define FUNCTION rhadd
+#define __CLC_FUNCTION rhadd
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_RHADD_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/rotate.h b/libclc/opencl/include/clc/opencl/integer/rotate.h
index 156155ae0638a..cc92a1254fed3 100644
--- a/libclc/opencl/include/clc/opencl/integer/rotate.h
+++ b/libclc/opencl/include/clc/opencl/integer/rotate.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION rotate
+#define __CLC_FUNCTION rotate
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_ROTATE_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/sub_sat.h b/libclc/opencl/include/clc/opencl/integer/sub_sat.h
index a7861ee1ac4a1..1ff26d94778cb 100644
--- a/libclc/opencl/include/clc/opencl/integer/sub_sat.h
+++ b/libclc/opencl/include/clc/opencl/integer/sub_sat.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_INTEGER_SUB_SAT_H__
#define __CLC_OPENCL_INTEGER_SUB_SAT_H__
-#define FUNCTION sub_sat
+#define __CLC_FUNCTION sub_sat
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/integer/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_INTEGER_SUB_SAT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/acos.h b/libclc/opencl/include/clc/opencl/math/acos.h
index f9e9b44bb9041..aa0d7af13ee9a 100644
--- a/libclc/opencl/include/clc/opencl/math/acos.h
+++ b/libclc/opencl/include/clc/opencl/math/acos.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ACOS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION acos
+#define __CLC_FUNCTION acos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ACOS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/acosh.h b/libclc/opencl/include/clc/opencl/math/acosh.h
index 241b305e6bc87..333ab6986d8c3 100644
--- a/libclc/opencl/include/clc/opencl/math/acosh.h
+++ b/libclc/opencl/include/clc/opencl/math/acosh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ACOSH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION acosh
+#define __CLC_FUNCTION acosh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ACOSH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/acospi.h b/libclc/opencl/include/clc/opencl/math/acospi.h
index 7014889dfb7ef..fd838acd5e522 100644
--- a/libclc/opencl/include/clc/opencl/math/acospi.h
+++ b/libclc/opencl/include/clc/opencl/math/acospi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ACOSPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION acospi
+#define __CLC_FUNCTION acospi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ACOSPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/asin.h b/libclc/opencl/include/clc/opencl/math/asin.h
index 1ba1f459a9024..de3b8ad219d1b 100644
--- a/libclc/opencl/include/clc/opencl/math/asin.h
+++ b/libclc/opencl/include/clc/opencl/math/asin.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ASIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION asin
+#define __CLC_FUNCTION asin
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ASIN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/asinh.h b/libclc/opencl/include/clc/opencl/math/asinh.h
index 9a530a51fa1ee..a550ec8dee4ca 100644
--- a/libclc/opencl/include/clc/opencl/math/asinh.h
+++ b/libclc/opencl/include/clc/opencl/math/asinh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ASINH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION asinh
+#define __CLC_FUNCTION asinh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ASINH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/asinpi.h b/libclc/opencl/include/clc/opencl/math/asinpi.h
index 844848fff0433..cb6133ddc3f51 100644
--- a/libclc/opencl/include/clc/opencl/math/asinpi.h
+++ b/libclc/opencl/include/clc/opencl/math/asinpi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ASINPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION asinpi
+#define __CLC_FUNCTION asinpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ASINPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/atan.h b/libclc/opencl/include/clc/opencl/math/atan.h
index f2312b8fb0737..165bbc3dfb18e 100644
--- a/libclc/opencl/include/clc/opencl/math/atan.h
+++ b/libclc/opencl/include/clc/opencl/math/atan.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ATAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION atan
+#define __CLC_FUNCTION atan
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ATAN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/atan2.h b/libclc/opencl/include/clc/opencl/math/atan2.h
index 72412d44aafb1..2874876707098 100644
--- a/libclc/opencl/include/clc/opencl/math/atan2.h
+++ b/libclc/opencl/include/clc/opencl/math/atan2.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_ATAN2_H__
#define __CLC_OPENCL_MATH_ATAN2_H__
-#define FUNCTION atan2
+#define __CLC_FUNCTION atan2
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ATAN2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/atan2pi.h b/libclc/opencl/include/clc/opencl/math/atan2pi.h
index f12a19776ef23..7c09a94fffa82 100644
--- a/libclc/opencl/include/clc/opencl/math/atan2pi.h
+++ b/libclc/opencl/include/clc/opencl/math/atan2pi.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_ATAN2PI_H__
#define __CLC_OPENCL_MATH_ATAN2PI_H__
-#define FUNCTION atan2pi
+#define __CLC_FUNCTION atan2pi
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ATAN2PI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/atanh.h b/libclc/opencl/include/clc/opencl/math/atanh.h
index 147a76b543e61..ccfe41fdb2cf1 100644
--- a/libclc/opencl/include/clc/opencl/math/atanh.h
+++ b/libclc/opencl/include/clc/opencl/math/atanh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ATANH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION atanh
+#define __CLC_FUNCTION atanh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ATANH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/atanpi.h b/libclc/opencl/include/clc/opencl/math/atanpi.h
index 12e9ea2501705..8041cc3e813e7 100644
--- a/libclc/opencl/include/clc/opencl/math/atanpi.h
+++ b/libclc/opencl/include/clc/opencl/math/atanpi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ATANPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION atanpi
+#define __CLC_FUNCTION atanpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ATANPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/cbrt.h b/libclc/opencl/include/clc/opencl/math/cbrt.h
index fdb408ac96858..3beb5b4b596af 100644
--- a/libclc/opencl/include/clc/opencl/math/cbrt.h
+++ b/libclc/opencl/include/clc/opencl/math/cbrt.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_CBRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION cbrt
+#define __CLC_FUNCTION cbrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_CBRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/ceil.h b/libclc/opencl/include/clc/opencl/math/ceil.h
index dad2ea4f69807..ab32419225ce9 100644
--- a/libclc/opencl/include/clc/opencl/math/ceil.h
+++ b/libclc/opencl/include/clc/opencl/math/ceil.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_CEIL_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION ceil
+#define __CLC_FUNCTION ceil
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_CEIL_H__
diff --git a/libclc/opencl/include/clc/opencl/math/copysign.h b/libclc/opencl/include/clc/opencl/math/copysign.h
index 10d6c90edf81f..626ce2e01cc34 100644
--- a/libclc/opencl/include/clc/opencl/math/copysign.h
+++ b/libclc/opencl/include/clc/opencl/math/copysign.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_COPYSIGN_H__
#define __CLC_OPENCL_MATH_COPYSIGN_H__
-#define FUNCTION copysign
+#define __CLC_FUNCTION copysign
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_COPYSIGN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/cos.h b/libclc/opencl/include/clc/opencl/math/cos.h
index 4e3aec6c69628..8d26f0f78d2d8 100644
--- a/libclc/opencl/include/clc/opencl/math/cos.h
+++ b/libclc/opencl/include/clc/opencl/math/cos.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_COS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION cos
+#define __CLC_FUNCTION cos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_COS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/cosh.h b/libclc/opencl/include/clc/opencl/math/cosh.h
index f316433a23514..2afe77fae6c70 100644
--- a/libclc/opencl/include/clc/opencl/math/cosh.h
+++ b/libclc/opencl/include/clc/opencl/math/cosh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_COSH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION cosh
+#define __CLC_FUNCTION cosh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_COSH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/cospi.h b/libclc/opencl/include/clc/opencl/math/cospi.h
index b7dfb0dbafb58..8e848ac0f883b 100644
--- a/libclc/opencl/include/clc/opencl/math/cospi.h
+++ b/libclc/opencl/include/clc/opencl/math/cospi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_COSPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION cospi
+#define __CLC_FUNCTION cospi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_COSPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/erf.h b/libclc/opencl/include/clc/opencl/math/erf.h
index 8ce262f276e39..71c211e693bde 100644
--- a/libclc/opencl/include/clc/opencl/math/erf.h
+++ b/libclc/opencl/include/clc/opencl/math/erf.h
@@ -12,10 +12,10 @@
#undef erfc
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION erf
+#define __CLC_FUNCTION erf
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ERF_H__
diff --git a/libclc/opencl/include/clc/opencl/math/erfc.h b/libclc/opencl/include/clc/opencl/math/erfc.h
index 26afe1315df60..3939108820451 100644
--- a/libclc/opencl/include/clc/opencl/math/erfc.h
+++ b/libclc/opencl/include/clc/opencl/math/erfc.h
@@ -12,10 +12,10 @@
#undef erfc
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION erfc
+#define __CLC_FUNCTION erfc
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ERFC_H__
diff --git a/libclc/opencl/include/clc/opencl/math/exp.h b/libclc/opencl/include/clc/opencl/math/exp.h
index fb8f674a8c7e5..acf6d4885dbd3 100644
--- a/libclc/opencl/include/clc/opencl/math/exp.h
+++ b/libclc/opencl/include/clc/opencl/math/exp.h
@@ -12,10 +12,10 @@
#undef exp
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION exp
+#define __CLC_FUNCTION exp
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_EXP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/exp10.h b/libclc/opencl/include/clc/opencl/math/exp10.h
index cfd5c6df9d15c..11dcae74e0613 100644
--- a/libclc/opencl/include/clc/opencl/math/exp10.h
+++ b/libclc/opencl/include/clc/opencl/math/exp10.h
@@ -12,10 +12,10 @@
#undef exp10
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION exp10
+#define __CLC_FUNCTION exp10
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_EXP10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/exp2.h b/libclc/opencl/include/clc/opencl/math/exp2.h
index db0405eb13341..e220654ac72e7 100644
--- a/libclc/opencl/include/clc/opencl/math/exp2.h
+++ b/libclc/opencl/include/clc/opencl/math/exp2.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_EXP2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION exp2
+#define __CLC_FUNCTION exp2
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_EXP2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/expm1.h b/libclc/opencl/include/clc/opencl/math/expm1.h
index 0b3628d48468e..556dbea8fae02 100644
--- a/libclc/opencl/include/clc/opencl/math/expm1.h
+++ b/libclc/opencl/include/clc/opencl/math/expm1.h
@@ -12,10 +12,10 @@
#undef exp
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION expm1
+#define __CLC_FUNCTION expm1
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_EXPM1_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fabs.h b/libclc/opencl/include/clc/opencl/math/fabs.h
index f20016f4eb8ba..ad8c05198a705 100644
--- a/libclc/opencl/include/clc/opencl/math/fabs.h
+++ b/libclc/opencl/include/clc/opencl/math/fabs.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_FABS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION fabs
+#define __CLC_FUNCTION fabs
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FABS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fdim.h b/libclc/opencl/include/clc/opencl/math/fdim.h
index 82f70fd832361..ed30904e3c247 100644
--- a/libclc/opencl/include/clc/opencl/math/fdim.h
+++ b/libclc/opencl/include/clc/opencl/math/fdim.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_FDIM_H__
#define __CLC_OPENCL_MATH_FDIM_H__
-#define FUNCTION fdim
+#define __CLC_FUNCTION fdim
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FDIM_H__
diff --git a/libclc/opencl/include/clc/opencl/math/floor.h b/libclc/opencl/include/clc/opencl/math/floor.h
index 1930aeca74ff0..8d7a0358c4652 100644
--- a/libclc/opencl/include/clc/opencl/math/floor.h
+++ b/libclc/opencl/include/clc/opencl/math/floor.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_FLOOR_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION floor
+#define __CLC_FUNCTION floor
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FLOOR_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fma.h b/libclc/opencl/include/clc/opencl/math/fma.h
index 6fed3fc9b2560..7a002318384a9 100644
--- a/libclc/opencl/include/clc/opencl/math/fma.h
+++ b/libclc/opencl/include/clc/opencl/math/fma.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_FMA_H__
#define __CLC_BODY <clc/shared/ternary_decl.inc>
-#define FUNCTION fma
+#define __CLC_FUNCTION fma
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FMA_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fmax.h b/libclc/opencl/include/clc/opencl/math/fmax.h
index 84c754e2c0c71..8ada84403e0ab 100644
--- a/libclc/opencl/include/clc/opencl/math/fmax.h
+++ b/libclc/opencl/include/clc/opencl/math/fmax.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_FMAX_H__
#define __CLC_BODY <clc/math/binary_decl_with_scalar_second_arg.inc>
-#define FUNCTION fmax
+#define __CLC_FUNCTION fmax
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FMAX_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fmin.h b/libclc/opencl/include/clc/opencl/math/fmin.h
index b35573e4f6337..3a464a63db735 100644
--- a/libclc/opencl/include/clc/opencl/math/fmin.h
+++ b/libclc/opencl/include/clc/opencl/math/fmin.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_FMIN_H__
#define __CLC_BODY <clc/math/binary_decl_with_scalar_second_arg.inc>
-#define FUNCTION fmin
+#define __CLC_FUNCTION fmin
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FMIN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fmod.h b/libclc/opencl/include/clc/opencl/math/fmod.h
index 13515006fd2be..f826c8a6f6c3e 100644
--- a/libclc/opencl/include/clc/opencl/math/fmod.h
+++ b/libclc/opencl/include/clc/opencl/math/fmod.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_MATH_FMOD_H__
#define __CLC_OPENCL_MATH_FMOD_H__
-#define FUNCTION fmod
+#define __CLC_FUNCTION fmod
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FMOD_H__
diff --git a/libclc/opencl/include/clc/opencl/math/fract.h b/libclc/opencl/include/clc/opencl/math/fract.h
index de953f78c5940..342280f70ed6c 100644
--- a/libclc/opencl/include/clc/opencl/math/fract.h
+++ b/libclc/opencl/include/clc/opencl/math/fract.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_MATH_FRACT_H__
#define __CLC_OPENCL_MATH_FRACT_H__
-#define FUNCTION fract
+#define __CLC_FUNCTION fract
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FRACT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/frexp.h b/libclc/opencl/include/clc/opencl/math/frexp.h
index c7ed7cbd1cbc4..9f0701aff10a2 100644
--- a/libclc/opencl/include/clc/opencl/math/frexp.h
+++ b/libclc/opencl/include/clc/opencl/math/frexp.h
@@ -9,10 +9,10 @@
#ifndef __CLC_OPENCL_MATH_FREXP_H__
#define __CLC_OPENCL_MATH_FREXP_H__
-#define FUNCTION frexp
+#define __CLC_FUNCTION frexp
#define __CLC_BODY <clc/math/unary_decl_with_int_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_FREXP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_cos.h b/libclc/opencl/include/clc/opencl/math/half_cos.h
index 5ab0b69ca4224..9f95f5d7e2775 100644
--- a/libclc/opencl/include/clc/opencl/math/half_cos.h
+++ b/libclc/opencl/include/clc/opencl/math/half_cos.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_COS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_cos
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_cos
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_COS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_divide.h b/libclc/opencl/include/clc/opencl/math/half_divide.h
index ff506d0c9fd6d..c61fb08e2119d 100644
--- a/libclc/opencl/include/clc/opencl/math/half_divide.h
+++ b/libclc/opencl/include/clc/opencl/math/half_divide.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_HALF_DIVIDE_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION half_divide
+#define __CLC_FUNCTION half_divide
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_DIVIDE_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_exp.h b/libclc/opencl/include/clc/opencl/math/half_exp.h
index 22780c144923c..53b75a62f4dfe 100644
--- a/libclc/opencl/include/clc/opencl/math/half_exp.h
+++ b/libclc/opencl/include/clc/opencl/math/half_exp.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_EXP_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_exp
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_exp
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_EXP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_exp10.h b/libclc/opencl/include/clc/opencl/math/half_exp10.h
index 1a8195e67eee0..88b05a4df0811 100644
--- a/libclc/opencl/include/clc/opencl/math/half_exp10.h
+++ b/libclc/opencl/include/clc/opencl/math/half_exp10.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_EXP10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_exp10
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_exp10
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_EXP10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_exp2.h b/libclc/opencl/include/clc/opencl/math/half_exp2.h
index 2ca69aa1ea076..e440b996e58ab 100644
--- a/libclc/opencl/include/clc/opencl/math/half_exp2.h
+++ b/libclc/opencl/include/clc/opencl/math/half_exp2.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_EXP2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_exp2
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_exp2
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_EXP2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_log.h b/libclc/opencl/include/clc/opencl/math/half_log.h
index d2eef868790f5..d4432312c6aff 100644
--- a/libclc/opencl/include/clc/opencl/math/half_log.h
+++ b/libclc/opencl/include/clc/opencl/math/half_log.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_LOG_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_log
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_log
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_LOG_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_log10.h b/libclc/opencl/include/clc/opencl/math/half_log10.h
index e0f85fff3f3ea..f219f950f9492 100644
--- a/libclc/opencl/include/clc/opencl/math/half_log10.h
+++ b/libclc/opencl/include/clc/opencl/math/half_log10.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_LOG10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_log10
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_log10
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_LOG10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_log2.h b/libclc/opencl/include/clc/opencl/math/half_log2.h
index ba0105d883568..932f546e87612 100644
--- a/libclc/opencl/include/clc/opencl/math/half_log2.h
+++ b/libclc/opencl/include/clc/opencl/math/half_log2.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_LOG2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_log2
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_log2
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_LOG2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_powr.h b/libclc/opencl/include/clc/opencl/math/half_powr.h
index 4b792c0c6cba4..e9af720aa5ac5 100644
--- a/libclc/opencl/include/clc/opencl/math/half_powr.h
+++ b/libclc/opencl/include/clc/opencl/math/half_powr.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_HALF_POWR_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION half_powr
+#define __CLC_FUNCTION half_powr
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_POWR_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_recip.h b/libclc/opencl/include/clc/opencl/math/half_recip.h
index 3425df4e476d8..6fb7f02138a6e 100644
--- a/libclc/opencl/include/clc/opencl/math/half_recip.h
+++ b/libclc/opencl/include/clc/opencl/math/half_recip.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_RECIP_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_recip
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_recip
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_RECIP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_rsqrt.h b/libclc/opencl/include/clc/opencl/math/half_rsqrt.h
index e22a7375cacda..a130d3bb080a1 100644
--- a/libclc/opencl/include/clc/opencl/math/half_rsqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/half_rsqrt.h
@@ -10,9 +10,9 @@
#define __CLC_OPENCL_MATH_HALF_RSQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_rsqrt
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_rsqrt
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_RSQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_sin.h b/libclc/opencl/include/clc/opencl/math/half_sin.h
index cb0462c45436f..cde9549bd3b35 100644
--- a/libclc/opencl/include/clc/opencl/math/half_sin.h
+++ b/libclc/opencl/include/clc/opencl/math/half_sin.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_SIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_sin
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_sin
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_SIN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_sqrt.h b/libclc/opencl/include/clc/opencl/math/half_sqrt.h
index f755fee7b4be2..017bed1c066e4 100644
--- a/libclc/opencl/include/clc/opencl/math/half_sqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/half_sqrt.h
@@ -10,9 +10,9 @@
#define __CLC_OPENCL_MATH_HALF_SQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_sqrt
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_sqrt
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_SQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/half_tan.h b/libclc/opencl/include/clc/opencl/math/half_tan.h
index 91b5b11ae1789..b8e71fcba43db 100644
--- a/libclc/opencl/include/clc/opencl/math/half_tan.h
+++ b/libclc/opencl/include/clc/opencl/math/half_tan.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_HALF_TAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION half_tan
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION half_tan
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HALF_TAN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/hypot.h b/libclc/opencl/include/clc/opencl/math/hypot.h
index 76ff6ef0655a9..53bef98772e41 100644
--- a/libclc/opencl/include/clc/opencl/math/hypot.h
+++ b/libclc/opencl/include/clc/opencl/math/hypot.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_HYPOT_H__
#define __CLC_OPENCL_MATH_HYPOT_H__
-#define FUNCTION hypot
+#define __CLC_FUNCTION hypot
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_HYPOT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/ilogb.h b/libclc/opencl/include/clc/opencl/math/ilogb.h
index d9752a644bee4..29d92632f7f50 100644
--- a/libclc/opencl/include/clc/opencl/math/ilogb.h
+++ b/libclc/opencl/include/clc/opencl/math/ilogb.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_ILOGB_H__
#define __CLC_OPENCL_MATH_ILOGB_H__
-#define FUNCTION ilogb
+#define __CLC_FUNCTION ilogb
#define __CLC_BODY <clc/math/unary_decl_with_int_return.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ILOGB_H__
diff --git a/libclc/opencl/include/clc/opencl/math/ldexp.h b/libclc/opencl/include/clc/opencl/math/ldexp.h
index b0194d9c9adad..cbbd030d73400 100644
--- a/libclc/opencl/include/clc/opencl/math/ldexp.h
+++ b/libclc/opencl/include/clc/opencl/math/ldexp.h
@@ -9,10 +9,10 @@
#ifndef __CLC_OPENCL_MATH_LDEXP_H__
#define __CLC_OPENCL_MATH_LDEXP_H__
-#define FUNCTION ldexp
+#define __CLC_FUNCTION ldexp
#define __CLC_BODY <clc/shared/binary_decl_with_int_second_arg.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#define __CLC_BODY <clc/opencl/math/ldexp.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/include/clc/opencl/math/lgamma.h b/libclc/opencl/include/clc/opencl/math/lgamma.h
index 95ed07c3531ee..42c260f65942b 100644
--- a/libclc/opencl/include/clc/opencl/math/lgamma.h
+++ b/libclc/opencl/include/clc/opencl/math/lgamma.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LGAMMA_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION lgamma
+#define __CLC_FUNCTION lgamma
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LGAMMA_H__
diff --git a/libclc/opencl/include/clc/opencl/math/lgamma_r.h b/libclc/opencl/include/clc/opencl/math/lgamma_r.h
index 4853d2dd5c283..03f47b30fb717 100644
--- a/libclc/opencl/include/clc/opencl/math/lgamma_r.h
+++ b/libclc/opencl/include/clc/opencl/math/lgamma_r.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_LGAMMA_R_H__
#define __CLC_OPENCL_MATH_LGAMMA_R_H__
-#define FUNCTION lgamma_r
+#define __CLC_FUNCTION lgamma_r
#define __CLC_BODY <clc/math/unary_decl_with_int_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LGAMMA_R_H__
diff --git a/libclc/opencl/include/clc/opencl/math/log.h b/libclc/opencl/include/clc/opencl/math/log.h
index 2d536d6b09266..f863dee3e8f2d 100644
--- a/libclc/opencl/include/clc/opencl/math/log.h
+++ b/libclc/opencl/include/clc/opencl/math/log.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LOG_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION log
+#define __CLC_FUNCTION log
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LOG_H__
diff --git a/libclc/opencl/include/clc/opencl/math/log10.h b/libclc/opencl/include/clc/opencl/math/log10.h
index 0f83b8c2a03e9..d328057ecf5e0 100644
--- a/libclc/opencl/include/clc/opencl/math/log10.h
+++ b/libclc/opencl/include/clc/opencl/math/log10.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LOG10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION log10
+#define __CLC_FUNCTION log10
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LOG10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/log1p.h b/libclc/opencl/include/clc/opencl/math/log1p.h
index bd8adeda88d4e..0dba062aa9fde 100644
--- a/libclc/opencl/include/clc/opencl/math/log1p.h
+++ b/libclc/opencl/include/clc/opencl/math/log1p.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LOG1P_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION log1p
+#define __CLC_FUNCTION log1p
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LOG1P_H__
diff --git a/libclc/opencl/include/clc/opencl/math/log2.h b/libclc/opencl/include/clc/opencl/math/log2.h
index e4f6cb619acf2..3903b2730e292 100644
--- a/libclc/opencl/include/clc/opencl/math/log2.h
+++ b/libclc/opencl/include/clc/opencl/math/log2.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LOG2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION log2
+#define __CLC_FUNCTION log2
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LOG2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/logb.h b/libclc/opencl/include/clc/opencl/math/logb.h
index 3bbc8476d2ffa..ef4f7b763c59f 100644
--- a/libclc/opencl/include/clc/opencl/math/logb.h
+++ b/libclc/opencl/include/clc/opencl/math/logb.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_LOGB_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION logb
+#define __CLC_FUNCTION logb
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_LOGB_H__
diff --git a/libclc/opencl/include/clc/opencl/math/mad.h b/libclc/opencl/include/clc/opencl/math/mad.h
index 18732eb7be668..440892cfbb17b 100644
--- a/libclc/opencl/include/clc/opencl/math/mad.h
+++ b/libclc/opencl/include/clc/opencl/math/mad.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_MAD_H__
#define __CLC_BODY <clc/shared/ternary_decl.inc>
-#define FUNCTION mad
+#define __CLC_FUNCTION mad
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_MAD_H__
diff --git a/libclc/opencl/include/clc/opencl/math/maxmag.h b/libclc/opencl/include/clc/opencl/math/maxmag.h
index c8f3d5700fa28..1f3df1034d8e4 100644
--- a/libclc/opencl/include/clc/opencl/math/maxmag.h
+++ b/libclc/opencl/include/clc/opencl/math/maxmag.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_MAXMAG_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION maxmag
+#define __CLC_FUNCTION maxmag
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_MAXMAG_H__
diff --git a/libclc/opencl/include/clc/opencl/math/minmag.h b/libclc/opencl/include/clc/opencl/math/minmag.h
index c90a9d9bdbeb1..c87fc1a20e401 100644
--- a/libclc/opencl/include/clc/opencl/math/minmag.h
+++ b/libclc/opencl/include/clc/opencl/math/minmag.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_MINMAG_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION minmag
+#define __CLC_FUNCTION minmag
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_MINMAG_H__
diff --git a/libclc/opencl/include/clc/opencl/math/modf.h b/libclc/opencl/include/clc/opencl/math/modf.h
index a336c9e242c1e..df07f7f5948dd 100644
--- a/libclc/opencl/include/clc/opencl/math/modf.h
+++ b/libclc/opencl/include/clc/opencl/math/modf.h
@@ -9,10 +9,10 @@
#ifndef __CLC_OPENCL_MATH_MODF_H__
#define __CLC_OPENCL_MATH_MODF_H__
-#define FUNCTION modf
+#define __CLC_FUNCTION modf
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_MODF_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_cos.h b/libclc/opencl/include/clc/opencl/math/native_cos.h
index 566c32e95b32c..9c6728103adc3 100644
--- a/libclc/opencl/include/clc/opencl/math/native_cos.h
+++ b/libclc/opencl/include/clc/opencl/math/native_cos.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_COS_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_cos
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_cos
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_COS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_divide.h b/libclc/opencl/include/clc/opencl/math/native_divide.h
index 23360b4bdeb9b..66c42f20d222c 100644
--- a/libclc/opencl/include/clc/opencl/math/native_divide.h
+++ b/libclc/opencl/include/clc/opencl/math/native_divide.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_NATIVE_DIVIDE_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION native_divide
+#define __CLC_FUNCTION native_divide
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_DIVIDE_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_exp.h b/libclc/opencl/include/clc/opencl/math/native_exp.h
index 5133469509ffb..d8c6f70d3f2c2 100644
--- a/libclc/opencl/include/clc/opencl/math/native_exp.h
+++ b/libclc/opencl/include/clc/opencl/math/native_exp.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_EXP_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_exp
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_exp
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_EXP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_exp10.h b/libclc/opencl/include/clc/opencl/math/native_exp10.h
index 8a2788cd3bcad..484eeb5de0a51 100644
--- a/libclc/opencl/include/clc/opencl/math/native_exp10.h
+++ b/libclc/opencl/include/clc/opencl/math/native_exp10.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_EXP10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_exp10
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_exp10
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_EXP10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_exp2.h b/libclc/opencl/include/clc/opencl/math/native_exp2.h
index 5a6aed09a838e..bc1e6babc62b0 100644
--- a/libclc/opencl/include/clc/opencl/math/native_exp2.h
+++ b/libclc/opencl/include/clc/opencl/math/native_exp2.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_EXP2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_exp2
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_exp2
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_EXP2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_log.h b/libclc/opencl/include/clc/opencl/math/native_log.h
index 58164960644ff..c4bf498738f4a 100644
--- a/libclc/opencl/include/clc/opencl/math/native_log.h
+++ b/libclc/opencl/include/clc/opencl/math/native_log.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_LOG_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_log
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_log
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_LOG_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_log10.h b/libclc/opencl/include/clc/opencl/math/native_log10.h
index c215c733c0422..ab61ee3df5c03 100644
--- a/libclc/opencl/include/clc/opencl/math/native_log10.h
+++ b/libclc/opencl/include/clc/opencl/math/native_log10.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_LOG10_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_log10
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_log10
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_LOG10_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_log2.h b/libclc/opencl/include/clc/opencl/math/native_log2.h
index 783abe6cd8e46..6ba0d3bf490f0 100644
--- a/libclc/opencl/include/clc/opencl/math/native_log2.h
+++ b/libclc/opencl/include/clc/opencl/math/native_log2.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_LOG2_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_log2
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_log2
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_LOG2_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_powr.h b/libclc/opencl/include/clc/opencl/math/native_powr.h
index 9c8e171afc21a..6b63138aa7822 100644
--- a/libclc/opencl/include/clc/opencl/math/native_powr.h
+++ b/libclc/opencl/include/clc/opencl/math/native_powr.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_NATIVE_POWR_H__
#define __CLC_BODY <clc/shared/binary_decl.inc>
-#define FUNCTION native_powr
+#define __CLC_FUNCTION native_powr
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_POWR_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_recip.h b/libclc/opencl/include/clc/opencl/math/native_recip.h
index 1c88c076e03c7..967eea38d80d9 100644
--- a/libclc/opencl/include/clc/opencl/math/native_recip.h
+++ b/libclc/opencl/include/clc/opencl/math/native_recip.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_RECIP_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_recip
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_recip
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_RECIP_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_rsqrt.h b/libclc/opencl/include/clc/opencl/math/native_rsqrt.h
index 2806f9128d94f..9146df8913720 100644
--- a/libclc/opencl/include/clc/opencl/math/native_rsqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/native_rsqrt.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_RSQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_rsqrt
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_rsqrt
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_RSQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_sin.h b/libclc/opencl/include/clc/opencl/math/native_sin.h
index 81f664153cee1..766b76781a9b7 100644
--- a/libclc/opencl/include/clc/opencl/math/native_sin.h
+++ b/libclc/opencl/include/clc/opencl/math/native_sin.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_SIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_sin
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_sin
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_SIN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_sqrt.h b/libclc/opencl/include/clc/opencl/math/native_sqrt.h
index dca0e542e0ac7..5d44f28db9286 100644
--- a/libclc/opencl/include/clc/opencl/math/native_sqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/native_sqrt.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_SQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_sqrt
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_sqrt
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_SQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/native_tan.h b/libclc/opencl/include/clc/opencl/math/native_tan.h
index cf942110e3124..075aa59757b4b 100644
--- a/libclc/opencl/include/clc/opencl/math/native_tan.h
+++ b/libclc/opencl/include/clc/opencl/math/native_tan.h
@@ -10,11 +10,11 @@
#define __CLC_OPENCL_MATH_NATIVE_TAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION native_tan
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION native_tan
+#define __CLC_FLOAT_ONLY
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NATIVE_TAN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/nextafter.h b/libclc/opencl/include/clc/opencl/math/nextafter.h
index e338f5bf6c2a7..6843f29770251 100644
--- a/libclc/opencl/include/clc/opencl/math/nextafter.h
+++ b/libclc/opencl/include/clc/opencl/math/nextafter.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_NEXTAFTER_H__
#define __CLC_OPENCL_MATH_NEXTAFTER_H__
-#define FUNCTION nextafter
+#define __CLC_FUNCTION nextafter
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_NEXTAFTER_H__
diff --git a/libclc/opencl/include/clc/opencl/math/pow.h b/libclc/opencl/include/clc/opencl/math/pow.h
index 3f4c1746faa91..ce17b66b541d0 100644
--- a/libclc/opencl/include/clc/opencl/math/pow.h
+++ b/libclc/opencl/include/clc/opencl/math/pow.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_MATH_POW_H__
#define __CLC_OPENCL_MATH_POW_H__
-#define FUNCTION pow
+#define __CLC_FUNCTION pow
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_POW_H__
diff --git a/libclc/opencl/include/clc/opencl/math/pown.h b/libclc/opencl/include/clc/opencl/math/pown.h
index fd97a705c8c87..24fc298da4f1e 100644
--- a/libclc/opencl/include/clc/opencl/math/pown.h
+++ b/libclc/opencl/include/clc/opencl/math/pown.h
@@ -9,11 +9,11 @@
#ifndef __CLC_OPENCL_MATH_POWN_H__
#define __CLC_OPENCL_MATH_POWN_H__
-#define FUNCTION pown
+#define __CLC_FUNCTION pown
#define __CLC_BODY <clc/shared/binary_decl_with_int_second_arg.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_POWN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/powr.h b/libclc/opencl/include/clc/opencl/math/powr.h
index 47f653a73afa3..6aebc346080f9 100644
--- a/libclc/opencl/include/clc/opencl/math/powr.h
+++ b/libclc/opencl/include/clc/opencl/math/powr.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_MATH_POWR_H__
#define __CLC_OPENCL_MATH_POWR_H__
-#define FUNCTION powr
+#define __CLC_FUNCTION powr
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_POWR_H__
diff --git a/libclc/opencl/include/clc/opencl/math/remainder.h b/libclc/opencl/include/clc/opencl/math/remainder.h
index 416a0422c9a62..d30a315a4ce38 100644
--- a/libclc/opencl/include/clc/opencl/math/remainder.h
+++ b/libclc/opencl/include/clc/opencl/math/remainder.h
@@ -9,9 +9,9 @@
#ifndef __CLC_OPENCL_MATH_REMAINDER_H__
#define __CLC_OPENCL_MATH_REMAINDER_H__
-#define FUNCTION remainder
+#define __CLC_FUNCTION remainder
#define __CLC_BODY <clc/shared/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_REMAINDER_H__
diff --git a/libclc/opencl/include/clc/opencl/math/remquo.h b/libclc/opencl/include/clc/opencl/math/remquo.h
index 3525c6bd0f685..28fc74c00fd90 100644
--- a/libclc/opencl/include/clc/opencl/math/remquo.h
+++ b/libclc/opencl/include/clc/opencl/math/remquo.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_MATH_REMQUO_H__
#define __CLC_OPENCL_MATH_REMQUO_H__
-#define FUNCTION remquo
+#define __CLC_FUNCTION remquo
#define __CLC_BODY <clc/math/remquo_decl.inc>
#include <clc/math/gentype.inc>
@@ -21,6 +21,6 @@
#undef __CLC_ADDRESS_SPACE
#endif
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_REMQUO_H__
diff --git a/libclc/opencl/include/clc/opencl/math/rint.h b/libclc/opencl/include/clc/opencl/math/rint.h
index 8f08fd20c3c92..ceca56535a864 100644
--- a/libclc/opencl/include/clc/opencl/math/rint.h
+++ b/libclc/opencl/include/clc/opencl/math/rint.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_RINT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION rint
+#define __CLC_FUNCTION rint
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_RINT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/rootn.h b/libclc/opencl/include/clc/opencl/math/rootn.h
index 20b52e7c01dc5..9dce895a3f2d7 100644
--- a/libclc/opencl/include/clc/opencl/math/rootn.h
+++ b/libclc/opencl/include/clc/opencl/math/rootn.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ROOTN_H__
#define __CLC_BODY <clc/shared/binary_decl_with_int_second_arg.inc>
-#define FUNCTION rootn
+#define __CLC_FUNCTION rootn
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ROOTN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/round.h b/libclc/opencl/include/clc/opencl/math/round.h
index 65bfc265ced0e..740ae9241f692 100644
--- a/libclc/opencl/include/clc/opencl/math/round.h
+++ b/libclc/opencl/include/clc/opencl/math/round.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_ROUND_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION round
+#define __CLC_FUNCTION round
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_ROUND_H__
diff --git a/libclc/opencl/include/clc/opencl/math/rsqrt.h b/libclc/opencl/include/clc/opencl/math/rsqrt.h
index 41fb54ea9bb5f..ea141d4bc45bd 100644
--- a/libclc/opencl/include/clc/opencl/math/rsqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/rsqrt.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_RSQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION rsqrt
+#define __CLC_FUNCTION rsqrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_RSQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/sin.h b/libclc/opencl/include/clc/opencl/math/sin.h
index fc7741e164fda..60de98de09584 100644
--- a/libclc/opencl/include/clc/opencl/math/sin.h
+++ b/libclc/opencl/include/clc/opencl/math/sin.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_SIN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION sin
+#define __CLC_FUNCTION sin
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_SIN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/sincos.h b/libclc/opencl/include/clc/opencl/math/sincos.h
index 0231560a6b9de..4989bcf21c038 100644
--- a/libclc/opencl/include/clc/opencl/math/sincos.h
+++ b/libclc/opencl/include/clc/opencl/math/sincos.h
@@ -10,8 +10,8 @@
#define __CLC_OPENCL_MATH_SINCOS_H__
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
-#define FUNCTION sincos
+#define __CLC_FUNCTION sincos
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_SINCOS_H__
diff --git a/libclc/opencl/include/clc/opencl/math/sinh.h b/libclc/opencl/include/clc/opencl/math/sinh.h
index cbe30551ec641..0c9f0985be52b 100644
--- a/libclc/opencl/include/clc/opencl/math/sinh.h
+++ b/libclc/opencl/include/clc/opencl/math/sinh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_SINH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION sinh
+#define __CLC_FUNCTION sinh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_SINH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/sinpi.h b/libclc/opencl/include/clc/opencl/math/sinpi.h
index 3ef55a1cd42dc..a24339f8cf03f 100644
--- a/libclc/opencl/include/clc/opencl/math/sinpi.h
+++ b/libclc/opencl/include/clc/opencl/math/sinpi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_SINPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION sinpi
+#define __CLC_FUNCTION sinpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_SINPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/sqrt.h b/libclc/opencl/include/clc/opencl/math/sqrt.h
index 8da37e94e756c..41f604f9652dd 100644
--- a/libclc/opencl/include/clc/opencl/math/sqrt.h
+++ b/libclc/opencl/include/clc/opencl/math/sqrt.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_SQRT_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION sqrt
+#define __CLC_FUNCTION sqrt
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_SQRT_H__
diff --git a/libclc/opencl/include/clc/opencl/math/tan.h b/libclc/opencl/include/clc/opencl/math/tan.h
index b7bab825c935c..5c3f5f6a3a417 100644
--- a/libclc/opencl/include/clc/opencl/math/tan.h
+++ b/libclc/opencl/include/clc/opencl/math/tan.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_TAN_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION tan
+#define __CLC_FUNCTION tan
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_TAN_H__
diff --git a/libclc/opencl/include/clc/opencl/math/tanh.h b/libclc/opencl/include/clc/opencl/math/tanh.h
index 168c06d50cb29..dce89867f25e0 100644
--- a/libclc/opencl/include/clc/opencl/math/tanh.h
+++ b/libclc/opencl/include/clc/opencl/math/tanh.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_TANH_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION tanh
+#define __CLC_FUNCTION tanh
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_TANH_H__
diff --git a/libclc/opencl/include/clc/opencl/math/tanpi.h b/libclc/opencl/include/clc/opencl/math/tanpi.h
index 0475027086f63..2a903b9a1fe75 100644
--- a/libclc/opencl/include/clc/opencl/math/tanpi.h
+++ b/libclc/opencl/include/clc/opencl/math/tanpi.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_TANPI_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION tanpi
+#define __CLC_FUNCTION tanpi
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_TANPI_H__
diff --git a/libclc/opencl/include/clc/opencl/math/tgamma.h b/libclc/opencl/include/clc/opencl/math/tgamma.h
index 6629c02002455..5cb0a7fd48f93 100644
--- a/libclc/opencl/include/clc/opencl/math/tgamma.h
+++ b/libclc/opencl/include/clc/opencl/math/tgamma.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_TGAMMA_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION tgamma
+#define __CLC_FUNCTION tgamma
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_TGAMMA_H__
diff --git a/libclc/opencl/include/clc/opencl/math/trunc.h b/libclc/opencl/include/clc/opencl/math/trunc.h
index 0e61f6e1679f7..ccb60a6a54d6a 100644
--- a/libclc/opencl/include/clc/opencl/math/trunc.h
+++ b/libclc/opencl/include/clc/opencl/math/trunc.h
@@ -10,10 +10,10 @@
#define __CLC_OPENCL_MATH_TRUNC_H__
#define __CLC_BODY <clc/math/unary_decl.inc>
-#define FUNCTION trunc
+#define __CLC_FUNCTION trunc
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MATH_TRUNC_H__
diff --git a/libclc/opencl/include/clc/opencl/misc/shuffle.h b/libclc/opencl/include/clc/opencl/misc/shuffle.h
index 03c2718b0c4ff..a1d4b6aa38248 100644
--- a/libclc/opencl/include/clc/opencl/misc/shuffle.h
+++ b/libclc/opencl/include/clc/opencl/misc/shuffle.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_MISC_SHUFFLE_H__
#define __CLC_OPENCL_MISC_SHUFFLE_H__
-#define FUNCTION shuffle
+#define __CLC_FUNCTION shuffle
// Integer-type decls
#define __CLC_BODY <clc/misc/shuffle_decl.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/misc/shuffle_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MISC_SHUFFLE_H__
diff --git a/libclc/opencl/include/clc/opencl/misc/shuffle2.h b/libclc/opencl/include/clc/opencl/misc/shuffle2.h
index 5b6ba99686516..0f93a802b3f36 100644
--- a/libclc/opencl/include/clc/opencl/misc/shuffle2.h
+++ b/libclc/opencl/include/clc/opencl/misc/shuffle2.h
@@ -9,7 +9,7 @@
#ifndef __CLC_OPENCL_MISC_SHUFFLE2_H__
#define __CLC_OPENCL_MISC_SHUFFLE2_H__
-#define FUNCTION shuffle2
+#define __CLC_FUNCTION shuffle2
// Integer-type decls
#define __CLC_BODY <clc/misc/shuffle2_decl.inc>
@@ -19,6 +19,6 @@
#define __CLC_BODY <clc/misc/shuffle2_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_MISC_SHUFFLE2_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isfinite.h b/libclc/opencl/include/clc/opencl/relational/isfinite.h
index ac3db6764073a..ff996befa937d 100644
--- a/libclc/opencl/include/clc/opencl/relational/isfinite.h
+++ b/libclc/opencl/include/clc/opencl/relational/isfinite.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isfinite
+#define __CLC_FUNCTION isfinite
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISFINITE_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isgreater.h b/libclc/opencl/include/clc/opencl/relational/isgreater.h
index 2230055115bcd..1885faac0d6d2 100644
--- a/libclc/opencl/include/clc/opencl/relational/isgreater.h
+++ b/libclc/opencl/include/clc/opencl/relational/isgreater.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isgreater
+#define __CLC_FUNCTION isgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISGREATER_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isgreaterequal.h b/libclc/opencl/include/clc/opencl/relational/isgreaterequal.h
index f99a620dabd78..36def480081bc 100644
--- a/libclc/opencl/include/clc/opencl/relational/isgreaterequal.h
+++ b/libclc/opencl/include/clc/opencl/relational/isgreaterequal.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isgreaterequal
+#define __CLC_FUNCTION isgreaterequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISGREATEREQUAL_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isless.h b/libclc/opencl/include/clc/opencl/relational/isless.h
index 74280e543e0b5..ce516890f19e5 100644
--- a/libclc/opencl/include/clc/opencl/relational/isless.h
+++ b/libclc/opencl/include/clc/opencl/relational/isless.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isless
+#define __CLC_FUNCTION isless
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISLESS_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/islessequal.h b/libclc/opencl/include/clc/opencl/relational/islessequal.h
index dcc26c37b73c1..571ed13c0ab86 100644
--- a/libclc/opencl/include/clc/opencl/relational/islessequal.h
+++ b/libclc/opencl/include/clc/opencl/relational/islessequal.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION islessequal
+#define __CLC_FUNCTION islessequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISLESSEQUAL_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/islessgreater.h b/libclc/opencl/include/clc/opencl/relational/islessgreater.h
index 15a1eb5577531..eefd2c41b3469 100644
--- a/libclc/opencl/include/clc/opencl/relational/islessgreater.h
+++ b/libclc/opencl/include/clc/opencl/relational/islessgreater.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION islessgreater
+#define __CLC_FUNCTION islessgreater
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISLESSGREATER_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isnormal.h b/libclc/opencl/include/clc/opencl/relational/isnormal.h
index bbb06aad0df2a..29ef762174f09 100644
--- a/libclc/opencl/include/clc/opencl/relational/isnormal.h
+++ b/libclc/opencl/include/clc/opencl/relational/isnormal.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isnormal
+#define __CLC_FUNCTION isnormal
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISNORMAL_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isnotequal.h b/libclc/opencl/include/clc/opencl/relational/isnotequal.h
index c13aca8ef4be8..6670b9946d186 100644
--- a/libclc/opencl/include/clc/opencl/relational/isnotequal.h
+++ b/libclc/opencl/include/clc/opencl/relational/isnotequal.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isnotequal
+#define __CLC_FUNCTION isnotequal
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISNOTEQUAL_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isordered.h b/libclc/opencl/include/clc/opencl/relational/isordered.h
index ea4ba3fa6fe8d..09531ed86721c 100644
--- a/libclc/opencl/include/clc/opencl/relational/isordered.h
+++ b/libclc/opencl/include/clc/opencl/relational/isordered.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isordered
+#define __CLC_FUNCTION isordered
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISORDERED_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/isunordered.h b/libclc/opencl/include/clc/opencl/relational/isunordered.h
index 76bf85604d1c7..d1f6dabbe20c3 100644
--- a/libclc/opencl/include/clc/opencl/relational/isunordered.h
+++ b/libclc/opencl/include/clc/opencl/relational/isunordered.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION isunordered
+#define __CLC_FUNCTION isunordered
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_ISUNORDERED_H__
diff --git a/libclc/opencl/include/clc/opencl/relational/signbit.h b/libclc/opencl/include/clc/opencl/relational/signbit.h
index 6ad6595c7e294..fff6f33508fad 100644
--- a/libclc/opencl/include/clc/opencl/relational/signbit.h
+++ b/libclc/opencl/include/clc/opencl/relational/signbit.h
@@ -11,11 +11,11 @@
#include <clc/opencl/opencl-base.h>
-#define FUNCTION signbit
+#define __CLC_FUNCTION signbit
#define __CLC_BODY <clc/relational/unary_decl.inc>
#include <clc/math/gentype.inc>
-#undef FUNCTION
+#undef __CLC_FUNCTION
#endif // __CLC_OPENCL_RELATIONAL_SIGNBIT_H__
diff --git a/libclc/opencl/lib/clspv/math/fma.cl b/libclc/opencl/lib/clspv/math/fma.cl
index 83504f63772ca..0e328903ba263 100644
--- a/libclc/opencl/lib/clspv/math/fma.cl
+++ b/libclc/opencl/lib/clspv/math/fma.cl
@@ -9,9 +9,9 @@
#include <clc/internal/math/clc_sw_fma.h>
#include <clc/opencl/math/fma.h>
-#define __FLOAT_ONLY
-#define FUNCTION fma
-#define __IMPL_FUNCTION(x) __clc_sw_fma
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fma
+#define __CLC_IMPL_FUNCTION(x) __clc_sw_fma
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/clspv/shared/vstore_half.cl b/libclc/opencl/lib/clspv/shared/vstore_half.cl
index df5f30a711df5..66973eb9ac4dc 100644
--- a/libclc/opencl/lib/clspv/shared/vstore_half.cl
+++ b/libclc/opencl/lib/clspv/shared/vstore_half.cl
@@ -18,37 +18,37 @@
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
-#define ROUND_VEC1(out, in, ROUNDF) out = ROUNDF(in);
-#define ROUND_VEC2(out, in, ROUNDF) \
- ROUND_VEC1(out.lo, in.lo, ROUNDF); \
- ROUND_VEC1(out.hi, in.hi, ROUNDF);
-#define ROUND_VEC3(out, in, ROUNDF) \
- ROUND_VEC1(out.s0, in.s0, ROUNDF); \
- ROUND_VEC1(out.s1, in.s1, ROUNDF); \
- ROUND_VEC1(out.s2, in.s2, ROUNDF);
-#define ROUND_VEC4(out, in, ROUNDF) \
- ROUND_VEC2(out.lo, in.lo, ROUNDF); \
- ROUND_VEC2(out.hi, in.hi, ROUNDF);
-#define ROUND_VEC8(out, in, ROUNDF) \
- ROUND_VEC4(out.lo, in.lo, ROUNDF); \
- ROUND_VEC4(out.hi, in.hi, ROUNDF);
-#define ROUND_VEC16(out, in, ROUNDF) \
- ROUND_VEC8(out.lo, in.lo, ROUNDF); \
- ROUND_VEC8(out.hi, in.hi, ROUNDF);
-
-#define __FUNC(SUFFIX, VEC_SIZE, TYPE, AS, ROUNDF) \
+#define __CLC_ROUND_VEC1(out, in, ROUNDF) out = ROUNDF(in);
+#define __CLC_ROUND_VEC2(out, in, ROUNDF) \
+ __CLC_ROUND_VEC1(out.lo, in.lo, ROUNDF); \
+ __CLC_ROUND_VEC1(out.hi, in.hi, ROUNDF);
+#define __CLC_ROUND_VEC3(out, in, ROUNDF) \
+ __CLC_ROUND_VEC1(out.s0, in.s0, ROUNDF); \
+ __CLC_ROUND_VEC1(out.s1, in.s1, ROUNDF); \
+ __CLC_ROUND_VEC1(out.s2, in.s2, ROUNDF);
+#define __CLC_ROUND_VEC4(out, in, ROUNDF) \
+ __CLC_ROUND_VEC2(out.lo, in.lo, ROUNDF); \
+ __CLC_ROUND_VEC2(out.hi, in.hi, ROUNDF);
+#define __CLC_ROUND_VEC8(out, in, ROUNDF) \
+ __CLC_ROUND_VEC4(out.lo, in.lo, ROUNDF); \
+ __CLC_ROUND_VEC4(out.hi, in.hi, ROUNDF);
+#define __CLC_ROUND_VEC16(out, in, ROUNDF) \
+ __CLC_ROUND_VEC8(out.lo, in.lo, ROUNDF); \
+ __CLC_ROUND_VEC8(out.hi, in.hi, ROUNDF);
+
+#define __CLC_XFUNC_IMPL(SUFFIX, VEC_SIZE, TYPE, AS, ROUNDF) \
void _CLC_OVERLOAD vstore_half_##VEC_SIZE(TYPE, size_t, AS half *); \
_CLC_OVERLOAD _CLC_DEF void vstore_half##SUFFIX(TYPE vec, size_t offset, \
AS half *mem) { \
TYPE rounded_vec; \
- ROUND_VEC##VEC_SIZE(rounded_vec, vec, ROUNDF); \
+ __CLC_ROUND_VEC##VEC_SIZE(rounded_vec, vec, ROUNDF); \
vstore_half_##VEC_SIZE(rounded_vec, offset, mem); \
} \
void _CLC_OVERLOAD vstorea_half_##VEC_SIZE(TYPE, size_t, AS half *); \
_CLC_OVERLOAD _CLC_DEF void vstorea_half##SUFFIX(TYPE vec, size_t offset, \
AS half *mem) { \
TYPE rounded_vec; \
- ROUND_VEC##VEC_SIZE(rounded_vec, vec, ROUNDF); \
+ __CLC_ROUND_VEC##VEC_SIZE(rounded_vec, vec, ROUNDF); \
vstorea_half_##VEC_SIZE(rounded_vec, offset, mem); \
}
@@ -134,17 +134,18 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rte(float x) {
return roundup ? __clc_rti(x) : __clc_rtz(x);
}
-#define __XFUNC(SUFFIX, VEC_SIZE, TYPE, AS) \
- __FUNC(SUFFIX, VEC_SIZE, TYPE, AS, __clc_rte) \
- __FUNC(SUFFIX##_rtz, VEC_SIZE, TYPE, AS, __clc_rtz) \
- __FUNC(SUFFIX##_rtn, VEC_SIZE, TYPE, AS, __clc_rtn) \
- __FUNC(SUFFIX##_rtp, VEC_SIZE, TYPE, AS, __clc_rtp) \
- __FUNC(SUFFIX##_rte, VEC_SIZE, TYPE, AS, __clc_rte)
+#define __CLC_XFUNC(SUFFIX, VEC_SIZE, TYPE, AS) \
+ __CLC_XFUNC_IMPL(SUFFIX, VEC_SIZE, TYPE, AS, __clc_rte) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtz, VEC_SIZE, TYPE, AS, __clc_rtz) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtn, VEC_SIZE, TYPE, AS, __clc_rtn) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rtp, VEC_SIZE, TYPE, AS, __clc_rtp) \
+ __CLC_XFUNC_IMPL(SUFFIX##_rte, VEC_SIZE, TYPE, AS, __clc_rte)
-#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __XFUNC(SUFFIX, VEC_SIZE, TYPE, AS)
+#define __CLC_FUNC(SUFFIX, VEC_SIZE, TYPE, AS) \
+ __CLC_XFUNC(SUFFIX, VEC_SIZE, TYPE, AS)
#define __CLC_BODY "vstore_half.inc"
#include <clc/math/gentype.inc>
-#undef FUNC
-#undef __XFUNC
-#undef __FUNC
+#undef __CLC_FUNC
+#undef __CLC_XFUNC
+#undef __CLC_XFUNC_IMPL
diff --git a/libclc/opencl/lib/clspv/shared/vstore_half.inc b/libclc/opencl/lib/clspv/shared/vstore_half.inc
index f2c02748246a8..d78fbb80976b2 100644
--- a/libclc/opencl/lib/clspv/shared/vstore_half.inc
+++ b/libclc/opencl/lib/clspv/shared/vstore_half.inc
@@ -10,20 +10,20 @@
#if __CLC_FPSIZE == 32
#ifndef __CLC_SCALAR
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __private);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __local);
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __global);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __private);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __local);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __global);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __generic);
+__CLC_FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __generic);
#endif
#undef __CLC_OFFSET
#else
-FUNC(, 1, __CLC_GENTYPE, __private);
-FUNC(, 1, __CLC_GENTYPE, __local);
-FUNC(, 1, __CLC_GENTYPE, __global);
+__CLC_FUNC(, 1, __CLC_GENTYPE, __private);
+__CLC_FUNC(, 1, __CLC_GENTYPE, __local);
+__CLC_FUNC(, 1, __CLC_GENTYPE, __global);
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-FUNC(, 1, __CLC_GENTYPE, __generic);
+__CLC_FUNC(, 1, __CLC_GENTYPE, __generic);
#endif
#endif
#endif
diff --git a/libclc/opencl/lib/generic/async/async_work_group_strided_copy.inc b/libclc/opencl/lib/generic/async/async_work_group_strided_copy.inc
index c9c32a7d94315..f421298e2ca0f 100644
--- a/libclc/opencl/lib/generic/async/async_work_group_strided_copy.inc
+++ b/libclc/opencl/lib/generic/async/async_work_group_strided_copy.inc
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#define STRIDED_COPY(dst, src, num_gentypes, dst_stride, src_stride) \
+#define __CLC_STRIDED_COPY(dst, src, num_gentypes, dst_stride, src_stride) \
size_t size = get_local_size(0) * get_local_size(1) * get_local_size(2); \
size_t id = (get_local_size(0) * get_local_size(1) * get_local_id(2)) + \
(get_local_size(0) * get_local_id(1)) + get_local_id(0); \
@@ -20,7 +20,7 @@ _CLC_OVERLOAD _CLC_DEF event_t async_work_group_strided_copy(
local __CLC_GENTYPE *dst, const global __CLC_GENTYPE *src,
size_t num_gentypes, size_t src_stride, event_t event) {
- STRIDED_COPY(dst, src, num_gentypes, 1, src_stride);
+ __CLC_STRIDED_COPY(dst, src, num_gentypes, 1, src_stride);
return event;
}
@@ -28,6 +28,6 @@ _CLC_OVERLOAD _CLC_DEF event_t async_work_group_strided_copy(
global __CLC_GENTYPE *dst, const local __CLC_GENTYPE *src,
size_t num_gentypes, size_t dst_stride, event_t event) {
- STRIDED_COPY(dst, src, num_gentypes, dst_stride, 1);
+ __CLC_STRIDED_COPY(dst, src, num_gentypes, dst_stride, 1);
return event;
}
diff --git a/libclc/opencl/lib/generic/atomic/atom_add.cl b/libclc/opencl/lib/generic/atomic/atom_add.cl
index 65d7ad595ace6..08fb3fecd5bc9 100644
--- a/libclc/opencl/lib/generic/atomic/atom_add.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_add.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_add_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_and.cl b/libclc/opencl/lib/generic/atomic/atom_and.cl
index 371e5f0aa4d0d..1dddd8e72f305 100644
--- a/libclc/opencl/lib/generic/atomic/atom_and.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_and.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_extended_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_and_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_cmpxchg.cl b/libclc/opencl/lib/generic/atomic/atom_cmpxchg.cl
index f129be9809e51..5ae6aa30a8358 100644
--- a/libclc/opencl/lib/generic/atomic/atom_cmpxchg.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_cmpxchg.cl
@@ -9,35 +9,35 @@
#include <clc/opencl/atomic/atom_cmpxchg.h>
#include <clc/opencl/atomic/atomic_cmpxchg.h>
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \
TYPE val) { \
return atomic_cmpxchg(p, cmp, val); \
}
#ifdef cl_khr_global_int32_base_atomics
-IMPL(global, int)
-IMPL(global, unsigned int)
+__CLC_IMPL(global, int)
+__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-IMPL(local, int)
-IMPL(local, unsigned int)
+__CLC_IMPL(local, int)
+__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics
-#undef IMPL
+#undef __CLC_IMPL
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, \
TYPE val) { \
return __sync_val_compare_and_swap_8(p, cmp, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_dec.cl b/libclc/opencl/lib/generic/atomic/atom_dec.cl
index 2df721cae365a..af811042d307a 100644
--- a/libclc/opencl/lib/generic/atomic/atom_dec.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_dec.cl
@@ -10,33 +10,33 @@
#include <clc/opencl/atomic/atom_sub.h>
#include <clc/opencl/atomic/atomic_dec.h>
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \
return atomic_dec(p); \
}
#ifdef cl_khr_global_int32_base_atomics
-IMPL(global, int)
-IMPL(global, unsigned int)
+__CLC_IMPL(global, int)
+__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-IMPL(local, int)
-IMPL(local, unsigned int)
+__CLC_IMPL(local, int)
+__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics
-#undef IMPL
+#undef __CLC_IMPL
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \
return atom_sub(p, (TYPE)1); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_inc.cl b/libclc/opencl/lib/generic/atomic/atom_inc.cl
index dc7699a478020..f881b3a3caa6d 100644
--- a/libclc/opencl/lib/generic/atomic/atom_inc.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_inc.cl
@@ -10,33 +10,33 @@
#include <clc/opencl/atomic/atom_inc.h>
#include <clc/opencl/atomic/atomic_inc.h>
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \
return atomic_inc(p); \
}
#ifdef cl_khr_global_int32_base_atomics
-IMPL(global, int)
-IMPL(global, unsigned int)
+__CLC_IMPL(global, int)
+__CLC_IMPL(global, unsigned int)
#endif // cl_khr_global_int32_base_atomics
#ifdef cl_khr_local_int32_base_atomics
-IMPL(local, int)
-IMPL(local, unsigned int)
+__CLC_IMPL(local, int)
+__CLC_IMPL(local, unsigned int)
#endif // cl_khr_local_int32_base_atomics
-#undef IMPL
+#undef __CLC_IMPL
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \
return atom_add(p, (TYPE)1); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_max.cl b/libclc/opencl/lib/generic/atomic/atom_max.cl
index 2542191d04f53..83b532ac19a1e 100644
--- a/libclc/opencl/lib/generic/atomic/atom_max.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_max.cl
@@ -31,15 +31,15 @@ unsigned long
__clc__sync_fetch_and_umax_global_8(volatile global unsigned long *,
unsigned long);
-#define IMPL(AS, TYPE, OP) \
+#define __CLC_IMPL(AS, TYPE, OP) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \
return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \
}
-IMPL(global, long, max)
-IMPL(global, unsigned long, umax)
-IMPL(local, long, max)
-IMPL(local, unsigned long, umax)
-#undef IMPL
+__CLC_IMPL(global, long, max)
+__CLC_IMPL(global, unsigned long, umax)
+__CLC_IMPL(local, long, max)
+__CLC_IMPL(local, unsigned long, umax)
+#undef __CLC_IMPL
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_min.cl b/libclc/opencl/lib/generic/atomic/atom_min.cl
index 4e62804824d82..b52e34769cdd8 100644
--- a/libclc/opencl/lib/generic/atomic/atom_min.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_min.cl
@@ -31,15 +31,15 @@ unsigned long
__clc__sync_fetch_and_umin_global_8(volatile global unsigned long *,
unsigned long);
-#define IMPL(AS, TYPE, OP) \
+#define __CLC_IMPL(AS, TYPE, OP) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_min(volatile AS TYPE *p, TYPE val) { \
return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \
}
-IMPL(global, long, min)
-IMPL(global, unsigned long, umin)
-IMPL(local, long, min)
-IMPL(local, unsigned long, umin)
-#undef IMPL
+__CLC_IMPL(global, long, min)
+__CLC_IMPL(global, unsigned long, umin)
+__CLC_IMPL(local, long, min)
+__CLC_IMPL(local, unsigned long, umin)
+#undef __CLC_IMPL
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_or.cl b/libclc/opencl/lib/generic/atomic/atom_or.cl
index 30ad8e52ca232..fa9737f5f28ee 100644
--- a/libclc/opencl/lib/generic/atomic/atom_or.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_or.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_extended_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_or(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_or_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_sub.cl b/libclc/opencl/lib/generic/atomic/atom_sub.cl
index f6ee94db7469f..9a8acfa9116b8 100644
--- a/libclc/opencl/lib/generic/atomic/atom_sub.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_sub.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_sub_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_xchg.cl b/libclc/opencl/lib/generic/atomic/atom_xchg.cl
index 3fa17c950a82e..03f8a9c466c5f 100644
--- a/libclc/opencl/lib/generic/atomic/atom_xchg.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_xchg.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_base_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(volatile AS TYPE *p, TYPE val) { \
return __sync_swap_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_base_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atom_xor.cl b/libclc/opencl/lib/generic/atomic/atom_xor.cl
index ac08ef63b1a4b..392a4b794c698 100644
--- a/libclc/opencl/lib/generic/atomic/atom_xor.cl
+++ b/libclc/opencl/lib/generic/atomic/atom_xor.cl
@@ -23,15 +23,15 @@
#ifdef cl_khr_int64_extended_atomics
-#define IMPL(AS, TYPE) \
+#define __CLC_IMPL(AS, TYPE) \
_CLC_OVERLOAD _CLC_DEF TYPE atom_xor(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_xor_8(p, val); \
}
-IMPL(global, long)
-IMPL(global, unsigned long)
-IMPL(local, long)
-IMPL(local, unsigned long)
-#undef IMPL
+__CLC_IMPL(global, long)
+__CLC_IMPL(global, unsigned long)
+__CLC_IMPL(local, long)
+__CLC_IMPL(local, unsigned long)
+#undef __CLC_IMPL
#endif // cl_khr_int64_extended_atomics
diff --git a/libclc/opencl/lib/generic/atomic/atomic_add.cl b/libclc/opencl/lib/generic/atomic/atomic_add.cl
index a0effced7dc62..d005c1dd6ac51 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_add.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_add.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_add.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_add(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_add(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_and.cl b/libclc/opencl/lib/generic/atomic/atomic_and.cl
index 629e6638d3bc2..12558568b0e4e 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_and.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_and.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_and.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_and(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_and(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_cmpxchg.cl b/libclc/opencl/lib/generic/atomic/atomic_cmpxchg.cl
index db0495b004c1a..1045020a553fc 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_cmpxchg.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_cmpxchg.cl
@@ -8,14 +8,14 @@
#include <clc/opencl/atomic/atomic_cmpxchg.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_cmpxchg(volatile AS TYPE *p, TYPE cmp, \
TYPE val) { \
return __sync_val_compare_and_swap(p, cmp, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_strong.cl b/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_strong.cl
index 422c03f292071..2c1f07d8ca485 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_strong.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_strong.cl
@@ -12,7 +12,7 @@
#include <clc/atomic/clc_atomic_compare_exchange.h>
#include <clc/opencl/atomic/atomic_compare_exchange_strong.h>
-#define FUNCTION atomic_compare_exchange_strong
+#define __CLC_FUNCTION atomic_compare_exchange_strong
#define __CLC_COMPARE_EXCHANGE
#define __CLC_BODY <atomic_def.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_weak.cl b/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_weak.cl
index 8a6b3c4f0110e..69bdf37250f70 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_weak.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_compare_exchange_weak.cl
@@ -12,7 +12,7 @@
#include <clc/atomic/clc_atomic_compare_exchange.h>
#include <clc/opencl/atomic/atomic_compare_exchange_weak.h>
-#define FUNCTION atomic_compare_exchange_weak
+#define __CLC_FUNCTION atomic_compare_exchange_weak
#define __CLC_COMPARE_EXCHANGE
#define __CLC_BODY <atomic_def.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_dec.cl b/libclc/opencl/lib/generic/atomic/atomic_dec.cl
index 6de55bc0b9845..ee38267723369 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_dec.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_dec.cl
@@ -9,8 +9,8 @@
#include <clc/atomic/clc_atomic_dec.h>
#include <clc/opencl/atomic/atomic_dec.h>
-#define FUNCTION atomic_dec
-#define __IMPL_FUNCTION __clc_atomic_dec
+#define __CLC_FUNCTION atomic_dec
+#define __CLC_IMPL_FUNCTION __clc_atomic_dec
#define __CLC_BODY <atomic_inc_dec.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_def.inc b/libclc/opencl/lib/generic/atomic/atomic_def.inc
index ce192bf844938..a4ccab5990888 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_def.inc
+++ b/libclc/opencl/lib/generic/atomic/atomic_def.inc
@@ -10,37 +10,37 @@
#if defined(__opencl_c_fp64) && (defined(cl_khr_int64_base_atomics) && \
defined(cl_khr_int64_extended_atomics))
-#define HAVE_64_ATOMIC
+#define __CLC_HAVE_64_ATOMIC
#endif
-#if defined(__CLC_FPSIZE) && (__CLC_FPSIZE < 64 || defined(HAVE_64_ATOMIC)
-#define HAVE_FP_ATOMIC
+#if defined(__CLC_FPSIZE) && (__CLC_FPSIZE < 64 || defined(__CLC_HAVE_64_ATOMIC)
+#define __CLC_HAVE_FP_ATOMIC
#endif
#if defined(__CLC_GENSIZE) && \
((__CLC_GENSIZE == 32) || \
- (__CLC_GENSIZE == 64 && defined(HAVE_64_ATOMIC)))
-#define HAVE_INT_ATOMIC
+ (__CLC_GENSIZE == 64 && defined(__CLC_HAVE_64_ATOMIC)))
+#define __CLC_HAVE_INT_ATOMIC
#endif
-#if defined(HAVE_FP_ATOMIC) || defined(HAVE_INT_ATOMIC)
+#if defined(__CLC_HAVE_FP_ATOMIC) || defined(__CLC_HAVE_INT_ATOMIC)
#define __CLC_ATOMIC_GENTYPE __CLC_XCONCAT(atomic_, __CLC_GENTYPE)
#ifdef __CLC_NO_VALUE_ARG
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr) { \
- return __IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, \
- __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
+ return __CLC_IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, \
+ __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
}
#elif defined(__CLC_RETURN_VOID)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF void FUNCTION( \
+ _CLC_OVERLOAD _CLC_DEF void __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, __CLC_GENTYPE Value) { \
- __IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, Value, \
- __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
+ __CLC_IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, Value, \
+ __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
}
#elif defined(__CLC_COMPARE_EXCHANGE)
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, \
ADDRSPACE __CLC_GENTYPE *Expected, __CLC_GENTYPE Desired) { \
__CLC_GENTYPE Comparator = *Expected; \
@@ -55,10 +55,10 @@
}
#else
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_ATOMIC_GENTYPE *Ptr, __CLC_GENTYPE Value) { \
- return __IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, Value, \
- __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
+ return __CLC_IMPL_FUNCTION((volatile ADDRSPACE __CLC_GENTYPE *)Ptr, Value, \
+ __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
}
#endif
@@ -70,10 +70,10 @@ __CLC_DEFINE_ATOMIC()
#undef __CLC_DEFINE_ATOMIC
-#endif // HAVE_FP_ATOMIC || HAVE_INT_ATOMIC
+#endif // __CLC_HAVE_FP_ATOMIC || __CLC_HAVE_INT_ATOMIC
-#undef HAVE_INT_ATOMIC
-#undef HAVE_FP_ATOMIC
-#undef HAVE_64_ATOMIC
+#undef __CLC_HAVE_INT_ATOMIC
+#undef __CLC_HAVE_FP_ATOMIC
+#undef __CLC_HAVE_64_ATOMIC
#endif // __CLC_SCALAR
diff --git a/libclc/opencl/lib/generic/atomic/atomic_exchange.cl b/libclc/opencl/lib/generic/atomic/atomic_exchange.cl
index 6dae6c0a77599..5f7e2fa593e3f 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_exchange.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_exchange.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_exchange.h>
#include <clc/opencl/atomic/atomic_exchange.h>
-#define FUNCTION atomic_exchange
-#define __IMPL_FUNCTION __clc_atomic_exchange
+#define __CLC_FUNCTION atomic_exchange
+#define __CLC_IMPL_FUNCTION __clc_atomic_exchange
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_add.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_add.cl
index bbaa1c2b0dacf..0362ff89d1d78 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_add.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_add.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_add.h>
#include <clc/opencl/atomic/atomic_fetch_add.h>
-#define FUNCTION atomic_fetch_add
-#define __IMPL_FUNCTION __clc_atomic_fetch_add
+#define __CLC_FUNCTION atomic_fetch_add
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_add
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_and.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_and.cl
index 73925844c9357..a1796f20c6e44 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_and.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_and.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_and.h>
#include <clc/opencl/atomic/atomic_fetch_and.h>
-#define FUNCTION atomic_fetch_and
-#define __IMPL_FUNCTION __clc_atomic_fetch_and
+#define __CLC_FUNCTION atomic_fetch_and
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_and
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_max.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_max.cl
index 8c8ce11cc575f..03b5d1d8ae7bd 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_max.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_max.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_max.h>
#include <clc/opencl/atomic/atomic_fetch_max.h>
-#define FUNCTION atomic_fetch_max
-#define __IMPL_FUNCTION __clc_atomic_fetch_max
+#define __CLC_FUNCTION atomic_fetch_max
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_max
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_min.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_min.cl
index 550459cee32d6..60ffeff04cc6a 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_min.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_min.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_min.h>
#include <clc/opencl/atomic/atomic_fetch_min.h>
-#define FUNCTION atomic_fetch_min
-#define __IMPL_FUNCTION __clc_atomic_fetch_min
+#define __CLC_FUNCTION atomic_fetch_min
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_min
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_or.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_or.cl
index 2606ff3c99673..8f4100bb150e3 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_or.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_or.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_or.h>
#include <clc/opencl/atomic/atomic_fetch_or.h>
-#define FUNCTION atomic_fetch_or
-#define __IMPL_FUNCTION __clc_atomic_fetch_or
+#define __CLC_FUNCTION atomic_fetch_or
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_or
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_sub.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_sub.cl
index 33772233bebed..ecb5b4315ee86 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_sub.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_sub.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_sub.h>
#include <clc/opencl/atomic/atomic_fetch_sub.h>
-#define FUNCTION atomic_fetch_sub
-#define __IMPL_FUNCTION __clc_atomic_fetch_sub
+#define __CLC_FUNCTION atomic_fetch_sub
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_sub
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_fetch_xor.cl b/libclc/opencl/lib/generic/atomic/atomic_fetch_xor.cl
index 6f6503e588b6f..c49a55820c8d4 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_fetch_xor.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_fetch_xor.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_fetch_xor.h>
#include <clc/opencl/atomic/atomic_fetch_xor.h>
-#define FUNCTION atomic_fetch_xor
-#define __IMPL_FUNCTION __clc_atomic_fetch_xor
+#define __CLC_FUNCTION atomic_fetch_xor
+#define __CLC_IMPL_FUNCTION __clc_atomic_fetch_xor
#define __CLC_BODY <atomic_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_inc.cl b/libclc/opencl/lib/generic/atomic/atomic_inc.cl
index a160b2e2370fc..7cf82b25a0d43 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_inc.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_inc.cl
@@ -9,8 +9,8 @@
#include <clc/atomic/clc_atomic_inc.h>
#include <clc/opencl/atomic/atomic_inc.h>
-#define FUNCTION atomic_inc
-#define __IMPL_FUNCTION __clc_atomic_inc
+#define __CLC_FUNCTION atomic_inc
+#define __CLC_IMPL_FUNCTION __clc_atomic_inc
#define __CLC_BODY <atomic_inc_dec.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_inc_dec.inc b/libclc/opencl/lib/generic/atomic/atomic_inc_dec.inc
index 0bcf300dd284a..03eb5d1b33057 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_inc_dec.inc
+++ b/libclc/opencl/lib/generic/atomic/atomic_inc_dec.inc
@@ -11,9 +11,9 @@
#if __CLC_GENSIZE == 32
#define __CLC_DEFINE_ATOMIC(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION( \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION( \
volatile ADDRSPACE __CLC_GENTYPE *Ptr) { \
- return __IMPL_FUNCTION(Ptr, __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
+ return __CLC_IMPL_FUNCTION(Ptr, __ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE); \
}
__CLC_DEFINE_ATOMIC(global)
diff --git a/libclc/opencl/lib/generic/atomic/atomic_load.cl b/libclc/opencl/lib/generic/atomic/atomic_load.cl
index 459265473a8c8..e904330be0064 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_load.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_load.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_load.h>
#include <clc/opencl/atomic/atomic_load.h>
-#define FUNCTION atomic_load
-#define __IMPL_FUNCTION __clc_atomic_load
+#define __CLC_FUNCTION atomic_load
+#define __CLC_IMPL_FUNCTION __clc_atomic_load
#define __CLC_NO_VALUE_ARG
#define __CLC_BODY <atomic_def.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_max.cl b/libclc/opencl/lib/generic/atomic/atomic_max.cl
index ae929f0523dc2..aa482a8f46397 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_max.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_max.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_max.h>
-#define IMPL(TYPE, AS, OP) \
+#define __CLC_IMPL(TYPE, AS, OP) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_max(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_##OP(p, val); \
}
-IMPL(int, global, max)
-IMPL(unsigned int, global, umax)
-IMPL(int, local, max)
-IMPL(unsigned int, local, umax)
-#undef IMPL
+__CLC_IMPL(int, global, max)
+__CLC_IMPL(unsigned int, global, umax)
+__CLC_IMPL(int, local, max)
+__CLC_IMPL(unsigned int, local, umax)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_min.cl b/libclc/opencl/lib/generic/atomic/atomic_min.cl
index c7ebe71ee8295..7f39e94316846 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_min.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_min.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_min.h>
-#define IMPL(TYPE, AS, OP) \
+#define __CLC_IMPL(TYPE, AS, OP) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_min(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_##OP(p, val); \
}
-IMPL(int, global, min)
-IMPL(unsigned int, global, umin)
-IMPL(int, local, min)
-IMPL(unsigned int, local, umin)
-#undef IMPL
+__CLC_IMPL(int, global, min)
+__CLC_IMPL(unsigned int, global, umin)
+__CLC_IMPL(int, local, min)
+__CLC_IMPL(unsigned int, local, umin)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_or.cl b/libclc/opencl/lib/generic/atomic/atomic_or.cl
index 45fb865689655..ad14cd2178555 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_or.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_or.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_or.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_or(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_or(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_store.cl b/libclc/opencl/lib/generic/atomic/atomic_store.cl
index 67f2c8457fc10..584e29ef99a5f 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_store.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_store.cl
@@ -12,8 +12,8 @@
#include <clc/atomic/clc_atomic_store.h>
#include <clc/opencl/atomic/atomic_store.h>
-#define FUNCTION atomic_store
-#define __IMPL_FUNCTION __clc_atomic_store
+#define __CLC_FUNCTION atomic_store
+#define __CLC_IMPL_FUNCTION __clc_atomic_store
#define __CLC_RETURN_VOID
#define __CLC_BODY <atomic_def.inc>
diff --git a/libclc/opencl/lib/generic/atomic/atomic_sub.cl b/libclc/opencl/lib/generic/atomic/atomic_sub.cl
index 74977f15155fb..2e51c4c2ce02f 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_sub.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_sub.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_sub.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_sub(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_sub(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_xchg.cl b/libclc/opencl/lib/generic/atomic/atomic_xchg.cl
index 883132caf9fbb..2585a5427392e 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_xchg.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_xchg.cl
@@ -17,13 +17,13 @@ _CLC_OVERLOAD _CLC_DEF float atomic_xchg(volatile local float *p, float val) {
return as_float(atomic_xchg((volatile local uint *)p, as_uint(val)));
}
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_xchg(volatile AS TYPE *p, TYPE val) { \
return __sync_swap_4(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/atomic/atomic_xor.cl b/libclc/opencl/lib/generic/atomic/atomic_xor.cl
index 246752c258374..0228134397464 100644
--- a/libclc/opencl/lib/generic/atomic/atomic_xor.cl
+++ b/libclc/opencl/lib/generic/atomic/atomic_xor.cl
@@ -8,13 +8,13 @@
#include <clc/opencl/atomic/atomic_xor.h>
-#define IMPL(TYPE, AS) \
+#define __CLC_IMPL(TYPE, AS) \
_CLC_OVERLOAD _CLC_DEF TYPE atomic_xor(volatile AS TYPE *p, TYPE val) { \
return __sync_fetch_and_xor(p, val); \
}
-IMPL(int, global)
-IMPL(unsigned int, global)
-IMPL(int, local)
-IMPL(unsigned int, local)
-#undef IMPL
+__CLC_IMPL(int, global)
+__CLC_IMPL(unsigned int, global)
+__CLC_IMPL(int, local)
+__CLC_IMPL(unsigned int, local)
+#undef __CLC_IMPL
diff --git a/libclc/opencl/lib/generic/common/degrees.cl b/libclc/opencl/lib/generic/common/degrees.cl
index d989fa6382edb..15b85af997b4d 100644
--- a/libclc/opencl/lib/generic/common/degrees.cl
+++ b/libclc/opencl/lib/generic/common/degrees.cl
@@ -9,7 +9,7 @@
#include <clc/common/clc_degrees.h>
#include <clc/opencl/common/degrees.h>
-#define FUNCTION degrees
+#define __CLC_FUNCTION degrees
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/common/radians.cl b/libclc/opencl/lib/generic/common/radians.cl
index 1da38920d43fb..6550cf458a7a8 100644
--- a/libclc/opencl/lib/generic/common/radians.cl
+++ b/libclc/opencl/lib/generic/common/radians.cl
@@ -9,7 +9,7 @@
#include <clc/common/clc_radians.h>
#include <clc/opencl/common/radians.h>
-#define FUNCTION radians
+#define __CLC_FUNCTION radians
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/common/sign.cl b/libclc/opencl/lib/generic/common/sign.cl
index 9afcb7375e96a..7add739be6a9c 100644
--- a/libclc/opencl/lib/generic/common/sign.cl
+++ b/libclc/opencl/lib/generic/common/sign.cl
@@ -10,7 +10,7 @@
#include <clc/common/clc_sign.h>
#include <clc/opencl/common/sign.h>
-#define FUNCTION sign
+#define __CLC_FUNCTION sign
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/distance.cl b/libclc/opencl/lib/generic/geometric/distance.cl
index 54c78d3609ba7..4d9f5403f8c2d 100644
--- a/libclc/opencl/lib/generic/geometric/distance.cl
+++ b/libclc/opencl/lib/generic/geometric/distance.cl
@@ -9,6 +9,6 @@
#include <clc/geometric/clc_distance.h>
#include <clc/opencl/geometric/distance.h>
-#define FUNCTION distance
+#define __CLC_FUNCTION distance
#define __CLC_BODY <clc/geometric/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/dot.cl b/libclc/opencl/lib/generic/geometric/dot.cl
index 05425aafb0404..fc207c8fc155a 100644
--- a/libclc/opencl/lib/generic/geometric/dot.cl
+++ b/libclc/opencl/lib/generic/geometric/dot.cl
@@ -9,6 +9,6 @@
#include <clc/geometric/clc_dot.h>
#include <clc/opencl/geometric/dot.h>
-#define FUNCTION dot
+#define __CLC_FUNCTION dot
#define __CLC_BODY <clc/geometric/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/fast_distance.cl b/libclc/opencl/lib/generic/geometric/fast_distance.cl
index bc30c298a2b9a..a9c2c66dc9a19 100644
--- a/libclc/opencl/lib/generic/geometric/fast_distance.cl
+++ b/libclc/opencl/lib/generic/geometric/fast_distance.cl
@@ -9,7 +9,7 @@
#include <clc/geometric/clc_fast_distance.h>
#include <clc/opencl/geometric/fast_distance.h>
-#define __FLOAT_ONLY
-#define FUNCTION fast_distance
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fast_distance
#define __CLC_BODY <clc/geometric/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/fast_length.cl b/libclc/opencl/lib/generic/geometric/fast_length.cl
index 407080900cceb..8e6ce1aa5c564 100644
--- a/libclc/opencl/lib/generic/geometric/fast_length.cl
+++ b/libclc/opencl/lib/generic/geometric/fast_length.cl
@@ -9,7 +9,7 @@
#include <clc/geometric/clc_fast_length.h>
#include <clc/opencl/geometric/fast_length.h>
-#define __FLOAT_ONLY
-#define FUNCTION fast_length
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fast_length
#define __CLC_BODY <clc/geometric/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/fast_normalize.cl b/libclc/opencl/lib/generic/geometric/fast_normalize.cl
index 195081371a5b2..d2f7111516f44 100644
--- a/libclc/opencl/lib/generic/geometric/fast_normalize.cl
+++ b/libclc/opencl/lib/generic/geometric/fast_normalize.cl
@@ -9,8 +9,8 @@
#include <clc/geometric/clc_fast_normalize.h>
#include <clc/opencl/geometric/fast_normalize.h>
-#define FUNCTION fast_normalize
-#define __FLOAT_ONLY
+#define __CLC_FUNCTION fast_normalize
+#define __CLC_FLOAT_ONLY
#define __CLC_GEOMETRIC_RET_GENTYPE
#define __CLC_BODY <clc/geometric/unary_def.inc>
diff --git a/libclc/opencl/lib/generic/geometric/length.cl b/libclc/opencl/lib/generic/geometric/length.cl
index 0b0ebaa74d951..59e2055020d88 100644
--- a/libclc/opencl/lib/generic/geometric/length.cl
+++ b/libclc/opencl/lib/generic/geometric/length.cl
@@ -9,6 +9,6 @@
#include <clc/geometric/clc_length.h>
#include <clc/opencl/geometric/length.h>
-#define FUNCTION length
+#define __CLC_FUNCTION length
#define __CLC_BODY <clc/geometric/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/geometric/normalize.cl b/libclc/opencl/lib/generic/geometric/normalize.cl
index eb84ffd382129..968d4001ae999 100644
--- a/libclc/opencl/lib/generic/geometric/normalize.cl
+++ b/libclc/opencl/lib/generic/geometric/normalize.cl
@@ -9,7 +9,7 @@
#include <clc/geometric/clc_normalize.h>
#include <clc/opencl/geometric/normalize.h>
-#define FUNCTION normalize
+#define __CLC_FUNCTION normalize
#define __CLC_GEOMETRIC_RET_GENTYPE
#define __CLC_BODY <clc/geometric/unary_def.inc>
diff --git a/libclc/opencl/lib/generic/integer/add_sat.cl b/libclc/opencl/lib/generic/integer/add_sat.cl
index 50d989a47211b..6cde612e5fb0f 100644
--- a/libclc/opencl/lib/generic/integer/add_sat.cl
+++ b/libclc/opencl/lib/generic/integer/add_sat.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_add_sat.h>
#include <clc/opencl/integer/add_sat.h>
-#define FUNCTION add_sat
+#define __CLC_FUNCTION add_sat
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/bit_reverse.cl b/libclc/opencl/lib/generic/integer/bit_reverse.cl
index 23181b6b3eba5..b35a5c473a1e6 100644
--- a/libclc/opencl/lib/generic/integer/bit_reverse.cl
+++ b/libclc/opencl/lib/generic/integer/bit_reverse.cl
@@ -11,7 +11,7 @@
#include <clc/integer/clc_bit_reverse.h>
#include <clc/opencl/integer/bit_reverse.h>
-#define FUNCTION bit_reverse
+#define __CLC_FUNCTION bit_reverse
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_def.inc b/libclc/opencl/lib/generic/integer/bitfield_extract_def.inc
index 0262f67732afc..d3b8badcc8c99 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_extract_def.inc
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_def.inc
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#ifndef __IMPL_FUNCTION
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#ifndef __CLC_IMPL_FUNCTION
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif
-_CLC_OVERLOAD _CLC_DEF __RETTYPE FUNCTION(__CLC_GENTYPE base, uint offset,
- uint count) {
- return __IMPL_FUNCTION(FUNCTION)(base, offset, count);
+_CLC_OVERLOAD _CLC_DEF __CLC_RETTYPE __CLC_FUNCTION(__CLC_GENTYPE base,
+ uint offset, uint count) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(base, offset, count);
}
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
index eaa4ac779cfd1..ad49cd36b766e 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
@@ -11,8 +11,8 @@
#include <clc/integer/clc_bitfield_extract_signed.h>
#include <clc/opencl/integer/bitfield_extract_signed.h>
-#define FUNCTION bitfield_extract_signed
-#define __RETTYPE __CLC_S_GENTYPE
+#define __CLC_FUNCTION bitfield_extract_signed
+#define __CLC_RETTYPE __CLC_S_GENTYPE
#define __CLC_BODY <bitfield_extract_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
index fd63d5d6dee30..e2fe92cfcce82 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
@@ -11,8 +11,8 @@
#include <clc/integer/clc_bitfield_extract_unsigned.h>
#include <clc/opencl/integer/bitfield_extract_unsigned.h>
-#define FUNCTION bitfield_extract_unsigned
-#define __RETTYPE __CLC_U_GENTYPE
+#define __CLC_FUNCTION bitfield_extract_unsigned
+#define __CLC_RETTYPE __CLC_U_GENTYPE
#define __CLC_BODY <bitfield_extract_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/bitfield_insert.cl b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
index 6b441155f393b..c165bd756ffef 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_insert.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
@@ -11,7 +11,7 @@
#include <clc/integer/clc_bitfield_insert.h>
#include <clc/opencl/integer/bitfield_insert.h>
-#define FUNCTION bitfield_insert
+#define __CLC_FUNCTION bitfield_insert
#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/clz.cl b/libclc/opencl/lib/generic/integer/clz.cl
index 58110df1eec24..d0509cba5913a 100644
--- a/libclc/opencl/lib/generic/integer/clz.cl
+++ b/libclc/opencl/lib/generic/integer/clz.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_clz.h>
#include <clc/opencl/integer/clz.h>
-#define FUNCTION clz
+#define __CLC_FUNCTION clz
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/ctz.cl b/libclc/opencl/lib/generic/integer/ctz.cl
index cbb167275a4a6..640ccfa5f3117 100644
--- a/libclc/opencl/lib/generic/integer/ctz.cl
+++ b/libclc/opencl/lib/generic/integer/ctz.cl
@@ -11,7 +11,7 @@
#include <clc/integer/clc_ctz.h>
#include <clc/opencl/integer/ctz.h>
-#define FUNCTION ctz
+#define __CLC_FUNCTION ctz
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/hadd.cl b/libclc/opencl/lib/generic/integer/hadd.cl
index e9edc88bce02c..0082524b55af2 100644
--- a/libclc/opencl/lib/generic/integer/hadd.cl
+++ b/libclc/opencl/lib/generic/integer/hadd.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_hadd.h>
#include <clc/opencl/integer/hadd.h>
-#define FUNCTION hadd
+#define __CLC_FUNCTION hadd
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/mad24.cl b/libclc/opencl/lib/generic/integer/mad24.cl
index 5e9dfb3b3031a..fc8e0e3171334 100644
--- a/libclc/opencl/lib/generic/integer/mad24.cl
+++ b/libclc/opencl/lib/generic/integer/mad24.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_mad24.h>
#include <clc/opencl/integer/mad24.h>
-#define FUNCTION mad24
+#define __CLC_FUNCTION mad24
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/integer/gentype24.inc>
diff --git a/libclc/opencl/lib/generic/integer/mad_hi.cl b/libclc/opencl/lib/generic/integer/mad_hi.cl
index 786614e42bc8b..20d096c59650d 100644
--- a/libclc/opencl/lib/generic/integer/mad_hi.cl
+++ b/libclc/opencl/lib/generic/integer/mad_hi.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_mad_hi.h>
#include <clc/opencl/integer/mad_hi.h>
-#define FUNCTION mad_hi
+#define __CLC_FUNCTION mad_hi
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/mad_sat.cl b/libclc/opencl/lib/generic/integer/mad_sat.cl
index 54ddc0eed2d17..310b31a0ca239 100644
--- a/libclc/opencl/lib/generic/integer/mad_sat.cl
+++ b/libclc/opencl/lib/generic/integer/mad_sat.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_mad_sat.h>
#include <clc/opencl/integer/mad_sat.h>
-#define FUNCTION mad_sat
+#define __CLC_FUNCTION mad_sat
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/mul24.cl b/libclc/opencl/lib/generic/integer/mul24.cl
index e6db6b89c5d98..243bff77da91a 100644
--- a/libclc/opencl/lib/generic/integer/mul24.cl
+++ b/libclc/opencl/lib/generic/integer/mul24.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_mul24.h>
#include <clc/opencl/integer/mul24.h>
-#define FUNCTION mul24
+#define __CLC_FUNCTION mul24
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype24.inc>
diff --git a/libclc/opencl/lib/generic/integer/mul_hi.cl b/libclc/opencl/lib/generic/integer/mul_hi.cl
index 4c7b8c2caa994..99d3051a0df9e 100644
--- a/libclc/opencl/lib/generic/integer/mul_hi.cl
+++ b/libclc/opencl/lib/generic/integer/mul_hi.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_mul_hi.h>
#include <clc/opencl/integer/mul_hi.h>
-#define FUNCTION mul_hi
+#define __CLC_FUNCTION mul_hi
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/popcount.cl b/libclc/opencl/lib/generic/integer/popcount.cl
index 3c33c82302c39..e4219b4ff9c37 100644
--- a/libclc/opencl/lib/generic/integer/popcount.cl
+++ b/libclc/opencl/lib/generic/integer/popcount.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_popcount.h>
#include <clc/opencl/integer/popcount.h>
-#define FUNCTION popcount
+#define __CLC_FUNCTION popcount
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/rhadd.cl b/libclc/opencl/lib/generic/integer/rhadd.cl
index f835511899429..df9f1eff3e2d5 100644
--- a/libclc/opencl/lib/generic/integer/rhadd.cl
+++ b/libclc/opencl/lib/generic/integer/rhadd.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_rhadd.h>
#include <clc/opencl/integer/rhadd.h>
-#define FUNCTION rhadd
+#define __CLC_FUNCTION rhadd
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/rotate.cl b/libclc/opencl/lib/generic/integer/rotate.cl
index 282270f3b3ff2..f5b6195275deb 100644
--- a/libclc/opencl/lib/generic/integer/rotate.cl
+++ b/libclc/opencl/lib/generic/integer/rotate.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_rotate.h>
#include <clc/opencl/integer/rotate.h>
-#define FUNCTION rotate
+#define __CLC_FUNCTION rotate
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/integer/sub_sat.cl b/libclc/opencl/lib/generic/integer/sub_sat.cl
index 0b45df1118f14..81517022160ae 100644
--- a/libclc/opencl/lib/generic/integer/sub_sat.cl
+++ b/libclc/opencl/lib/generic/integer/sub_sat.cl
@@ -9,7 +9,7 @@
#include <clc/integer/clc_sub_sat.h>
#include <clc/opencl/integer/sub_sat.h>
-#define FUNCTION sub_sat
+#define __CLC_FUNCTION sub_sat
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/acos.cl b/libclc/opencl/lib/generic/math/acos.cl
index 040b2b82f6f98..bdaeedf02e908 100644
--- a/libclc/opencl/lib/generic/math/acos.cl
+++ b/libclc/opencl/lib/generic/math/acos.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_acos.h>
#include <clc/opencl/math/acos.h>
-#define FUNCTION acos
+#define __CLC_FUNCTION acos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/acosh.cl b/libclc/opencl/lib/generic/math/acosh.cl
index 55b60bc99614a..c46532dbcbd95 100644
--- a/libclc/opencl/lib/generic/math/acosh.cl
+++ b/libclc/opencl/lib/generic/math/acosh.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_acosh.h>
#include <clc/opencl/math/acosh.h>
-#define FUNCTION acosh
+#define __CLC_FUNCTION acosh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/acospi.cl b/libclc/opencl/lib/generic/math/acospi.cl
index 2537c992e2ada..b6b0fb91250d0 100644
--- a/libclc/opencl/lib/generic/math/acospi.cl
+++ b/libclc/opencl/lib/generic/math/acospi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_acospi.h>
#include <clc/opencl/math/acospi.h>
-#define FUNCTION acospi
+#define __CLC_FUNCTION acospi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/asin.cl b/libclc/opencl/lib/generic/math/asin.cl
index 08dde1201392e..31fc36d746019 100644
--- a/libclc/opencl/lib/generic/math/asin.cl
+++ b/libclc/opencl/lib/generic/math/asin.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_asin.h>
#include <clc/opencl/math/asin.h>
-#define FUNCTION asin
+#define __CLC_FUNCTION asin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/asinh.cl b/libclc/opencl/lib/generic/math/asinh.cl
index 189392f50b5ee..3bdd8099f079b 100644
--- a/libclc/opencl/lib/generic/math/asinh.cl
+++ b/libclc/opencl/lib/generic/math/asinh.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_asinh.h>
#include <clc/opencl/math/asinh.h>
-#define FUNCTION asinh
+#define __CLC_FUNCTION asinh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/asinpi.cl b/libclc/opencl/lib/generic/math/asinpi.cl
index b9327faaccba5..6df9047ced3c5 100644
--- a/libclc/opencl/lib/generic/math/asinpi.cl
+++ b/libclc/opencl/lib/generic/math/asinpi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_asinpi.h>
#include <clc/opencl/math/asinpi.h>
-#define FUNCTION asinpi
+#define __CLC_FUNCTION asinpi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/atan.cl b/libclc/opencl/lib/generic/math/atan.cl
index e2b1530f9e4cf..157e50dd0e07a 100644
--- a/libclc/opencl/lib/generic/math/atan.cl
+++ b/libclc/opencl/lib/generic/math/atan.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_atan.h>
#include <clc/opencl/math/atan.h>
-#define FUNCTION atan
+#define __CLC_FUNCTION atan
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/atan2.cl b/libclc/opencl/lib/generic/math/atan2.cl
index 9f3d4a965e58a..7db630608867c 100644
--- a/libclc/opencl/lib/generic/math/atan2.cl
+++ b/libclc/opencl/lib/generic/math/atan2.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_atan2.h>
#include <clc/opencl/math/atan2.h>
-#define FUNCTION atan2
+#define __CLC_FUNCTION atan2
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/atan2pi.cl b/libclc/opencl/lib/generic/math/atan2pi.cl
index 9b3fea163f685..ed57c920f1b2d 100644
--- a/libclc/opencl/lib/generic/math/atan2pi.cl
+++ b/libclc/opencl/lib/generic/math/atan2pi.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_atan2pi.h>
#include <clc/opencl/math/atan2pi.h>
-#define FUNCTION atan2pi
+#define __CLC_FUNCTION atan2pi
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/atanh.cl b/libclc/opencl/lib/generic/math/atanh.cl
index 5e4564d347026..d0337ff1ffac3 100644
--- a/libclc/opencl/lib/generic/math/atanh.cl
+++ b/libclc/opencl/lib/generic/math/atanh.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_atanh.h>
#include <clc/opencl/math/atanh.h>
-#define FUNCTION atanh
+#define __CLC_FUNCTION atanh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/atanpi.cl b/libclc/opencl/lib/generic/math/atanpi.cl
index ddeb38e64e993..11630db430c71 100644
--- a/libclc/opencl/lib/generic/math/atanpi.cl
+++ b/libclc/opencl/lib/generic/math/atanpi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_atanpi.h>
#include <clc/opencl/math/atanpi.h>
-#define FUNCTION atanpi
+#define __CLC_FUNCTION atanpi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/cbrt.cl b/libclc/opencl/lib/generic/math/cbrt.cl
index dccb49a47dc03..0d670150ed4c9 100644
--- a/libclc/opencl/lib/generic/math/cbrt.cl
+++ b/libclc/opencl/lib/generic/math/cbrt.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_cbrt.inc>
#include <clc/opencl/math/cbrt.h>
-#define FUNCTION cbrt
+#define __CLC_FUNCTION cbrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/ceil.cl b/libclc/opencl/lib/generic/math/ceil.cl
index e312281b98a23..e1bffbcb68600 100644
--- a/libclc/opencl/lib/generic/math/ceil.cl
+++ b/libclc/opencl/lib/generic/math/ceil.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_ceil.h>
#include <clc/opencl/math/ceil.h>
-#define FUNCTION ceil
+#define __CLC_FUNCTION ceil
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/copysign.cl b/libclc/opencl/lib/generic/math/copysign.cl
index 7aa4cb2da0eec..5234b534631c8 100644
--- a/libclc/opencl/lib/generic/math/copysign.cl
+++ b/libclc/opencl/lib/generic/math/copysign.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_copysign.h>
#include <clc/opencl/math/copysign.h>
-#define FUNCTION copysign
+#define __CLC_FUNCTION copysign
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/cos.cl b/libclc/opencl/lib/generic/math/cos.cl
index fb40b6c00e3c8..69c9c37cf3e84 100644
--- a/libclc/opencl/lib/generic/math/cos.cl
+++ b/libclc/opencl/lib/generic/math/cos.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_cos.h>
#include <clc/opencl/math/cos.h>
-#define FUNCTION cos
+#define __CLC_FUNCTION cos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/cosh.cl b/libclc/opencl/lib/generic/math/cosh.cl
index 7106fc9f18fa5..de9e750c1a7f0 100644
--- a/libclc/opencl/lib/generic/math/cosh.cl
+++ b/libclc/opencl/lib/generic/math/cosh.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_cosh.h>
#include <clc/opencl/math/cosh.h>
-#define FUNCTION cosh
+#define __CLC_FUNCTION cosh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/cospi.cl b/libclc/opencl/lib/generic/math/cospi.cl
index 0e242ad0d4779..d9afd05bbabf3 100644
--- a/libclc/opencl/lib/generic/math/cospi.cl
+++ b/libclc/opencl/lib/generic/math/cospi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_cospi.h>
#include <clc/opencl/math/cospi.h>
-#define FUNCTION cospi
+#define __CLC_FUNCTION cospi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/erf.cl b/libclc/opencl/lib/generic/math/erf.cl
index 83c38867e0460..8d5a80ba10e47 100644
--- a/libclc/opencl/lib/generic/math/erf.cl
+++ b/libclc/opencl/lib/generic/math/erf.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_erf.h>
#include <clc/opencl/math/erf.h>
-#define FUNCTION erf
+#define __CLC_FUNCTION erf
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/erfc.cl b/libclc/opencl/lib/generic/math/erfc.cl
index 1c473999bba93..a3fda46237d99 100644
--- a/libclc/opencl/lib/generic/math/erfc.cl
+++ b/libclc/opencl/lib/generic/math/erfc.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_erfc.h>
#include <clc/opencl/math/erfc.h>
-#define FUNCTION erfc
+#define __CLC_FUNCTION erfc
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/exp.cl b/libclc/opencl/lib/generic/math/exp.cl
index 8125ce314e8e4..a9fd07a26d0e1 100644
--- a/libclc/opencl/lib/generic/math/exp.cl
+++ b/libclc/opencl/lib/generic/math/exp.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_exp.h>
#include <clc/opencl/math/exp.h>
-#define FUNCTION exp
+#define __CLC_FUNCTION exp
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/exp10.cl b/libclc/opencl/lib/generic/math/exp10.cl
index f8c0f94a990bc..7db7bafd226f4 100644
--- a/libclc/opencl/lib/generic/math/exp10.cl
+++ b/libclc/opencl/lib/generic/math/exp10.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_exp10.h>
#include <clc/opencl/math/exp10.h>
-#define FUNCTION exp10
+#define __CLC_FUNCTION exp10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/exp2.cl b/libclc/opencl/lib/generic/math/exp2.cl
index dc75c2201a460..1ffc34ae13ce0 100644
--- a/libclc/opencl/lib/generic/math/exp2.cl
+++ b/libclc/opencl/lib/generic/math/exp2.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_exp2.h>
#include <clc/opencl/math/exp2.h>
-#define FUNCTION exp2
+#define __CLC_FUNCTION exp2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/expm1.cl b/libclc/opencl/lib/generic/math/expm1.cl
index 7507786c2ad09..69c852fc7e79c 100644
--- a/libclc/opencl/lib/generic/math/expm1.cl
+++ b/libclc/opencl/lib/generic/math/expm1.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_expm1.h>
#include <clc/opencl/math/expm1.h>
-#define FUNCTION expm1
+#define __CLC_FUNCTION expm1
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fabs.cl b/libclc/opencl/lib/generic/math/fabs.cl
index 0d3128f3b2a1f..d88c6c84be6d6 100644
--- a/libclc/opencl/lib/generic/math/fabs.cl
+++ b/libclc/opencl/lib/generic/math/fabs.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_fabs.h>
#include <clc/opencl/math/fabs.h>
-#define FUNCTION fabs
+#define __CLC_FUNCTION fabs
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fdim.cl b/libclc/opencl/lib/generic/math/fdim.cl
index ecdcd3aef3a7d..edaa8a3daef45 100644
--- a/libclc/opencl/lib/generic/math/fdim.cl
+++ b/libclc/opencl/lib/generic/math/fdim.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_fdim.h>
#include <clc/opencl/math/fdim.h>
-#define FUNCTION fdim
+#define __CLC_FUNCTION fdim
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/floor.cl b/libclc/opencl/lib/generic/math/floor.cl
index cda8363f91360..2edc1df21bc59 100644
--- a/libclc/opencl/lib/generic/math/floor.cl
+++ b/libclc/opencl/lib/generic/math/floor.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_floor.h>
#include <clc/opencl/math/floor.h>
-#define FUNCTION floor
+#define __CLC_FUNCTION floor
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fma.cl b/libclc/opencl/lib/generic/math/fma.cl
index 867b975069013..199d2683a8988 100644
--- a/libclc/opencl/lib/generic/math/fma.cl
+++ b/libclc/opencl/lib/generic/math/fma.cl
@@ -10,7 +10,7 @@
#include <clc/math/math.h>
#include <clc/opencl/math/fma.h>
-#define FUNCTION fma
+#define __CLC_FUNCTION fma
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fmax.cl b/libclc/opencl/lib/generic/math/fmax.cl
index 7dbd6fe0bd7f4..ae7a70a69fe38 100644
--- a/libclc/opencl/lib/generic/math/fmax.cl
+++ b/libclc/opencl/lib/generic/math/fmax.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_fmax.h>
#include <clc/opencl/math/fmax.h>
-#define FUNCTION fmax
+#define __CLC_FUNCTION fmax
#define __CLC_BODY <clc/shared/binary_def_with_scalar_second_arg.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fmin.cl b/libclc/opencl/lib/generic/math/fmin.cl
index ee0dca480073e..4b55a93bb70fa 100644
--- a/libclc/opencl/lib/generic/math/fmin.cl
+++ b/libclc/opencl/lib/generic/math/fmin.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_fmin.h>
#include <clc/opencl/math/fmin.h>
-#define FUNCTION fmin
+#define __CLC_FUNCTION fmin
#define __CLC_BODY <clc/shared/binary_def_with_scalar_second_arg.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fmod.cl b/libclc/opencl/lib/generic/math/fmod.cl
index ec1904d213d87..338b803347217 100644
--- a/libclc/opencl/lib/generic/math/fmod.cl
+++ b/libclc/opencl/lib/generic/math/fmod.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_fmod.h>
#include <clc/opencl/math/fmod.h>
-#define FUNCTION fmod
+#define __CLC_FUNCTION fmod
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/fract.cl b/libclc/opencl/lib/generic/math/fract.cl
index 9567072bf4c39..00e8eb456cf64 100644
--- a/libclc/opencl/lib/generic/math/fract.cl
+++ b/libclc/opencl/lib/generic/math/fract.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_fract.h>
#include <clc/opencl/math/fract.h>
-#define FUNCTION fract
+#define __CLC_FUNCTION fract
#define __CLC_BODY <clc/math/unary_def_with_ptr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/frexp.cl b/libclc/opencl/lib/generic/math/frexp.cl
index 3ac9be792ae65..207f9de1c99ec 100644
--- a/libclc/opencl/lib/generic/math/frexp.cl
+++ b/libclc/opencl/lib/generic/math/frexp.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_frexp.h>
#include <clc/opencl/math/frexp.h>
-#define FUNCTION frexp
+#define __CLC_FUNCTION frexp
#define __CLC_BODY <clc/math/unary_def_with_int_ptr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_cos.cl b/libclc/opencl/lib/generic/math/half_cos.cl
index 377c4d1642599..d1a5352b52670 100644
--- a/libclc/opencl/lib/generic/math/half_cos.cl
+++ b/libclc/opencl/lib/generic/math/half_cos.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_cos.h>
#include <clc/opencl/math/half_cos.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_cos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_divide.cl b/libclc/opencl/lib/generic/math/half_divide.cl
index 730617ba67fb3..10c418b9312db 100644
--- a/libclc/opencl/lib/generic/math/half_divide.cl
+++ b/libclc/opencl/lib/generic/math/half_divide.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_divide.h>
#include <clc/opencl/math/half_divide.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_divide
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_divide
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_exp.cl b/libclc/opencl/lib/generic/math/half_exp.cl
index 05b8753b2faf4..fbbf564cb697a 100644
--- a/libclc/opencl/lib/generic/math/half_exp.cl
+++ b/libclc/opencl/lib/generic/math/half_exp.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_exp.h>
#include <clc/opencl/math/half_exp.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_exp
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_exp10.cl b/libclc/opencl/lib/generic/math/half_exp10.cl
index b4e46aaa771cd..e655f5f89ff69 100644
--- a/libclc/opencl/lib/generic/math/half_exp10.cl
+++ b/libclc/opencl/lib/generic/math/half_exp10.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_exp10.h>
#include <clc/opencl/math/half_exp10.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_exp10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_exp10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_exp2.cl b/libclc/opencl/lib/generic/math/half_exp2.cl
index 51fe9f72477a9..417d8b978e7de 100644
--- a/libclc/opencl/lib/generic/math/half_exp2.cl
+++ b/libclc/opencl/lib/generic/math/half_exp2.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_exp2.h>
#include <clc/opencl/math/half_exp2.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_exp2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_log.cl b/libclc/opencl/lib/generic/math/half_log.cl
index b21835204a173..89482c263f83f 100644
--- a/libclc/opencl/lib/generic/math/half_log.cl
+++ b/libclc/opencl/lib/generic/math/half_log.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_log.h>
#include <clc/opencl/math/half_log.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_log
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_log10.cl b/libclc/opencl/lib/generic/math/half_log10.cl
index acb50f99af192..b5ffe7edd363a 100644
--- a/libclc/opencl/lib/generic/math/half_log10.cl
+++ b/libclc/opencl/lib/generic/math/half_log10.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_log10.h>
#include <clc/opencl/math/half_log10.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_log10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_log2.cl b/libclc/opencl/lib/generic/math/half_log2.cl
index c97e9e093878d..cf13cf927c9c9 100644
--- a/libclc/opencl/lib/generic/math/half_log2.cl
+++ b/libclc/opencl/lib/generic/math/half_log2.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_log2.h>
#include <clc/opencl/math/half_log2.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_log2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_powr.cl b/libclc/opencl/lib/generic/math/half_powr.cl
index d61a18ab91321..d676f353f8647 100644
--- a/libclc/opencl/lib/generic/math/half_powr.cl
+++ b/libclc/opencl/lib/generic/math/half_powr.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_powr.h>
#include <clc/opencl/math/half_powr.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_powr
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_powr
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_recip.cl b/libclc/opencl/lib/generic/math/half_recip.cl
index 1917448c4e695..40a6c587dbaf9 100644
--- a/libclc/opencl/lib/generic/math/half_recip.cl
+++ b/libclc/opencl/lib/generic/math/half_recip.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_recip.h>
#include <clc/opencl/math/half_recip.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_recip
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_recip
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_rsqrt.cl b/libclc/opencl/lib/generic/math/half_rsqrt.cl
index d6ffa651fbe6a..944976855dacf 100644
--- a/libclc/opencl/lib/generic/math/half_rsqrt.cl
+++ b/libclc/opencl/lib/generic/math/half_rsqrt.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_rsqrt.h>
#include <clc/opencl/math/half_rsqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_rsqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_sin.cl b/libclc/opencl/lib/generic/math/half_sin.cl
index baba0cca49849..3376f8344f394 100644
--- a/libclc/opencl/lib/generic/math/half_sin.cl
+++ b/libclc/opencl/lib/generic/math/half_sin.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_sin.h>
#include <clc/opencl/math/half_sin.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_sin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_sqrt.cl b/libclc/opencl/lib/generic/math/half_sqrt.cl
index 7a59744ab11d0..4939d6bd199dc 100644
--- a/libclc/opencl/lib/generic/math/half_sqrt.cl
+++ b/libclc/opencl/lib/generic/math/half_sqrt.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_sqrt.h>
#include <clc/opencl/math/half_sqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_sqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/half_tan.cl b/libclc/opencl/lib/generic/math/half_tan.cl
index acd4b011173db..2b77b3ae0c623 100644
--- a/libclc/opencl/lib/generic/math/half_tan.cl
+++ b/libclc/opencl/lib/generic/math/half_tan.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_half_tan.h>
#include <clc/opencl/math/half_tan.h>
-#define __FLOAT_ONLY
-#define FUNCTION half_tan
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION half_tan
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/hypot.cl b/libclc/opencl/lib/generic/math/hypot.cl
index 4c59e4696e5ae..41aff69069879 100644
--- a/libclc/opencl/lib/generic/math/hypot.cl
+++ b/libclc/opencl/lib/generic/math/hypot.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_hypot.h>
#include <clc/opencl/math/hypot.h>
-#define FUNCTION hypot
+#define __CLC_FUNCTION hypot
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/ilogb.cl b/libclc/opencl/lib/generic/math/ilogb.cl
index 3829ce68fb577..027d587a4d46d 100644
--- a/libclc/opencl/lib/generic/math/ilogb.cl
+++ b/libclc/opencl/lib/generic/math/ilogb.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_ilogb.h>
#include <clc/opencl/math/ilogb.h>
-#define FUNCTION ilogb
+#define __CLC_FUNCTION ilogb
#define __CLC_BODY <clc/math/unary_def_with_int_return.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/ldexp.cl b/libclc/opencl/lib/generic/math/ldexp.cl
index 88c60716d7829..3cdb9e1a760a1 100644
--- a/libclc/opencl/lib/generic/math/ldexp.cl
+++ b/libclc/opencl/lib/generic/math/ldexp.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_ldexp.h>
#include <clc/opencl/math/ldexp.h>
-#define FUNCTION ldexp
-#define __IMPL_FUNCTION(x) __clc_ldexp
+#define __CLC_FUNCTION ldexp
+#define __CLC_IMPL_FUNCTION(x) __clc_ldexp
#define __CLC_BODY <clc/shared/binary_def_with_int_second_arg.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/lgamma.cl b/libclc/opencl/lib/generic/math/lgamma.cl
index 253ce31c15771..da8ceac986e43 100644
--- a/libclc/opencl/lib/generic/math/lgamma.cl
+++ b/libclc/opencl/lib/generic/math/lgamma.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_lgamma.h>
#include <clc/opencl/math/lgamma.h>
-#define FUNCTION lgamma
+#define __CLC_FUNCTION lgamma
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/lgamma_r.cl b/libclc/opencl/lib/generic/math/lgamma_r.cl
index 8753f6c75d8b1..bb2d9bd283df6 100644
--- a/libclc/opencl/lib/generic/math/lgamma_r.cl
+++ b/libclc/opencl/lib/generic/math/lgamma_r.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_lgamma_r.h>
#include <clc/opencl/math/lgamma_r.h>
-#define FUNCTION lgamma_r
+#define __CLC_FUNCTION lgamma_r
#define __CLC_BODY <clc/math/unary_def_with_int_ptr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/log.cl b/libclc/opencl/lib/generic/math/log.cl
index dbe3e35727033..06209999bf2f1 100644
--- a/libclc/opencl/lib/generic/math/log.cl
+++ b/libclc/opencl/lib/generic/math/log.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_log.h>
#include <clc/opencl/math/log.h>
-#define FUNCTION log
+#define __CLC_FUNCTION log
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/log10.cl b/libclc/opencl/lib/generic/math/log10.cl
index d5137a7cab7ab..466b602e18963 100644
--- a/libclc/opencl/lib/generic/math/log10.cl
+++ b/libclc/opencl/lib/generic/math/log10.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_log10.h>
#include <clc/opencl/math/log10.h>
-#define FUNCTION log10
+#define __CLC_FUNCTION log10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/log1p.cl b/libclc/opencl/lib/generic/math/log1p.cl
index d389ab72908c8..c1a8711e11858 100644
--- a/libclc/opencl/lib/generic/math/log1p.cl
+++ b/libclc/opencl/lib/generic/math/log1p.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_log1p.h>
#include <clc/opencl/math/log1p.h>
-#define FUNCTION log1p
+#define __CLC_FUNCTION log1p
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/log2.cl b/libclc/opencl/lib/generic/math/log2.cl
index d1433bc825813..a52a52e28f63f 100644
--- a/libclc/opencl/lib/generic/math/log2.cl
+++ b/libclc/opencl/lib/generic/math/log2.cl
@@ -10,7 +10,7 @@
#include <clc/math/clc_log2.h>
#include <clc/opencl/math/log2.h>
-#define FUNCTION log2
+#define __CLC_FUNCTION log2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/logb.cl b/libclc/opencl/lib/generic/math/logb.cl
index 037380a26a727..09d43fac3ad2a 100644
--- a/libclc/opencl/lib/generic/math/logb.cl
+++ b/libclc/opencl/lib/generic/math/logb.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_logb.h>
#include <clc/opencl/math/logb.h>
-#define FUNCTION logb
+#define __CLC_FUNCTION logb
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/mad.cl b/libclc/opencl/lib/generic/math/mad.cl
index 3fe2dd9bed5fb..05bd228251c18 100644
--- a/libclc/opencl/lib/generic/math/mad.cl
+++ b/libclc/opencl/lib/generic/math/mad.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_mad.h>
#include <clc/opencl/math/mad.h>
-#define FUNCTION mad
+#define __CLC_FUNCTION mad
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/maxmag.cl b/libclc/opencl/lib/generic/math/maxmag.cl
index 4f9dbeb8d27e7..30e7bb21302d7 100644
--- a/libclc/opencl/lib/generic/math/maxmag.cl
+++ b/libclc/opencl/lib/generic/math/maxmag.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_maxmag.h>
#include <clc/opencl/math/maxmag.h>
-#define FUNCTION maxmag
+#define __CLC_FUNCTION maxmag
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/minmag.cl b/libclc/opencl/lib/generic/math/minmag.cl
index efe72b6f545c2..3732dbfe7af45 100644
--- a/libclc/opencl/lib/generic/math/minmag.cl
+++ b/libclc/opencl/lib/generic/math/minmag.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_minmag.h>
#include <clc/opencl/math/minmag.h>
-#define FUNCTION minmag
+#define __CLC_FUNCTION minmag
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/modf.cl b/libclc/opencl/lib/generic/math/modf.cl
index de6524e02f73f..306070bf89238 100644
--- a/libclc/opencl/lib/generic/math/modf.cl
+++ b/libclc/opencl/lib/generic/math/modf.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_modf.h>
#include <clc/opencl/math/modf.h>
-#define FUNCTION modf
+#define __CLC_FUNCTION modf
#define __CLC_BODY <clc/math/unary_def_with_ptr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_cos.cl b/libclc/opencl/lib/generic/math/native_cos.cl
index 85944a03c5468..8508df37a9b62 100644
--- a/libclc/opencl/lib/generic/math/native_cos.cl
+++ b/libclc/opencl/lib/generic/math/native_cos.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_cos.h>
#include <clc/opencl/math/native_cos.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_cos
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_cos
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_divide.cl b/libclc/opencl/lib/generic/math/native_divide.cl
index 8efd8cc21b5d8..ea28bf6e195cc 100644
--- a/libclc/opencl/lib/generic/math/native_divide.cl
+++ b/libclc/opencl/lib/generic/math/native_divide.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_divide.h>
#include <clc/opencl/math/native_divide.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_divide
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_divide
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_exp.cl b/libclc/opencl/lib/generic/math/native_exp.cl
index 42208371e195c..aedb0953c5349 100644
--- a/libclc/opencl/lib/generic/math/native_exp.cl
+++ b/libclc/opencl/lib/generic/math/native_exp.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_exp.h>
#include <clc/opencl/math/native_exp.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_exp
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_exp
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_exp10.cl b/libclc/opencl/lib/generic/math/native_exp10.cl
index aa2585ff4311d..eb184647639f9 100644
--- a/libclc/opencl/lib/generic/math/native_exp10.cl
+++ b/libclc/opencl/lib/generic/math/native_exp10.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_exp10.h>
#include <clc/opencl/math/native_exp10.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_exp10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_exp10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_exp2.cl b/libclc/opencl/lib/generic/math/native_exp2.cl
index 8955b28b367cb..52e814f5ee53c 100644
--- a/libclc/opencl/lib/generic/math/native_exp2.cl
+++ b/libclc/opencl/lib/generic/math/native_exp2.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_exp2.h>
#include <clc/opencl/math/native_exp2.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_exp2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_exp2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_log.cl b/libclc/opencl/lib/generic/math/native_log.cl
index 334f7c04e3899..d1d4ae2f15f18 100644
--- a/libclc/opencl/lib/generic/math/native_log.cl
+++ b/libclc/opencl/lib/generic/math/native_log.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_log.h>
#include <clc/opencl/math/native_log.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_log
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_log
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_log10.cl b/libclc/opencl/lib/generic/math/native_log10.cl
index a65938ee4c6cb..680b9cb341bf2 100644
--- a/libclc/opencl/lib/generic/math/native_log10.cl
+++ b/libclc/opencl/lib/generic/math/native_log10.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_log10.h>
#include <clc/opencl/math/native_log10.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_log10
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_log10
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_log2.cl b/libclc/opencl/lib/generic/math/native_log2.cl
index f10b533f91f40..3a104357afa8c 100644
--- a/libclc/opencl/lib/generic/math/native_log2.cl
+++ b/libclc/opencl/lib/generic/math/native_log2.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_log2.h>
#include <clc/opencl/math/native_log2.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_log2
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_log2
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_powr.cl b/libclc/opencl/lib/generic/math/native_powr.cl
index 8301443cfbcfd..f325d53321b1d 100644
--- a/libclc/opencl/lib/generic/math/native_powr.cl
+++ b/libclc/opencl/lib/generic/math/native_powr.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_powr.h>
#include <clc/opencl/math/native_powr.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_powr
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_powr
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_recip.cl b/libclc/opencl/lib/generic/math/native_recip.cl
index 145845b455147..20d81ed9f1b79 100644
--- a/libclc/opencl/lib/generic/math/native_recip.cl
+++ b/libclc/opencl/lib/generic/math/native_recip.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_recip.h>
#include <clc/opencl/math/native_recip.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_recip
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_recip
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_rsqrt.cl b/libclc/opencl/lib/generic/math/native_rsqrt.cl
index cbb5a754fc967..8f308e74f334c 100644
--- a/libclc/opencl/lib/generic/math/native_rsqrt.cl
+++ b/libclc/opencl/lib/generic/math/native_rsqrt.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_rsqrt.h>
#include <clc/opencl/math/native_rsqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_rsqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_rsqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_sin.cl b/libclc/opencl/lib/generic/math/native_sin.cl
index dfcc882614a63..ea7167822a818 100644
--- a/libclc/opencl/lib/generic/math/native_sin.cl
+++ b/libclc/opencl/lib/generic/math/native_sin.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_sin.h>
#include <clc/opencl/math/native_sin.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_sin
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_sin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_sqrt.cl b/libclc/opencl/lib/generic/math/native_sqrt.cl
index a0be41d33fa43..fa38bdb3301d4 100644
--- a/libclc/opencl/lib/generic/math/native_sqrt.cl
+++ b/libclc/opencl/lib/generic/math/native_sqrt.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_sqrt.h>
#include <clc/opencl/math/native_sqrt.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_sqrt
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_sqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/native_tan.cl b/libclc/opencl/lib/generic/math/native_tan.cl
index 86eee4f5913f0..8cebf93bae91c 100644
--- a/libclc/opencl/lib/generic/math/native_tan.cl
+++ b/libclc/opencl/lib/generic/math/native_tan.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_native_tan.h>
#include <clc/opencl/math/native_tan.h>
-#define __FLOAT_ONLY
-#define FUNCTION native_tan
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION native_tan
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/nextafter.cl b/libclc/opencl/lib/generic/math/nextafter.cl
index 9c30e5668a56b..256f06bf58550 100644
--- a/libclc/opencl/lib/generic/math/nextafter.cl
+++ b/libclc/opencl/lib/generic/math/nextafter.cl
@@ -9,8 +9,8 @@
#include <clc/math/clc_nextafter.h>
#include <clc/opencl/math/nextafter.h>
-#define FUNCTION nextafter
-#define __IMPL_FUNCTION(x) __clc_nextafter
+#define __CLC_FUNCTION nextafter
+#define __CLC_IMPL_FUNCTION(x) __clc_nextafter
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/pow.cl b/libclc/opencl/lib/generic/math/pow.cl
index 2fddb7e889649..bf43519265731 100644
--- a/libclc/opencl/lib/generic/math/pow.cl
+++ b/libclc/opencl/lib/generic/math/pow.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_pow.h>
#include <clc/opencl/math/pow.h>
-#define FUNCTION pow
+#define __CLC_FUNCTION pow
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/pown.cl b/libclc/opencl/lib/generic/math/pown.cl
index 0a5ee893a45a1..8c03be6bee168 100644
--- a/libclc/opencl/lib/generic/math/pown.cl
+++ b/libclc/opencl/lib/generic/math/pown.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_pown.h>
#include <clc/opencl/math/pown.h>
-#define FUNCTION pown
+#define __CLC_FUNCTION pown
#define __CLC_BODY <clc/shared/binary_def_with_int_second_arg.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/powr.cl b/libclc/opencl/lib/generic/math/powr.cl
index 13af03ff13274..680f9be894abb 100644
--- a/libclc/opencl/lib/generic/math/powr.cl
+++ b/libclc/opencl/lib/generic/math/powr.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_powr.h>
#include <clc/opencl/math/powr.h>
-#define FUNCTION powr
+#define __CLC_FUNCTION powr
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/remainder.cl b/libclc/opencl/lib/generic/math/remainder.cl
index 224a66bc9b279..42b37f847f6d1 100644
--- a/libclc/opencl/lib/generic/math/remainder.cl
+++ b/libclc/opencl/lib/generic/math/remainder.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_remainder.h>
#include <clc/opencl/math/remainder.h>
-#define FUNCTION remainder
+#define __CLC_FUNCTION remainder
#define __CLC_BODY <clc/shared/binary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/rint.cl b/libclc/opencl/lib/generic/math/rint.cl
index 489883c97c141..8beaa7ae064c5 100644
--- a/libclc/opencl/lib/generic/math/rint.cl
+++ b/libclc/opencl/lib/generic/math/rint.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_rint.h>
#include <clc/opencl/math/rint.h>
-#define FUNCTION rint
+#define __CLC_FUNCTION rint
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/rootn.cl b/libclc/opencl/lib/generic/math/rootn.cl
index e8dba17b9395d..8f25ee1d31b47 100644
--- a/libclc/opencl/lib/generic/math/rootn.cl
+++ b/libclc/opencl/lib/generic/math/rootn.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_rootn.h>
#include <clc/opencl/math/rootn.h>
-#define FUNCTION rootn
+#define __CLC_FUNCTION rootn
#define __CLC_BODY <clc/shared/binary_def_with_int_second_arg.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/round.cl b/libclc/opencl/lib/generic/math/round.cl
index c45e681b1c222..79b04752e9dec 100644
--- a/libclc/opencl/lib/generic/math/round.cl
+++ b/libclc/opencl/lib/generic/math/round.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_round.h>
#include <clc/opencl/math/round.h>
-#define FUNCTION round
+#define __CLC_FUNCTION round
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/rsqrt.cl b/libclc/opencl/lib/generic/math/rsqrt.cl
index 47e4f450ed1a6..f7137f5a007d3 100644
--- a/libclc/opencl/lib/generic/math/rsqrt.cl
+++ b/libclc/opencl/lib/generic/math/rsqrt.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_rsqrt.h>
#include <clc/opencl/math/rsqrt.h>
-#define FUNCTION rsqrt
+#define __CLC_FUNCTION rsqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/sin.cl b/libclc/opencl/lib/generic/math/sin.cl
index ff7db2a5b3cb8..e198198bcbe86 100644
--- a/libclc/opencl/lib/generic/math/sin.cl
+++ b/libclc/opencl/lib/generic/math/sin.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_sin.h>
#include <clc/opencl/math/sin.h>
-#define FUNCTION sin
+#define __CLC_FUNCTION sin
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/sincos.cl b/libclc/opencl/lib/generic/math/sincos.cl
index c8871fd2b0020..845e966966c51 100644
--- a/libclc/opencl/lib/generic/math/sincos.cl
+++ b/libclc/opencl/lib/generic/math/sincos.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_sincos.h>
#include <clc/opencl/math/sincos.h>
-#define FUNCTION sincos
+#define __CLC_FUNCTION sincos
#define __CLC_BODY <clc/math/unary_def_with_ptr.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/sinh.cl b/libclc/opencl/lib/generic/math/sinh.cl
index bd6ea20e7e898..6d5f1b1c269c1 100644
--- a/libclc/opencl/lib/generic/math/sinh.cl
+++ b/libclc/opencl/lib/generic/math/sinh.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_sinh.h>
#include <clc/opencl/math/sinh.h>
-#define FUNCTION sinh
+#define __CLC_FUNCTION sinh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/sinpi.cl b/libclc/opencl/lib/generic/math/sinpi.cl
index badecd0909856..33b04532e7763 100644
--- a/libclc/opencl/lib/generic/math/sinpi.cl
+++ b/libclc/opencl/lib/generic/math/sinpi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_sinpi.h>
#include <clc/opencl/math/sinpi.h>
-#define FUNCTION sinpi
+#define __CLC_FUNCTION sinpi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/sqrt.cl b/libclc/opencl/lib/generic/math/sqrt.cl
index 3b05b25864485..9984ddb9d5a41 100644
--- a/libclc/opencl/lib/generic/math/sqrt.cl
+++ b/libclc/opencl/lib/generic/math/sqrt.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_sqrt.h>
#include <clc/opencl/math/sqrt.h>
-#define FUNCTION sqrt
+#define __CLC_FUNCTION sqrt
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/tan.cl b/libclc/opencl/lib/generic/math/tan.cl
index 95409fc5b092b..89a5251111675 100644
--- a/libclc/opencl/lib/generic/math/tan.cl
+++ b/libclc/opencl/lib/generic/math/tan.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_tan.h>
#include <clc/opencl/math/tan.h>
-#define FUNCTION tan
+#define __CLC_FUNCTION tan
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/tanh.cl b/libclc/opencl/lib/generic/math/tanh.cl
index a77878bb79667..92307eafdd05f 100644
--- a/libclc/opencl/lib/generic/math/tanh.cl
+++ b/libclc/opencl/lib/generic/math/tanh.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_tanh.h>
#include <clc/opencl/math/tanh.h>
-#define FUNCTION tanh
+#define __CLC_FUNCTION tanh
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/tanpi.cl b/libclc/opencl/lib/generic/math/tanpi.cl
index 6b5805ec3cd04..47e943ba77416 100644
--- a/libclc/opencl/lib/generic/math/tanpi.cl
+++ b/libclc/opencl/lib/generic/math/tanpi.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_tanpi.h>
#include <clc/opencl/math/tanpi.h>
-#define FUNCTION tanpi
+#define __CLC_FUNCTION tanpi
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/tgamma.cl b/libclc/opencl/lib/generic/math/tgamma.cl
index 8f35d22426a70..2749cf3dfc0f4 100644
--- a/libclc/opencl/lib/generic/math/tgamma.cl
+++ b/libclc/opencl/lib/generic/math/tgamma.cl
@@ -9,6 +9,6 @@
#include <clc/math/clc_tgamma.h>
#include <clc/opencl/math/tgamma.h>
-#define FUNCTION tgamma
+#define __CLC_FUNCTION tgamma
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/math/trunc.cl b/libclc/opencl/lib/generic/math/trunc.cl
index ea56329bc8dea..b276996995344 100644
--- a/libclc/opencl/lib/generic/math/trunc.cl
+++ b/libclc/opencl/lib/generic/math/trunc.cl
@@ -9,7 +9,7 @@
#include <clc/math/clc_trunc.h>
#include <clc/opencl/math/trunc.h>
-#define FUNCTION trunc
+#define __CLC_FUNCTION trunc
#define __CLC_BODY <clc/shared/unary_def.inc>
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/misc/shuffle.cl b/libclc/opencl/lib/generic/misc/shuffle.cl
index 15295bf7d907a..f9187be453e65 100644
--- a/libclc/opencl/lib/generic/misc/shuffle.cl
+++ b/libclc/opencl/lib/generic/misc/shuffle.cl
@@ -9,7 +9,7 @@
#include <clc/misc/clc_shuffle.h>
#include <clc/opencl/misc/shuffle.h>
-#define FUNCTION shuffle
+#define __CLC_FUNCTION shuffle
#define __CLC_BODY <clc/misc/shuffle_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/misc/shuffle2.cl b/libclc/opencl/lib/generic/misc/shuffle2.cl
index 7e4c5f0922682..0008340b622df 100644
--- a/libclc/opencl/lib/generic/misc/shuffle2.cl
+++ b/libclc/opencl/lib/generic/misc/shuffle2.cl
@@ -9,7 +9,7 @@
#include <clc/misc/clc_shuffle2.h>
#include <clc/opencl/misc/shuffle2.h>
-#define FUNCTION shuffle2
+#define __CLC_FUNCTION shuffle2
#define __CLC_BODY <clc/misc/shuffle2_def.inc>
#include <clc/integer/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/all.cl b/libclc/opencl/lib/generic/relational/all.cl
index 5ac4a465365a4..f72da2cb622c9 100644
--- a/libclc/opencl/lib/generic/relational/all.cl
+++ b/libclc/opencl/lib/generic/relational/all.cl
@@ -9,17 +9,17 @@
#include <clc/opencl/relational/all.h>
#include <clc/relational/clc_all.h>
-#define ALL_ID(TYPE) _CLC_OVERLOAD _CLC_DEF int all(TYPE v)
+#define __CLC_ALL_ID(TYPE) _CLC_OVERLOAD _CLC_DEF int all(TYPE v)
-#define ALL_VECTORIZE(TYPE) \
- ALL_ID(TYPE) { return __clc_all(v); } \
- ALL_ID(TYPE##2) { return __clc_all(v); } \
- ALL_ID(TYPE##3) { return __clc_all(v); } \
- ALL_ID(TYPE##4) { return __clc_all(v); } \
- ALL_ID(TYPE##8) { return __clc_all(v); } \
- ALL_ID(TYPE##16) { return __clc_all(v); }
+#define __CLC_ALL_VECTORIZE(TYPE) \
+ __CLC_ALL_ID(TYPE) { return __clc_all(v); } \
+ __CLC_ALL_ID(TYPE##2) { return __clc_all(v); } \
+ __CLC_ALL_ID(TYPE##3) { return __clc_all(v); } \
+ __CLC_ALL_ID(TYPE##4) { return __clc_all(v); } \
+ __CLC_ALL_ID(TYPE##8) { return __clc_all(v); } \
+ __CLC_ALL_ID(TYPE##16) { return __clc_all(v); }
-ALL_VECTORIZE(char)
-ALL_VECTORIZE(short)
-ALL_VECTORIZE(int)
-ALL_VECTORIZE(long)
+__CLC_ALL_VECTORIZE(char)
+__CLC_ALL_VECTORIZE(short)
+__CLC_ALL_VECTORIZE(int)
+__CLC_ALL_VECTORIZE(long)
diff --git a/libclc/opencl/lib/generic/relational/any.cl b/libclc/opencl/lib/generic/relational/any.cl
index 507f2b170693e..b2b48dbf1ab04 100644
--- a/libclc/opencl/lib/generic/relational/any.cl
+++ b/libclc/opencl/lib/generic/relational/any.cl
@@ -9,17 +9,17 @@
#include <clc/opencl/relational/any.h>
#include <clc/relational/clc_any.h>
-#define ANY_ID(TYPE) _CLC_OVERLOAD _CLC_DEF int any(TYPE v)
+#define __CLC_ANY_ID(TYPE) _CLC_OVERLOAD _CLC_DEF int any(TYPE v)
-#define ANY_VECTORIZE(TYPE) \
- ANY_ID(TYPE) { return __clc_any(v); } \
- ANY_ID(TYPE##2) { return __clc_any(v); } \
- ANY_ID(TYPE##3) { return __clc_any(v); } \
- ANY_ID(TYPE##4) { return __clc_any(v); } \
- ANY_ID(TYPE##8) { return __clc_any(v); } \
- ANY_ID(TYPE##16) { return __clc_any(v); }
+#define __CLC_ANY_VECTORIZE(TYPE) \
+ __CLC_ANY_ID(TYPE) { return __clc_any(v); } \
+ __CLC_ANY_ID(TYPE##2) { return __clc_any(v); } \
+ __CLC_ANY_ID(TYPE##3) { return __clc_any(v); } \
+ __CLC_ANY_ID(TYPE##4) { return __clc_any(v); } \
+ __CLC_ANY_ID(TYPE##8) { return __clc_any(v); } \
+ __CLC_ANY_ID(TYPE##16) { return __clc_any(v); }
-ANY_VECTORIZE(char)
-ANY_VECTORIZE(short)
-ANY_VECTORIZE(int)
-ANY_VECTORIZE(long)
+__CLC_ANY_VECTORIZE(char)
+__CLC_ANY_VECTORIZE(short)
+__CLC_ANY_VECTORIZE(int)
+__CLC_ANY_VECTORIZE(long)
diff --git a/libclc/opencl/lib/generic/relational/binary_def.inc b/libclc/opencl/lib/generic/relational/binary_def.inc
index 8416da0475a2c..b60d9bbe45e11 100644
--- a/libclc/opencl/lib/generic/relational/binary_def.inc
+++ b/libclc/opencl/lib/generic/relational/binary_def.inc
@@ -8,16 +8,17 @@
#include <clc/utils.h>
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#if __CLC_VECSIZE_OR_1 == 1
-#define __RETTYPE __CLC_INTN
+#define __CLC_RETTYPE __CLC_INTN
#else
-#define __RETTYPE __CLC_BIT_INTN
+#define __CLC_RETTYPE __CLC_BIT_INTN
#endif
-_CLC_OVERLOAD _CLC_DEF __RETTYPE FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b) {
- return __IMPL_FUNCTION(FUNCTION)(a, b);
+_CLC_OVERLOAD _CLC_DEF __CLC_RETTYPE __CLC_FUNCTION(__CLC_GENTYPE a,
+ __CLC_GENTYPE b) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a, b);
}
-#undef __RETTYPE
+#undef __CLC_RETTYPE
diff --git a/libclc/opencl/lib/generic/relational/isequal.cl b/libclc/opencl/lib/generic/relational/isequal.cl
index 83002c28ceab3..40718dbca9d05 100644
--- a/libclc/opencl/lib/generic/relational/isequal.cl
+++ b/libclc/opencl/lib/generic/relational/isequal.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isequal.h>
#include <clc/relational/clc_isequal.h>
-#define FUNCTION isequal
+#define __CLC_FUNCTION isequal
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isfinite.cl b/libclc/opencl/lib/generic/relational/isfinite.cl
index a2017133cead8..f055e295416c9 100644
--- a/libclc/opencl/lib/generic/relational/isfinite.cl
+++ b/libclc/opencl/lib/generic/relational/isfinite.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isfinite.h>
#include <clc/relational/clc_isfinite.h>
-#define FUNCTION isfinite
+#define __CLC_FUNCTION isfinite
#define __CLC_BODY "unary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isgreater.cl b/libclc/opencl/lib/generic/relational/isgreater.cl
index 6eeb2b21c0493..ae73769267dc8 100644
--- a/libclc/opencl/lib/generic/relational/isgreater.cl
+++ b/libclc/opencl/lib/generic/relational/isgreater.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isgreater.h>
#include <clc/relational/clc_isgreater.h>
-#define FUNCTION isgreater
+#define __CLC_FUNCTION isgreater
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isgreaterequal.cl b/libclc/opencl/lib/generic/relational/isgreaterequal.cl
index e4e4535fd30d3..725c3289bb05f 100644
--- a/libclc/opencl/lib/generic/relational/isgreaterequal.cl
+++ b/libclc/opencl/lib/generic/relational/isgreaterequal.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isgreaterequal.h>
#include <clc/relational/clc_isgreaterequal.h>
-#define FUNCTION isgreaterequal
+#define __CLC_FUNCTION isgreaterequal
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isinf.cl b/libclc/opencl/lib/generic/relational/isinf.cl
index 2ab8c182e02a6..9558b0f9eb5ee 100644
--- a/libclc/opencl/lib/generic/relational/isinf.cl
+++ b/libclc/opencl/lib/generic/relational/isinf.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isinf.h>
#include <clc/relational/clc_isinf.h>
-#define FUNCTION isinf
+#define __CLC_FUNCTION isinf
#define __CLC_BODY "unary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isless.cl b/libclc/opencl/lib/generic/relational/isless.cl
index 4212970e7671a..6ed0857d354a3 100644
--- a/libclc/opencl/lib/generic/relational/isless.cl
+++ b/libclc/opencl/lib/generic/relational/isless.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isless.h>
#include <clc/relational/clc_isless.h>
-#define FUNCTION isless
+#define __CLC_FUNCTION isless
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/islessequal.cl b/libclc/opencl/lib/generic/relational/islessequal.cl
index e7aec262fc762..c4697ca56f982 100644
--- a/libclc/opencl/lib/generic/relational/islessequal.cl
+++ b/libclc/opencl/lib/generic/relational/islessequal.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/islessequal.h>
#include <clc/relational/clc_islessequal.h>
-#define FUNCTION islessequal
+#define __CLC_FUNCTION islessequal
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/islessgreater.cl b/libclc/opencl/lib/generic/relational/islessgreater.cl
index b775d2484550c..eb4cdc24c0679 100644
--- a/libclc/opencl/lib/generic/relational/islessgreater.cl
+++ b/libclc/opencl/lib/generic/relational/islessgreater.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/islessgreater.h>
#include <clc/relational/clc_islessgreater.h>
-#define FUNCTION islessgreater
+#define __CLC_FUNCTION islessgreater
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isnan.cl b/libclc/opencl/lib/generic/relational/isnan.cl
index 4b7eeb5b919b6..4bae2ae077c13 100644
--- a/libclc/opencl/lib/generic/relational/isnan.cl
+++ b/libclc/opencl/lib/generic/relational/isnan.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isnan.h>
#include <clc/relational/clc_isnan.h>
-#define FUNCTION isnan
+#define __CLC_FUNCTION isnan
#define __CLC_BODY "unary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isnormal.cl b/libclc/opencl/lib/generic/relational/isnormal.cl
index 60ce9dccaeaf3..d4ea20a27cdb6 100644
--- a/libclc/opencl/lib/generic/relational/isnormal.cl
+++ b/libclc/opencl/lib/generic/relational/isnormal.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isnormal.h>
#include <clc/relational/clc_isnormal.h>
-#define FUNCTION isnormal
+#define __CLC_FUNCTION isnormal
#define __CLC_BODY "unary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isnotequal.cl b/libclc/opencl/lib/generic/relational/isnotequal.cl
index abb4d3a859663..e24d57564cb8c 100644
--- a/libclc/opencl/lib/generic/relational/isnotequal.cl
+++ b/libclc/opencl/lib/generic/relational/isnotequal.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isnotequal.h>
#include <clc/relational/clc_isnotequal.h>
-#define FUNCTION isnotequal
+#define __CLC_FUNCTION isnotequal
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isordered.cl b/libclc/opencl/lib/generic/relational/isordered.cl
index 684ee425e1203..773cf1947e68e 100644
--- a/libclc/opencl/lib/generic/relational/isordered.cl
+++ b/libclc/opencl/lib/generic/relational/isordered.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isordered.h>
#include <clc/relational/clc_isordered.h>
-#define FUNCTION isordered
+#define __CLC_FUNCTION isordered
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/isunordered.cl b/libclc/opencl/lib/generic/relational/isunordered.cl
index 84aa8cafb111a..44427ea5e6046 100644
--- a/libclc/opencl/lib/generic/relational/isunordered.cl
+++ b/libclc/opencl/lib/generic/relational/isunordered.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/isunordered.h>
#include <clc/relational/clc_isunordered.h>
-#define FUNCTION isunordered
+#define __CLC_FUNCTION isunordered
#define __CLC_BODY "binary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/signbit.cl b/libclc/opencl/lib/generic/relational/signbit.cl
index d30fea7b9f6f5..b1f3ac89933f7 100644
--- a/libclc/opencl/lib/generic/relational/signbit.cl
+++ b/libclc/opencl/lib/generic/relational/signbit.cl
@@ -9,7 +9,7 @@
#include <clc/opencl/relational/signbit.h>
#include <clc/relational/clc_signbit.h>
-#define FUNCTION signbit
+#define __CLC_FUNCTION signbit
#define __CLC_BODY "unary_def.inc"
#include <clc/math/gentype.inc>
diff --git a/libclc/opencl/lib/generic/relational/unary_def.inc b/libclc/opencl/lib/generic/relational/unary_def.inc
index f184e3cf0be56..1655ace114aa6 100644
--- a/libclc/opencl/lib/generic/relational/unary_def.inc
+++ b/libclc/opencl/lib/generic/relational/unary_def.inc
@@ -8,16 +8,16 @@
#include <clc/utils.h>
-#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#if __CLC_VECSIZE_OR_1 == 1
-#define __RETTYPE __CLC_INTN
+#define __CLC_RETTYPE __CLC_INTN
#else
-#define __RETTYPE __CLC_BIT_INTN
+#define __CLC_RETTYPE __CLC_BIT_INTN
#endif
-_CLC_OVERLOAD _CLC_DEF __RETTYPE FUNCTION(__CLC_GENTYPE a) {
- return __IMPL_FUNCTION(FUNCTION)(a);
+_CLC_OVERLOAD _CLC_DEF __CLC_RETTYPE __CLC_FUNCTION(__CLC_GENTYPE a) {
+ return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(a);
}
-#undef __RETTYPE
+#undef __CLC_RETTYPE
diff --git a/libclc/opencl/lib/generic/shared/vload.inc b/libclc/opencl/lib/generic/shared/vload.inc
index 62cb040aad180..955b77b48ec35 100644
--- a/libclc/opencl/lib/generic/shared/vload.inc
+++ b/libclc/opencl/lib/generic/shared/vload.inc
@@ -6,33 +6,34 @@
//
//===----------------------------------------------------------------------===//
-#define CLC_VLOAD_NAME(x) __CLC_XCONCAT(__CLC_XCONCAT(x, vload), __CLC_VECSIZE)
-#define CLC_VLOAD_HALF_NAME(x) \
+#define __CLC_VLOAD_NAME(x) \
+ __CLC_XCONCAT(__CLC_XCONCAT(x, vload), __CLC_VECSIZE)
+#define __CLC_VLOAD_HALF_NAME(x) \
__CLC_XCONCAT(__CLC_XCONCAT(x, vload_half), __CLC_VECSIZE)
-#define CLC_VLOADA_HALF_NAME(x) \
+#define __CLC_VLOADA_HALF_NAME(x) \
__CLC_XCONCAT(__CLC_XCONCAT(x, vloada_half), __CLC_VECSIZE)
#ifndef __CLC_SCALAR
-#define CLC_VLOAD_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
+#define __CLC_VLOAD_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
-#define VLOAD_DEF(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF CLC_VLOAD_TY CLC_VLOAD_NAME()( \
+#define __CLC_VLOAD_DEF(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DEF __CLC_VLOAD_TY __CLC_VLOAD_NAME()( \
size_t offset, const ADDRSPACE __CLC_SCALAR_GENTYPE *x) { \
- return CLC_VLOAD_NAME(__clc_)(offset, x); \
+ return __CLC_VLOAD_NAME(__clc_)(offset, x); \
}
-VLOAD_DEF(__private)
-VLOAD_DEF(__local)
-VLOAD_DEF(__constant)
-VLOAD_DEF(__global)
+__CLC_VLOAD_DEF(__private)
+__CLC_VLOAD_DEF(__local)
+__CLC_VLOAD_DEF(__constant)
+__CLC_VLOAD_DEF(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-VLOAD_DEF(__generic)
+__CLC_VLOAD_DEF(__generic)
#endif
-#undef VLOAD_DEF
-#undef CLC_VLOAD_TY
+#undef __CLC_VLOAD_DEF
+#undef __CLC_VLOAD_TY
#endif
@@ -42,30 +43,30 @@ VLOAD_DEF(__generic)
#ifdef __CLC_FPSIZE
#if __CLC_FPSIZE == 32
-#define VLOAD_HALF_DEF(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE CLC_VLOAD_HALF_NAME()( \
+#define __CLC_VLOAD_HALF_DEF(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_VLOAD_HALF_NAME()( \
size_t offset, const ADDRSPACE half *mem) { \
- return CLC_VLOAD_HALF_NAME(__clc_)(offset, mem); \
+ return __CLC_VLOAD_HALF_NAME(__clc_)(offset, mem); \
} \
\
- _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE CLC_VLOADA_HALF_NAME()( \
+ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_VLOADA_HALF_NAME()( \
size_t offset, const ADDRSPACE half *mem) { \
- return CLC_VLOADA_HALF_NAME(__clc_)(offset, mem); \
+ return __CLC_VLOADA_HALF_NAME(__clc_)(offset, mem); \
}
-VLOAD_HALF_DEF(__private)
-VLOAD_HALF_DEF(__local)
-VLOAD_HALF_DEF(__constant)
-VLOAD_HALF_DEF(__global)
+__CLC_VLOAD_HALF_DEF(__private)
+__CLC_VLOAD_HALF_DEF(__local)
+__CLC_VLOAD_HALF_DEF(__constant)
+__CLC_VLOAD_HALF_DEF(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-VLOAD_HALF_DEF(__generic)
+__CLC_VLOAD_HALF_DEF(__generic)
#endif
-#undef VLOAD_HALF_DEF
+#undef __CLC_VLOAD_HALF_DEF
#endif
#endif
-#undef CLC_VLOAD_NAME
-#undef CLC_VLOAD_HALF_NAME
-#undef CLC_VLOADA_HALF_NAME
+#undef __CLC_VLOAD_NAME
+#undef __CLC_VLOAD_HALF_NAME
+#undef __CLC_VLOADA_HALF_NAME
diff --git a/libclc/opencl/lib/generic/shared/vstore.inc b/libclc/opencl/lib/generic/shared/vstore.inc
index 4bdce0719912d..79ae9f9c9df20 100644
--- a/libclc/opencl/lib/generic/shared/vstore.inc
+++ b/libclc/opencl/lib/generic/shared/vstore.inc
@@ -6,31 +6,32 @@
//
//===----------------------------------------------------------------------===//
-#define CLC_VSTORE_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
-#define CLC_VSTORE_NAME(x) \
+#define __CLC_VSTORE_TY __CLC_XCONCAT(less_aligned_, __CLC_GENTYPE)
+#define __CLC_VSTORE_NAME(x) \
__CLC_XCONCAT(__CLC_XCONCAT(x, vstore), __CLC_VECSIZE)
-#define CLC_VSTORE_HALF_NAME(x, y) \
+#define __CLC_VSTORE_HALF_NAME(x, y) \
__CLC_XCONCAT(__CLC_XCONCAT(__CLC_XCONCAT(x, vstore_half), __CLC_VECSIZE), y)
-#define CLC_VSTOREA_HALF_NAME(x, y) \
+#define __CLC_VSTOREA_HALF_NAME(x, y) \
__CLC_XCONCAT(__CLC_XCONCAT(__CLC_XCONCAT(x, vstorea_half), __CLC_VECSIZE), y)
#ifndef __CLC_SCALAR
-#define CLC_VSTORE_DEF(ADDRSPACE) \
- _CLC_OVERLOAD _CLC_DEF void CLC_VSTORE_NAME()( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE __CLC_SCALAR_GENTYPE *p) { \
- return CLC_VSTORE_NAME(__clc_)(data, offset, p); \
+#define __CLC_VSTORE_DEF(ADDRSPACE) \
+ _CLC_OVERLOAD _CLC_DEF void __CLC_VSTORE_NAME()( \
+ __CLC_VSTORE_TY data, size_t offset, \
+ ADDRSPACE __CLC_SCALAR_GENTYPE *p) { \
+ return __CLC_VSTORE_NAME(__clc_)(data, offset, p); \
}
-CLC_VSTORE_DEF(__private)
-CLC_VSTORE_DEF(__local)
-CLC_VSTORE_DEF(__global)
+__CLC_VSTORE_DEF(__private)
+__CLC_VSTORE_DEF(__local)
+__CLC_VSTORE_DEF(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VSTORE_DEF(__generic)
+__CLC_VSTORE_DEF(__generic)
#endif
-#undef CLC_VSTORE_DEF
+#undef __CLC_VSTORE_DEF
#endif // __CLC_SCALAR
@@ -39,39 +40,39 @@ CLC_VSTORE_DEF(__generic)
#ifdef __CLC_FPSIZE
#if __CLC_FPSIZE == 32 || __CLC_FPSIZE == 64
-#define CLC_VSTORE_HALF_DEF(ADDRSPACE, SUFFIX) \
- _CLC_OVERLOAD _CLC_DEF void CLC_VSTORE_HALF_NAME(, SUFFIX)( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p) { \
- CLC_VSTORE_HALF_NAME(__clc_, SUFFIX)(data, offset, p); \
+#define __CLC_VSTORE_HALF_DEF(ADDRSPACE, SUFFIX) \
+ _CLC_OVERLOAD _CLC_DEF void __CLC_VSTORE_HALF_NAME(, SUFFIX)( \
+ __CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p) { \
+ __CLC_VSTORE_HALF_NAME(__clc_, SUFFIX)(data, offset, p); \
} \
\
- _CLC_OVERLOAD _CLC_DEF void CLC_VSTOREA_HALF_NAME(, SUFFIX)( \
- CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p) { \
- CLC_VSTOREA_HALF_NAME(__clc_, SUFFIX)(data, offset, p); \
+ _CLC_OVERLOAD _CLC_DEF void __CLC_VSTOREA_HALF_NAME(, SUFFIX)( \
+ __CLC_VSTORE_TY data, size_t offset, ADDRSPACE half *p) { \
+ __CLC_VSTOREA_HALF_NAME(__clc_, SUFFIX)(data, offset, p); \
}
-#define CLC_VSTORE_HALF_DEF_ALL_MODES(ADDRSPACE) \
- CLC_VSTORE_HALF_DEF(ADDRSPACE, ) \
- CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtz) \
- CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtn) \
- CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtp) \
- CLC_VSTORE_HALF_DEF(ADDRSPACE, _rte)
+#define __CLC_VSTORE_HALF_DEF_ALL_MODES(ADDRSPACE) \
+ __CLC_VSTORE_HALF_DEF(ADDRSPACE, ) \
+ __CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtz) \
+ __CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtn) \
+ __CLC_VSTORE_HALF_DEF(ADDRSPACE, _rtp) \
+ __CLC_VSTORE_HALF_DEF(ADDRSPACE, _rte)
-CLC_VSTORE_HALF_DEF_ALL_MODES(__private)
-CLC_VSTORE_HALF_DEF_ALL_MODES(__local)
-CLC_VSTORE_HALF_DEF_ALL_MODES(__global)
+__CLC_VSTORE_HALF_DEF_ALL_MODES(__private)
+__CLC_VSTORE_HALF_DEF_ALL_MODES(__local)
+__CLC_VSTORE_HALF_DEF_ALL_MODES(__global)
#if _CLC_DISTINCT_GENERIC_AS_SUPPORTED
-CLC_VSTORE_HALF_DEF_ALL_MODES(__generic)
+__CLC_VSTORE_HALF_DEF_ALL_MODES(__generic)
#endif
-#undef CLC_VSTORE_HALF_DEF
-#undef CLC_VSTORE_HALF_DEF_ALL_MODES
+#undef __CLC_VSTORE_HALF_DEF
+#undef __CLC_VSTORE_HALF_DEF_ALL_MODES
#endif
#endif
-#undef CLC_VSTORE_TY
-#undef CLC_VSTORE_NAME
-#undef CLC_VSTORE_HALF_NAME
-#undef CLC_VSTOREA_HALF_NAME
+#undef __CLC_VSTORE_TY
+#undef __CLC_VSTORE_NAME
+#undef __CLC_VSTORE_HALF_NAME
+#undef __CLC_VSTOREA_HALF_NAME
diff --git a/libclc/opencl/lib/spirv/math/fma.cl b/libclc/opencl/lib/spirv/math/fma.cl
index 83504f63772ca..0e328903ba263 100644
--- a/libclc/opencl/lib/spirv/math/fma.cl
+++ b/libclc/opencl/lib/spirv/math/fma.cl
@@ -9,9 +9,9 @@
#include <clc/internal/math/clc_sw_fma.h>
#include <clc/opencl/math/fma.h>
-#define __FLOAT_ONLY
-#define FUNCTION fma
-#define __IMPL_FUNCTION(x) __clc_sw_fma
+#define __CLC_FLOAT_ONLY
+#define __CLC_FUNCTION fma
+#define __CLC_IMPL_FUNCTION(x) __clc_sw_fma
#define __CLC_BODY <clc/shared/ternary_def.inc>
#include <clc/math/gentype.inc>
More information about the cfe-commits
mailing list