1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #ifndef _RTE_MEMCPY_H_ 6 #define _RTE_MEMCPY_H_ 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * @file 14 * 15 * Functions for vectorised implementation of memcpy(). 16 */ 17 18 /** 19 * Copy 16 bytes from one location to another using optimised 20 * instructions. The locations should not overlap. 21 * 22 * @param dst 23 * Pointer to the destination of the data. 24 * @param src 25 * Pointer to the source data. 26 */ 27 static inline void 28 rte_mov16(uint8_t *dst, const uint8_t *src); 29 30 /** 31 * Copy 32 bytes from one location to another using optimised 32 * instructions. The locations should not overlap. 33 * 34 * @param dst 35 * Pointer to the destination of the data. 36 * @param src 37 * Pointer to the source data. 38 */ 39 static inline void 40 rte_mov32(uint8_t *dst, const uint8_t *src); 41 42 #ifdef __DOXYGEN__ 43 44 /** 45 * Copy 48 bytes from one location to another using optimised 46 * instructions. The locations should not overlap. 47 * 48 * @param dst 49 * Pointer to the destination of the data. 50 * @param src 51 * Pointer to the source data. 52 */ 53 static inline void 54 rte_mov48(uint8_t *dst, const uint8_t *src); 55 56 #endif /* __DOXYGEN__ */ 57 58 /** 59 * Copy 64 bytes from one location to another using optimised 60 * instructions. The locations should not overlap. 61 * 62 * @param dst 63 * Pointer to the destination of the data. 64 * @param src 65 * Pointer to the source data. 66 */ 67 static inline void 68 rte_mov64(uint8_t *dst, const uint8_t *src); 69 70 /** 71 * Copy 128 bytes from one location to another using optimised 72 * instructions. The locations should not overlap. 73 * 74 * @param dst 75 * Pointer to the destination of the data. 76 * @param src 77 * Pointer to the source data. 78 */ 79 static inline void 80 rte_mov128(uint8_t *dst, const uint8_t *src); 81 82 /** 83 * Copy 256 bytes from one location to another using optimised 84 * instructions. The locations should not overlap. 85 * 86 * @param dst 87 * Pointer to the destination of the data. 88 * @param src 89 * Pointer to the source data. 90 */ 91 static inline void 92 rte_mov256(uint8_t *dst, const uint8_t *src); 93 94 #ifdef __DOXYGEN__ 95 96 /** 97 * Copy bytes from one location to another. The locations must not overlap. 98 * 99 * @note This is implemented as a macro, so it's address should not be taken 100 * and care is needed as parameter expressions may be evaluated multiple times. 101 * 102 * @note For x86 platforms to enable the AVX-512 memcpy implementation, set 103 * -DRTE_MEMCPY_AVX512 macro in CFLAGS, or define the RTE_MEMCPY_AVX512 macro 104 * explicitly in the source file before including the rte_memcpy header file. 105 * 106 * @param dst 107 * Pointer to the destination of the data. 108 * @param src 109 * Pointer to the source data. 110 * @param n 111 * Number of bytes to copy. 112 * @return 113 * Pointer to the destination data. 114 */ 115 static void * 116 rte_memcpy(void *dst, const void *src, size_t n); 117 118 #endif /* __DOXYGEN__ */ 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif /* _RTE_MEMCPY_H_ */ 125