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