Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/sign-extend-2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-mabi=lp64d -O2 -fdump-rtl-expand" } */
3 /* { dg-final { scan-rtl-dump "subreg/s" "expand" } } */
4 /* { dg-final { scan-assembler-not "slli.w\t\\\$r\[0-9\]+,\\\$r\[0-9\]+,0" } } */
5
6 #include <stdint.h>
7 #define my_min(x, y) ((x) < (y) ? (x) : (y))
8
9 void
10 bt_skip_func (const uint32_t len_limit, const uint32_t pos,
11 const uint8_t *const cur, uint32_t cur_match,
12 uint32_t *const son, const uint32_t cyclic_pos,
13 const uint32_t cyclic_size)
14 {
15 uint32_t *ptr0 = son + (cyclic_pos << 1) + 1;
16 uint32_t *ptr1 = son + (cyclic_pos << 1);
17
18 uint32_t len0 = 0;
19 uint32_t len1 = 0;
20
21 while (1)
22 {
23 const uint32_t delta = pos - cur_match;
24 uint32_t *pair
25 = son
26 + ((cyclic_pos - delta + (delta > cyclic_pos ? cyclic_size : 0))
27 << 1);
28 const uint8_t *pb = cur - delta;
29 uint32_t len = my_min (len0, len1);
30
31 if (pb[len] == cur[len])
32 {
33 while (++len != len_limit)
34 if (pb[len] != cur[len])
35 break;
36
37 if (len == len_limit)
38 {
39 *ptr1 = pair[0];
40 *ptr0 = pair[1];
41 return;
42 }
43 }
44
45 if (pb[len] < cur[len])
46 {
47 *ptr1 = cur_match;
48 ptr1 = pair + 1;
49 cur_match = *ptr1;
50 len1 = len;
51 }
52 else
53 {
54 *ptr0 = cur_match;
55 ptr0 = pair;
56 cur_match = *ptr0;
57 len0 = len;
58 }
59 }
60 }