DPDK 26.07.0-rc1
rte_cmp_arm64.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015 Cavium, Inc
3 */
4
5/* Functions to compare multiple of 16 byte keys */
6static inline int
7rte_hash_k16_cmp_eq(const void *key1, const void *key2,
8 size_t key_len __rte_unused)
9{
10 uint64_t x0, x1, y0, y1;
11
12 asm volatile(
13 "ldp %x[x1], %x[x0], [%x[p1]]"
14 : [x1]"=r"(x1), [x0]"=r"(x0)
15 : [p1]"r"(key1)
16 );
17 asm volatile(
18 "ldp %x[y1], %x[y0], [%x[p2]]"
19 : [y1]"=r"(y1), [y0]"=r"(y0)
20 : [p2]"r"(key2)
21 );
22 x0 ^= y0;
23 x1 ^= y1;
24 return !(x0 == 0 && x1 == 0);
25}
26
27static inline int
28rte_hash_k32_cmp_eq(const void *key1, const void *key2, size_t key_len __rte_unused)
29{
30 return rte_hash_k16_cmp_eq(key1, key2, 16) |
31 rte_hash_k16_cmp_eq((const uint8_t *)key1 + 16,
32 (const uint8_t *)key2 + 16, 16);
33}
#define __rte_unused
Definition: rte_common.h:248