Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:37:05

0001 /***************************************************************************
0002  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0003  * Martin Renou                                                             *
0004  * Copyright (c) QuantStack                                                 *
0005  * Copyright (c) Serge Guelton                                              *
0006  * Copyright (c) Marco Barbone                                              *
0007  *                                                                          *
0008  * Distributed under the terms of the BSD 3-Clause License.                 *
0009  *                                                                          *
0010  * The full license is in the file LICENSE, distributed with this software. *
0011  ****************************************************************************/
0012 
0013 #ifndef XSIMD_COMMON_FWD_HPP
0014 #define XSIMD_COMMON_FWD_HPP
0015 
0016 #include "../config/xsimd_macros.hpp"
0017 #include "../types/xsimd_common_arch.hpp"
0018 
0019 #include <cstdint>
0020 #include <type_traits>
0021 #include <utility>
0022 
0023 namespace xsimd
0024 {
0025     // Minimal forward declarations used in this header
0026     template <class T, class A>
0027     class batch;
0028     template <class T, class A>
0029     class batch_bool;
0030     template <class T, class A, T... Vs>
0031     struct batch_constant;
0032     template <class T, class A, bool... Vs>
0033     struct batch_bool_constant;
0034     template <class T>
0035     struct convert;
0036     template <class A>
0037     struct requires_arch;
0038     struct aligned_mode;
0039     struct unaligned_mode;
0040 
0041     namespace types
0042     {
0043         template <typename T, class A>
0044         struct has_simd_register;
0045     }
0046 
0047     namespace kernel
0048     {
0049         // forward declaration
0050         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0051         XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<common>) noexcept;
0052         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0053         XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0054         template <size_t shift, class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0055         XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, requires_arch<common>) noexcept;
0056         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0057         XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0058         template <size_t shift, class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0059         XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, requires_arch<common>) noexcept;
0060         template <class A, class T>
0061         XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0062         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0063         XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0064         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0065         XSIMD_INLINE batch<T, A> mul_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0066         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0067         XSIMD_INLINE std::pair<batch<T, A>, batch<T, A>>
0068         mul_hilo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0069         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0070         XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0071         template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
0072         XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept;
0073         template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
0074         XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<common>) noexcept;
0075         template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
0076         XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<common>) noexcept;
0077         template <class A, class T, class STy>
0078         XSIMD_INLINE batch<T, A> rotl(batch<T, A> const& self, STy other, requires_arch<common>) noexcept;
0079         template <size_t count, class A, class T>
0080         XSIMD_INLINE batch<T, A> rotl(batch<T, A> const& self, requires_arch<common>) noexcept;
0081         template <class A, class T, class STy>
0082         XSIMD_INLINE batch<T, A> rotr(batch<T, A> const& self, STy other, requires_arch<common>) noexcept;
0083         template <size_t count, class A, class T>
0084         XSIMD_INLINE batch<T, A> rotr(batch<T, A> const& self, requires_arch<common>) noexcept;
0085         template <class A, class T>
0086         XSIMD_INLINE batch<T, A> load(T const* mem, aligned_mode, requires_arch<A>) noexcept;
0087         template <class A, class T>
0088         XSIMD_INLINE batch<T, A> load(T const* mem, unaligned_mode, requires_arch<A>) noexcept;
0089         template <class A, class T_in, class T_out, bool... Values, class alignment>
0090         XSIMD_INLINE batch<T_out, A> load_masked(T_in const* mem, batch_bool_constant<T_out, A, Values...> mask, convert<T_out>, alignment, requires_arch<common>) noexcept;
0091         template <class A, class T, class Mode>
0092         XSIMD_INLINE batch<T, A> load_masked(T const* mem, batch_bool<T, A> mask, convert<T>, Mode, requires_arch<common>) noexcept;
0093         template <class A, class T_in, class T_out, bool... Values, class alignment>
0094         XSIMD_INLINE void store_masked(T_out* mem, batch<T_in, A> const& src, batch_bool_constant<T_in, A, Values...> mask, alignment, requires_arch<common>) noexcept;
0095         template <class A, class T, class Mode>
0096         XSIMD_INLINE void store_masked(T* mem, batch<T, A> const& src, batch_bool<T, A> mask, Mode, requires_arch<common>) noexcept;
0097 
0098         // Forward declarations for pack-level helpers
0099         namespace detail
0100         {
0101             template <class T>
0102             XSIMD_INLINE void reassociation_barrier(T& x, const char*) noexcept;
0103             template <class T, class A>
0104             XSIMD_INLINE void reassociation_barrier(batch<T, A>& b, const char* reason) noexcept;
0105 
0106             template <typename T, T... Vs>
0107             XSIMD_INLINE constexpr bool is_identity() noexcept;
0108             template <typename T, class A, T... Vs>
0109             XSIMD_INLINE constexpr bool is_identity(batch_constant<T, A, Vs...>) noexcept;
0110             template <typename T, class A, T... Vs>
0111             XSIMD_INLINE constexpr bool is_dup_lo(batch_constant<T, A, Vs...>) noexcept;
0112             template <typename T, class A, T... Vs>
0113             XSIMD_INLINE constexpr bool is_dup_hi(batch_constant<T, A, Vs...>) noexcept;
0114             template <typename T, class A, T... Vs>
0115             XSIMD_INLINE constexpr bool is_cross_lane(batch_constant<T, A, Vs...>) noexcept;
0116             template <typename T, class A, T... Vs>
0117             XSIMD_INLINE constexpr bool is_only_from_lo(batch_constant<T, A, Vs...>) noexcept;
0118             template <typename T, class A, T... Vs>
0119             XSIMD_INLINE constexpr bool is_only_from_hi(batch_constant<T, A, Vs...>) noexcept;
0120 
0121             template <class A, class WMul>
0122             XSIMD_INLINE batch<uint64_t, A> mulhi_u64_core(batch<uint64_t, A> const& x,
0123                                                            batch<uint64_t, A> const& y,
0124                                                            WMul mul_epu32) noexcept;
0125             template <class A, class WMul>
0126             XSIMD_INLINE batch<int64_t, A> mulhi_i64_core(batch<int64_t, A> const& x,
0127                                                           batch<int64_t, A> const& y,
0128                                                           WMul mul_epu32) noexcept;
0129             template <class A, class WMul>
0130             XSIMD_INLINE std::pair<batch<uint64_t, A>, batch<uint64_t, A>>
0131             mulhilo_u64_core(batch<uint64_t, A> const& x,
0132                              batch<uint64_t, A> const& y,
0133                              WMul mul_epu32) noexcept;
0134         }
0135     }
0136 }
0137 
0138 #endif