Debian Codegraph @

Modules/ThirdParty/ZLIB/src/itkzlib-ng/arch/arm/slide_hash_armv6.c

raw
1 /* slide_hash_armv6.c -- Optimized hash table shifting for ARMv6 with support for SIMD instructions
2 * Copyright (C) 2023 Cameron Cawley
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6 #if defined(ARM_SIMD)
7 #include "acle_intrins.h"
8 #include "../../zbuild.h"
9 #include "../../deflate.h"
10
11 /* SIMD version of hash_chain rebase */
12 static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) {
13 Z_REGISTER uint16x2_t v;
14 uint16x2_t p0, p1, p2, p3;
15 Z_REGISTER size_t n;
16
17 size_t size = entries*sizeof(table[0]);
18 Assert((size % (sizeof(uint16x2_t) * 4) == 0), "hash table size err");
19
20 Assert(sizeof(Pos) == 2, "Wrong Pos size");
21 v = wsize | (wsize << 16);
22
23 n = size / (sizeof(uint16x2_t) * 4);
24 do {
25 p0 = *((const uint16x2_t *)(table));
26 p1 = *((const uint16x2_t *)(table+2));
27 p2 = *((const uint16x2_t *)(table+4));
28 p3 = *((const uint16x2_t *)(table+6));
29 p0 = __uqsub16(p0, v);
30 p1 = __uqsub16(p1, v);
31 p2 = __uqsub16(p2, v);
32 p3 = __uqsub16(p3, v);
33 *((uint16x2_t *)(table)) = p0;
34 *((uint16x2_t *)(table+2)) = p1;
35 *((uint16x2_t *)(table+4)) = p2;
36 *((uint16x2_t *)(table+6)) = p3;
37 table += 8;
38 } while (--n);
39 }
40
41 Z_INTERNAL void slide_hash_armv6(deflate_state *s) {
42 unsigned int wsize = s->w_size;
43
44 slide_hash_chain(s->head, HASH_SIZE, wsize);
45 slide_hash_chain(s->prev, wsize, wsize);
46 }
47 #endif