source: trunk/lib/idisa_cpp/idisa_sse3.cpp @ 1556

Last change on this file since 1556 was 1556, checked in by cameron, 8 years ago

bitblock::popcount; clean libgen/idisa_lib out

File size: 150.9 KB
Line 
1#ifndef IDISA_SSE3_CPP
2#define IDISA_SSE3_CPP
3#include <stdint.h>
4#include "../config.hpp"
5
6#include "pmmintrin.h"
7
8typedef __m128i bitblock128_t;
9template <uint32_t fw>
10class simd128
11{
12public:
13        static IDISA_ALWAYS_INLINE bitblock128_t max(bitblock128_t arg1, bitblock128_t arg2);
14        static IDISA_ALWAYS_INLINE bitblock128_t mult(bitblock128_t arg1, bitblock128_t arg2);
15        static IDISA_ALWAYS_INLINE bitblock128_t gt(bitblock128_t arg1, bitblock128_t arg2);
16        static IDISA_ALWAYS_INLINE bitblock128_t umult(bitblock128_t arg1, bitblock128_t arg2);
17        static IDISA_ALWAYS_INLINE bitblock128_t ult(bitblock128_t arg1, bitblock128_t arg2);
18        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
19        static IDISA_ALWAYS_INLINE bitblock128_t ctz(bitblock128_t arg1);
20        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t shift_mask);
21        static IDISA_ALWAYS_INLINE bitblock128_t eq(bitblock128_t arg1, bitblock128_t arg2);
22        static IDISA_ALWAYS_INLINE bitblock128_t popcount(bitblock128_t arg1);
23        static IDISA_ALWAYS_INLINE bitblock128_t neg(bitblock128_t arg1);
24        static IDISA_ALWAYS_INLINE bitblock128_t himask();
25        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
26        static IDISA_ALWAYS_INLINE bitblock128_t ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
27        static IDISA_ALWAYS_INLINE bitblock128_t sub(bitblock128_t arg1, bitblock128_t arg2);
28        static IDISA_ALWAYS_INLINE bitblock128_t add_hl(bitblock128_t arg1);
29        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t shift_mask);
30        static IDISA_ALWAYS_INLINE bitblock128_t umin(bitblock128_t arg1, bitblock128_t arg2);
31        template <uint64_t val> static IDISA_ALWAYS_INLINE bitblock128_t constant();
32        static IDISA_ALWAYS_INLINE bitblock128_t min(bitblock128_t arg1, bitblock128_t arg2);
33        static IDISA_ALWAYS_INLINE bitblock128_t lomask();
34        static IDISA_ALWAYS_INLINE bitblock128_t umax(bitblock128_t arg1, bitblock128_t arg2);
35        static IDISA_ALWAYS_INLINE bitblock128_t abs(bitblock128_t arg1);
36        static IDISA_ALWAYS_INLINE bitblock128_t xor_hl(bitblock128_t arg1);
37        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srai(bitblock128_t arg1);
38        static IDISA_ALWAYS_INLINE bitblock128_t lt(bitblock128_t arg1, bitblock128_t arg2);
39        static IDISA_ALWAYS_INLINE bitblock128_t add(bitblock128_t arg1, bitblock128_t arg2);
40        static IDISA_ALWAYS_INLINE bitblock128_t ugt(bitblock128_t arg1, bitblock128_t arg2);
41};
42
43template <uint32_t fw>
44class hsimd128
45{
46public:
47        static IDISA_ALWAYS_INLINE bitblock128_t umin_hl(bitblock128_t arg1, bitblock128_t arg2);
48        static IDISA_ALWAYS_INLINE bitblock128_t add_hl(bitblock128_t arg1, bitblock128_t arg2);
49        static IDISA_ALWAYS_INLINE bitblock128_t packss(bitblock128_t arg1, bitblock128_t arg2);
50        static IDISA_ALWAYS_INLINE bitblock128_t packh(bitblock128_t arg1, bitblock128_t arg2);
51        static IDISA_ALWAYS_INLINE uint64_t signmask(bitblock128_t arg1);
52        static IDISA_ALWAYS_INLINE bitblock128_t packl(bitblock128_t arg1, bitblock128_t arg2);
53        static IDISA_ALWAYS_INLINE bitblock128_t min_hl(bitblock128_t arg1, bitblock128_t arg2);
54        static IDISA_ALWAYS_INLINE bitblock128_t packus(bitblock128_t arg1, bitblock128_t arg2);
55};
56
57template <uint32_t fw>
58class esimd128
59{
60public:
61        static IDISA_ALWAYS_INLINE bitblock128_t mergel(bitblock128_t arg1, bitblock128_t arg2);
62        static IDISA_ALWAYS_INLINE bitblock128_t mergeh(bitblock128_t arg1, bitblock128_t arg2);
63        static IDISA_ALWAYS_INLINE bitblock128_t zeroextendh(bitblock128_t arg1);
64        static IDISA_ALWAYS_INLINE bitblock128_t zeroextendl(bitblock128_t arg1);
65        static IDISA_ALWAYS_INLINE bitblock128_t signextendh(bitblock128_t arg1);
66        static IDISA_ALWAYS_INLINE bitblock128_t signextendl(bitblock128_t arg1);
67};
68
69template <uint32_t fw>
70class mvmd128
71{
72public:
73        template <uint64_t msk> static IDISA_ALWAYS_INLINE bitblock128_t shufflei(bitblock128_t arg1);
74        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t dsrli(bitblock128_t arg1, bitblock128_t arg2);
75        static IDISA_ALWAYS_INLINE bitblock128_t fill(uint64_t val1);
76        template <uint64_t pos> static IDISA_ALWAYS_INLINE uint64_t extract(bitblock128_t arg1);
77        template <uint64_t pos> static IDISA_ALWAYS_INLINE bitblock128_t splat(bitblock128_t arg1);
78        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
79        static IDISA_ALWAYS_INLINE bitblock128_t fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
80        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
81        static IDISA_ALWAYS_INLINE bitblock128_t fill2(uint64_t val1, uint64_t val2);
82        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t dslli(bitblock128_t arg1, bitblock128_t arg2);
83        static IDISA_ALWAYS_INLINE bitblock128_t fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
84        static IDISA_ALWAYS_INLINE bitblock128_t fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16);
85};
86
87class bitblock128
88{
89public:
90        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
91        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
92        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
93};
94
95//Declaration Part
96IDISA_ALWAYS_INLINE bitblock128_t simd_nor(bitblock128_t arg1, bitblock128_t arg2);
97IDISA_ALWAYS_INLINE bitblock128_t simd_not(bitblock128_t arg1);
98IDISA_ALWAYS_INLINE bitblock128_t simd_andc(bitblock128_t arg1, bitblock128_t arg2);
99IDISA_ALWAYS_INLINE bitblock128_t simd_or(bitblock128_t arg1, bitblock128_t arg2);
100IDISA_ALWAYS_INLINE bitblock128_t simd_and(bitblock128_t arg1, bitblock128_t arg2);
101IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2);
102template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::max(bitblock128_t arg1, bitblock128_t arg2);
103template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::max(bitblock128_t arg1, bitblock128_t arg2);
104template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::max(bitblock128_t arg1, bitblock128_t arg2);
105template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::max(bitblock128_t arg1, bitblock128_t arg2);
106template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::max(bitblock128_t arg1, bitblock128_t arg2);
107template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::max(bitblock128_t arg1, bitblock128_t arg2);
108template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::max(bitblock128_t arg1, bitblock128_t arg2);
109template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::max(bitblock128_t arg1, bitblock128_t arg2);
110template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::mult(bitblock128_t arg1, bitblock128_t arg2);
111template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::mult(bitblock128_t arg1, bitblock128_t arg2);
112template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::mult(bitblock128_t arg1, bitblock128_t arg2);
113template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::mult(bitblock128_t arg1, bitblock128_t arg2);
114template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::mult(bitblock128_t arg1, bitblock128_t arg2);
115template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::mult(bitblock128_t arg1, bitblock128_t arg2);
116template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::mult(bitblock128_t arg1, bitblock128_t arg2);
117template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::mult(bitblock128_t arg1, bitblock128_t arg2);
118template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::gt(bitblock128_t arg1, bitblock128_t arg2);
119template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::gt(bitblock128_t arg1, bitblock128_t arg2);
120template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::gt(bitblock128_t arg1, bitblock128_t arg2);
121template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::gt(bitblock128_t arg1, bitblock128_t arg2);
122template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::gt(bitblock128_t arg1, bitblock128_t arg2);
123template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::gt(bitblock128_t arg1, bitblock128_t arg2);
124template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::gt(bitblock128_t arg1, bitblock128_t arg2);
125template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::gt(bitblock128_t arg1, bitblock128_t arg2);
126template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umult(bitblock128_t arg1, bitblock128_t arg2);
127template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umult(bitblock128_t arg1, bitblock128_t arg2);
128template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umult(bitblock128_t arg1, bitblock128_t arg2);
129template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umult(bitblock128_t arg1, bitblock128_t arg2);
130template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umult(bitblock128_t arg1, bitblock128_t arg2);
131template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umult(bitblock128_t arg1, bitblock128_t arg2);
132template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umult(bitblock128_t arg1, bitblock128_t arg2);
133template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ult(bitblock128_t arg1, bitblock128_t arg2);
134template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ult(bitblock128_t arg1, bitblock128_t arg2);
135template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ult(bitblock128_t arg1, bitblock128_t arg2);
136template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ult(bitblock128_t arg1, bitblock128_t arg2);
137template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ult(bitblock128_t arg1, bitblock128_t arg2);
138template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ult(bitblock128_t arg1, bitblock128_t arg2);
139template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ult(bitblock128_t arg1, bitblock128_t arg2);
140template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ult(bitblock128_t arg1, bitblock128_t arg2);
141template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::lt(bitblock128_t arg1, bitblock128_t arg2);
142template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::lt(bitblock128_t arg1, bitblock128_t arg2);
143template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::lt(bitblock128_t arg1, bitblock128_t arg2);
144template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::lt(bitblock128_t arg1, bitblock128_t arg2);
145template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::lt(bitblock128_t arg1, bitblock128_t arg2);
146template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::lt(bitblock128_t arg1, bitblock128_t arg2);
147template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::lt(bitblock128_t arg1, bitblock128_t arg2);
148template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::lt(bitblock128_t arg1, bitblock128_t arg2);
149template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::srli(bitblock128_t arg1);
150template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::srli(bitblock128_t arg1);
151template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::srli(bitblock128_t arg1);
152template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::srli(bitblock128_t arg1);
153template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::srli(bitblock128_t arg1);
154template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srli(bitblock128_t arg1);
155template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srli(bitblock128_t arg1);
156template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ctz(bitblock128_t arg1);
157template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ctz(bitblock128_t arg1);
158template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ctz(bitblock128_t arg1);
159template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ctz(bitblock128_t arg1);
160template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ctz(bitblock128_t arg1);
161template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ctz(bitblock128_t arg1);
162template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ctz(bitblock128_t arg1);
163template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ctz(bitblock128_t arg1);
164template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask);
165template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::sll(bitblock128_t arg1, bitblock128_t shift_mask);
166template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ugt(bitblock128_t arg1, bitblock128_t arg2);
167template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ugt(bitblock128_t arg1, bitblock128_t arg2);
168template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ugt(bitblock128_t arg1, bitblock128_t arg2);
169template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ugt(bitblock128_t arg1, bitblock128_t arg2);
170template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ugt(bitblock128_t arg1, bitblock128_t arg2);
171template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ugt(bitblock128_t arg1, bitblock128_t arg2);
172template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ugt(bitblock128_t arg1, bitblock128_t arg2);
173template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ugt(bitblock128_t arg1, bitblock128_t arg2);
174template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::xor_hl(bitblock128_t arg1);
175template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::xor_hl(bitblock128_t arg1);
176template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::xor_hl(bitblock128_t arg1);
177template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::xor_hl(bitblock128_t arg1);
178template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::xor_hl(bitblock128_t arg1);
179template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::xor_hl(bitblock128_t arg1);
180template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::xor_hl(bitblock128_t arg1);
181template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::popcount(bitblock128_t arg1);
182template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::popcount(bitblock128_t arg1);
183template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::popcount(bitblock128_t arg1);
184template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::popcount(bitblock128_t arg1);
185template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::popcount(bitblock128_t arg1);
186template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::popcount(bitblock128_t arg1);
187template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::popcount(bitblock128_t arg1);
188template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::popcount(bitblock128_t arg1);
189template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::neg(bitblock128_t arg1);
190template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::neg(bitblock128_t arg1);
191template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::neg(bitblock128_t arg1);
192template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::neg(bitblock128_t arg1);
193template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::neg(bitblock128_t arg1);
194template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::neg(bitblock128_t arg1);
195template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::neg(bitblock128_t arg1);
196template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::neg(bitblock128_t arg1);
197template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::slli(bitblock128_t arg1);
198template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::slli(bitblock128_t arg1);
199template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::slli(bitblock128_t arg1);
200template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::slli(bitblock128_t arg1);
201template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::slli(bitblock128_t arg1);
202template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::slli(bitblock128_t arg1);
203template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::slli(bitblock128_t arg1);
204template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
205template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
206template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
207template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
208template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
209template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
210template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
211template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3);
212template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::sub(bitblock128_t arg1, bitblock128_t arg2);
213template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::sub(bitblock128_t arg1, bitblock128_t arg2);
214template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::sub(bitblock128_t arg1, bitblock128_t arg2);
215template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::sub(bitblock128_t arg1, bitblock128_t arg2);
216template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::sub(bitblock128_t arg1, bitblock128_t arg2);
217template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::sub(bitblock128_t arg1, bitblock128_t arg2);
218template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sub(bitblock128_t arg1, bitblock128_t arg2);
219template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::sub(bitblock128_t arg1, bitblock128_t arg2);
220template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::add_hl(bitblock128_t arg1);
221template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::add_hl(bitblock128_t arg1);
222template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::add_hl(bitblock128_t arg1);
223template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::add_hl(bitblock128_t arg1);
224template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::add_hl(bitblock128_t arg1);
225template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::add_hl(bitblock128_t arg1);
226template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::add_hl(bitblock128_t arg1);
227template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask);
228template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srl(bitblock128_t arg1, bitblock128_t shift_mask);
229template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::lomask();
230template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::lomask();
231template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::lomask();
232template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::lomask();
233template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::lomask();
234template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::lomask();
235template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::lomask();
236template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant();
237template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant();
238template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant();
239template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant();
240template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant();
241template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant();
242template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant();
243template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant();
244template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::min(bitblock128_t arg1, bitblock128_t arg2);
245template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::min(bitblock128_t arg1, bitblock128_t arg2);
246template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::min(bitblock128_t arg1, bitblock128_t arg2);
247template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::min(bitblock128_t arg1, bitblock128_t arg2);
248template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::min(bitblock128_t arg1, bitblock128_t arg2);
249template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::min(bitblock128_t arg1, bitblock128_t arg2);
250template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::min(bitblock128_t arg1, bitblock128_t arg2);
251template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::min(bitblock128_t arg1, bitblock128_t arg2);
252template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umin(bitblock128_t arg1, bitblock128_t arg2);
253template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umin(bitblock128_t arg1, bitblock128_t arg2);
254template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umin(bitblock128_t arg1, bitblock128_t arg2);
255template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umin(bitblock128_t arg1, bitblock128_t arg2);
256template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umin(bitblock128_t arg1, bitblock128_t arg2);
257template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umin(bitblock128_t arg1, bitblock128_t arg2);
258template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umin(bitblock128_t arg1, bitblock128_t arg2);
259template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::umin(bitblock128_t arg1, bitblock128_t arg2);
260template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umax(bitblock128_t arg1, bitblock128_t arg2);
261template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umax(bitblock128_t arg1, bitblock128_t arg2);
262template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umax(bitblock128_t arg1, bitblock128_t arg2);
263template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umax(bitblock128_t arg1, bitblock128_t arg2);
264template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umax(bitblock128_t arg1, bitblock128_t arg2);
265template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umax(bitblock128_t arg1, bitblock128_t arg2);
266template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umax(bitblock128_t arg1, bitblock128_t arg2);
267template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::umax(bitblock128_t arg1, bitblock128_t arg2);
268template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::eq(bitblock128_t arg1, bitblock128_t arg2);
269template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::eq(bitblock128_t arg1, bitblock128_t arg2);
270template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::eq(bitblock128_t arg1, bitblock128_t arg2);
271template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::eq(bitblock128_t arg1, bitblock128_t arg2);
272template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::eq(bitblock128_t arg1, bitblock128_t arg2);
273template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::eq(bitblock128_t arg1, bitblock128_t arg2);
274template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::eq(bitblock128_t arg1, bitblock128_t arg2);
275template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::eq(bitblock128_t arg1, bitblock128_t arg2);
276template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::srai(bitblock128_t arg1);
277template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::srai(bitblock128_t arg1);
278template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::srai(bitblock128_t arg1);
279template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::srai(bitblock128_t arg1);
280template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::srai(bitblock128_t arg1);
281template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srai(bitblock128_t arg1);
282template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srai(bitblock128_t arg1);
283template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::himask();
284template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::himask();
285template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::himask();
286template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::himask();
287template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::himask();
288template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::himask();
289template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::himask();
290template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::add(bitblock128_t arg1, bitblock128_t arg2);
291template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::add(bitblock128_t arg1, bitblock128_t arg2);
292template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::add(bitblock128_t arg1, bitblock128_t arg2);
293template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::add(bitblock128_t arg1, bitblock128_t arg2);
294template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::add(bitblock128_t arg1, bitblock128_t arg2);
295template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::add(bitblock128_t arg1, bitblock128_t arg2);
296template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::add(bitblock128_t arg1, bitblock128_t arg2);
297template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::add(bitblock128_t arg1, bitblock128_t arg2);
298template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::abs(bitblock128_t arg1);
299template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::abs(bitblock128_t arg1);
300template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::abs(bitblock128_t arg1);
301template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::abs(bitblock128_t arg1);
302template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::abs(bitblock128_t arg1);
303template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::abs(bitblock128_t arg1);
304template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::abs(bitblock128_t arg1);
305template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::abs(bitblock128_t arg1);
306template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
307template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
308template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
309template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
310template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
311template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
312template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::umin_hl(bitblock128_t arg1, bitblock128_t arg2);
313template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
314template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
315template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
316template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
317template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
318template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
319template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::add_hl(bitblock128_t arg1, bitblock128_t arg2);
320template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packss(bitblock128_t arg1, bitblock128_t arg2);
321template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packss(bitblock128_t arg1, bitblock128_t arg2);
322template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packss(bitblock128_t arg1, bitblock128_t arg2);
323template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packss(bitblock128_t arg1, bitblock128_t arg2);
324template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packss(bitblock128_t arg1, bitblock128_t arg2);
325template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packss(bitblock128_t arg1, bitblock128_t arg2);
326template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packss(bitblock128_t arg1, bitblock128_t arg2);
327template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<4>::signmask(bitblock128_t arg1);
328template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<8>::signmask(bitblock128_t arg1);
329template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<16>::signmask(bitblock128_t arg1);
330template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1);
331template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1);
332template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1);
333template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packl(bitblock128_t arg1, bitblock128_t arg2);
334template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packl(bitblock128_t arg1, bitblock128_t arg2);
335template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packl(bitblock128_t arg1, bitblock128_t arg2);
336template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packl(bitblock128_t arg1, bitblock128_t arg2);
337template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packl(bitblock128_t arg1, bitblock128_t arg2);
338template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packl(bitblock128_t arg1, bitblock128_t arg2);
339template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packl(bitblock128_t arg1, bitblock128_t arg2);
340template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packh(bitblock128_t arg1, bitblock128_t arg2);
341template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packh(bitblock128_t arg1, bitblock128_t arg2);
342template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packh(bitblock128_t arg1, bitblock128_t arg2);
343template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packh(bitblock128_t arg1, bitblock128_t arg2);
344template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packh(bitblock128_t arg1, bitblock128_t arg2);
345template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packh(bitblock128_t arg1, bitblock128_t arg2);
346template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packh(bitblock128_t arg1, bitblock128_t arg2);
347template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
348template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
349template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
350template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
351template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
352template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
353template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::min_hl(bitblock128_t arg1, bitblock128_t arg2);
354template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packus(bitblock128_t arg1, bitblock128_t arg2);
355template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packus(bitblock128_t arg1, bitblock128_t arg2);
356template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packus(bitblock128_t arg1, bitblock128_t arg2);
357template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packus(bitblock128_t arg1, bitblock128_t arg2);
358template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packus(bitblock128_t arg1, bitblock128_t arg2);
359template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packus(bitblock128_t arg1, bitblock128_t arg2);
360template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packus(bitblock128_t arg1, bitblock128_t arg2);
361template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::mergel(bitblock128_t arg1, bitblock128_t arg2);
362template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::mergel(bitblock128_t arg1, bitblock128_t arg2);
363template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::mergel(bitblock128_t arg1, bitblock128_t arg2);
364template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::mergel(bitblock128_t arg1, bitblock128_t arg2);
365template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::mergel(bitblock128_t arg1, bitblock128_t arg2);
366template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::mergel(bitblock128_t arg1, bitblock128_t arg2);
367template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::mergel(bitblock128_t arg1, bitblock128_t arg2);
368template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
369template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
370template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
371template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
372template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
373template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
374template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::mergeh(bitblock128_t arg1, bitblock128_t arg2);
375template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::zeroextendh(bitblock128_t arg1);
376template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::zeroextendh(bitblock128_t arg1);
377template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::zeroextendh(bitblock128_t arg1);
378template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::zeroextendh(bitblock128_t arg1);
379template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::zeroextendh(bitblock128_t arg1);
380template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::zeroextendh(bitblock128_t arg1);
381template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::zeroextendh(bitblock128_t arg1);
382template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::zeroextendl(bitblock128_t arg1);
383template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::zeroextendl(bitblock128_t arg1);
384template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::zeroextendl(bitblock128_t arg1);
385template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::zeroextendl(bitblock128_t arg1);
386template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::zeroextendl(bitblock128_t arg1);
387template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::zeroextendl(bitblock128_t arg1);
388template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::zeroextendl(bitblock128_t arg1);
389template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::signextendh(bitblock128_t arg1);
390template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::signextendh(bitblock128_t arg1);
391template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::signextendh(bitblock128_t arg1);
392template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::signextendh(bitblock128_t arg1);
393template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::signextendh(bitblock128_t arg1);
394template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::signextendh(bitblock128_t arg1);
395template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::signextendh(bitblock128_t arg1);
396template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::signextendl(bitblock128_t arg1);
397template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::signextendl(bitblock128_t arg1);
398template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::signextendl(bitblock128_t arg1);
399template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::signextendl(bitblock128_t arg1);
400template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::signextendl(bitblock128_t arg1);
401template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::signextendl(bitblock128_t arg1);
402template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::signextendl(bitblock128_t arg1);
403template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::shufflei(bitblock128_t arg1);
404template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::shufflei(bitblock128_t arg1);
405template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::shufflei(bitblock128_t arg1);
406template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
407template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
408template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
409template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
410template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
411template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
412template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::dsrli(bitblock128_t arg1, bitblock128_t arg2);
413template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill(uint64_t val1);
414template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill(uint64_t val1);
415template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill(uint64_t val1);
416template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill(uint64_t val1);
417template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill(uint64_t val1);
418template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill(uint64_t val1);
419template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::fill(uint64_t val1);
420template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::fill(uint64_t val1);
421template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<1>::extract(bitblock128_t arg1);
422template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<2>::extract(bitblock128_t arg1);
423template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<4>::extract(bitblock128_t arg1);
424template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<8>::extract(bitblock128_t arg1);
425template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<16>::extract(bitblock128_t arg1);
426template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<32>::extract(bitblock128_t arg1);
427template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<64>::extract(bitblock128_t arg1);
428template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::splat(bitblock128_t arg1);
429template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::splat(bitblock128_t arg1);
430template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::splat(bitblock128_t arg1);
431template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::splat(bitblock128_t arg1);
432template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::splat(bitblock128_t arg1);
433template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::splat(bitblock128_t arg1);
434template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::splat(bitblock128_t arg1);
435template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::splat(bitblock128_t arg1);
436template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16);
437template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16);
438template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16);
439template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16);
440template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::slli(bitblock128_t arg1);
441template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::slli(bitblock128_t arg1);
442template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::slli(bitblock128_t arg1);
443template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::slli(bitblock128_t arg1);
444template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::slli(bitblock128_t arg1);
445template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::slli(bitblock128_t arg1);
446template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::slli(bitblock128_t arg1);
447template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
448template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
449template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
450template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
451template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
452template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4);
453template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::srli(bitblock128_t arg1);
454template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::srli(bitblock128_t arg1);
455template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::srli(bitblock128_t arg1);
456template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::srli(bitblock128_t arg1);
457template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::srli(bitblock128_t arg1);
458template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::srli(bitblock128_t arg1);
459template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::srli(bitblock128_t arg1);
460template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill2(uint64_t val1, uint64_t val2);
461template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill2(uint64_t val1, uint64_t val2);
462template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill2(uint64_t val1, uint64_t val2);
463template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill2(uint64_t val1, uint64_t val2);
464template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill2(uint64_t val1, uint64_t val2);
465template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill2(uint64_t val1, uint64_t val2);
466template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::fill2(uint64_t val1, uint64_t val2);
467template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::dslli(bitblock128_t arg1, bitblock128_t arg2);
468template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::dslli(bitblock128_t arg1, bitblock128_t arg2);
469template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::dslli(bitblock128_t arg1, bitblock128_t arg2);
470template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::dslli(bitblock128_t arg1, bitblock128_t arg2);
471template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::dslli(bitblock128_t arg1, bitblock128_t arg2);
472template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::dslli(bitblock128_t arg1, bitblock128_t arg2);
473template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::dslli(bitblock128_t arg1, bitblock128_t arg2);
474template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
475template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
476template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
477template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
478template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8);
479
480//Implementation Part
481
482#define shufflemask4(s1, s2, s3, s4) \
483        ((s1<<6) | (s2<<4) | (s3<<2) | s4)
484
485#define shufflemask4_from_shufflemask2(msk) \
486        (msk==3 ? 238 : (msk==2 ? 228 : (msk==1 ? 78 : 68)))
487
488#define shufflemask8_to_shufflemask4(msk) \
489        ((msk&3) | (((msk>>3)&3)<<2) | (((msk>>6)&3)<<4) | (((msk>>9)&3)<<6) | (((msk>>12)&3)<<8) | (((msk>>15)&3)<<10) | (((msk>>18)&3)<<12) | (((msk>>21)&3)<<14))
490//The total number of operations is 2
491IDISA_ALWAYS_INLINE bitblock128_t simd_nor(bitblock128_t arg1, bitblock128_t arg2)
492{
493        return simd_not(simd_or(arg1, arg2));
494}
495
496//The total number of operations is 1
497IDISA_ALWAYS_INLINE bitblock128_t simd_not(bitblock128_t arg1)
498{
499        return simd_xor(arg1, simd128<32>::constant<-1>());
500}
501
502//The total number of operations is 1
503IDISA_ALWAYS_INLINE bitblock128_t simd_andc(bitblock128_t arg1, bitblock128_t arg2)
504{
505        return _mm_andnot_si128(arg2, arg1);
506}
507
508//The total number of operations is 1
509IDISA_ALWAYS_INLINE bitblock128_t simd_or(bitblock128_t arg1, bitblock128_t arg2)
510{
511        return _mm_or_si128(arg1, arg2);
512}
513
514//The total number of operations is 1
515IDISA_ALWAYS_INLINE bitblock128_t simd_and(bitblock128_t arg1, bitblock128_t arg2)
516{
517        return _mm_and_si128(arg1, arg2);
518}
519
520//The total number of operations is 1
521IDISA_ALWAYS_INLINE bitblock128_t simd_xor(bitblock128_t arg1, bitblock128_t arg2)
522{
523        return _mm_xor_si128(arg1, arg2);
524}
525
526//The total number of operations is 39
527template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::max(bitblock128_t arg1, bitblock128_t arg2)
528{
529        bitblock128_t high_bit = simd128<1>::constant<(1)>();
530        return simd_xor(simd128<1>::umax(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
531}
532
533//The total number of operations is 19
534template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::max(bitblock128_t arg1, bitblock128_t arg2)
535{
536        return simd128<1>::ifh(simd128<2>::himask(), simd_and(arg1, arg2), simd_or(simd_and(arg2, simd128<128>::srli<1>(simd_or(arg1, simd_not(arg2)))), simd_and(arg1, simd128<128>::srli<1>(simd_or(simd_not(arg1), arg2)))));
537}
538
539//The total number of operations is 9
540template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::max(bitblock128_t arg1, bitblock128_t arg2)
541{
542        bitblock128_t high_bit = simd128<4>::constant<(8)>();
543        return simd_xor(simd128<4>::umax(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
544}
545
546//The total number of operations is 4
547template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::max(bitblock128_t arg1, bitblock128_t arg2)
548{
549        return simd128<1>::ifh(simd128<8>::gt(arg1, arg2), arg1, arg2);
550}
551
552//The total number of operations is 1
553template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::max(bitblock128_t arg1, bitblock128_t arg2)
554{
555        return _mm_max_epi16(arg1, arg2);
556}
557
558//The total number of operations is 4
559template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::max(bitblock128_t arg1, bitblock128_t arg2)
560{
561        return simd128<1>::ifh(simd128<32>::gt(arg1, arg2), arg1, arg2);
562}
563
564//The total number of operations is 18
565template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::max(bitblock128_t arg1, bitblock128_t arg2)
566{
567        return simd128<1>::ifh(simd128<64>::gt(arg1, arg2), arg1, arg2);
568}
569
570//The total number of operations is 65
571template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::max(bitblock128_t arg1, bitblock128_t arg2)
572{
573        bitblock128_t hiAns = simd128<(64)>::max(arg1, arg2);
574        bitblock128_t loAns = simd128<(64)>::umax(arg1, arg2);
575        bitblock128_t eqMask1 = simd128<128>::srli<(64)>(simd128<(64)>::eq(hiAns, arg1));
576        bitblock128_t eqMask2 = simd128<128>::srli<(64)>(simd128<(64)>::eq(hiAns, arg2));
577        return simd128<1>::ifh(simd128<128>::himask(), hiAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, loAns, arg1), arg2));
578}
579
580//The total number of operations is 57
581template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::mult(bitblock128_t arg1, bitblock128_t arg2)
582{
583        bitblock128_t loMask = simd128<(2)>::lomask();
584        bitblock128_t tmpAns1 = simd128<(2)>::mult(simd_and(loMask, arg1), simd_and(loMask, arg2));
585        bitblock128_t tmpAns2 = simd128<(2)>::mult(simd128<(2)>::srli<1>(arg1), simd128<(2)>::srli<1>(arg2));
586        return simd128<1>::ifh(loMask, tmpAns1, simd128<(2)>::slli<1>(tmpAns2));
587}
588
589//The total number of operations is 23
590template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::mult(bitblock128_t arg1, bitblock128_t arg2)
591{
592        bitblock128_t tmp1 = simd128<128>::slli<1>(arg1);
593        bitblock128_t tmp2 = simd128<128>::slli<1>(arg2);
594        return simd128<1>::ifh(simd128<2>::himask(), simd_or(simd_and(tmp1, simd_and(arg2, simd_or(simd_not(arg1), simd_not(tmp2)))), simd_and(arg1, simd_and(tmp2, simd_or(simd_not(tmp1), simd_not(arg2))))), simd_and(arg1, arg2));
595}
596
597//The total number of operations is 31
598template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::mult(bitblock128_t arg1, bitblock128_t arg2)
599{
600        bitblock128_t loMask = simd128<(8)>::lomask();
601        bitblock128_t tmpAns1 = simd128<(8)>::mult(simd_and(loMask, arg1), simd_and(loMask, arg2));
602        bitblock128_t tmpAns2 = simd128<(8)>::mult(simd128<(8)>::srli<4>(arg1), simd128<(8)>::srli<4>(arg2));
603        return simd128<1>::ifh(loMask, tmpAns1, simd128<(8)>::slli<4>(tmpAns2));
604}
605
606//The total number of operations is 10
607template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::mult(bitblock128_t arg1, bitblock128_t arg2)
608{
609        bitblock128_t loMask = simd128<(16)>::lomask();
610        bitblock128_t tmpAns1 = simd128<(16)>::mult(simd_and(loMask, arg1), simd_and(loMask, arg2));
611        bitblock128_t tmpAns2 = simd128<(16)>::mult(simd128<(16)>::srli<8>(arg1), simd128<(16)>::srli<8>(arg2));
612        return simd128<1>::ifh(loMask, tmpAns1, simd128<(16)>::slli<8>(tmpAns2));
613}
614
615//The total number of operations is 1
616template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::mult(bitblock128_t arg1, bitblock128_t arg2)
617{
618        return _mm_mullo_epi16(arg1, arg2);
619}
620
621//The total number of operations is 30
622template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::mult(bitblock128_t arg1, bitblock128_t arg2)
623{
624        bitblock128_t loMask = simd128<(64)>::lomask();
625        bitblock128_t tmpAns1 = simd128<(64)>::mult(simd_and(loMask, arg1), simd_and(loMask, arg2));
626        bitblock128_t tmpAns2 = simd128<(64)>::mult(simd128<(64)>::srli<32>(arg1), simd128<(64)>::srli<32>(arg2));
627        return simd128<1>::ifh(loMask, tmpAns1, simd128<(64)>::slli<32>(tmpAns2));
628}
629
630//The total number of operations is 11
631template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::mult(bitblock128_t arg1, bitblock128_t arg2)
632{
633        bitblock128_t loMask = simd128<64>::lomask();
634        bitblock128_t arg1_low = simd_and(arg1, loMask);
635        bitblock128_t arg1_high = simd128<64>::srli<(32)>(arg1);
636        bitblock128_t arg2_low = simd_and(arg2, loMask);
637        bitblock128_t arg2_high = simd128<64>::srli<(32)>(arg2);
638        bitblock128_t tmpAns1 = simd128<(32)>::umult(arg1_low, arg2_low);
639        bitblock128_t tmpAns2 = simd128<64>::slli<(32)>(simd128<(32)>::umult(arg1_low, arg2_high));
640        bitblock128_t tmpAns3 = simd128<64>::slli<(32)>(simd128<(32)>::umult(arg1_high, arg2_low));
641        return simd128<64>::add(tmpAns1, simd128<64>::add(tmpAns2, tmpAns3));
642}
643
644//The total number of operations is 205
645template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::mult(bitblock128_t arg1, bitblock128_t arg2)
646{
647        bitblock128_t loMask = simd128<128>::lomask();
648        bitblock128_t arg1_low = simd_and(arg1, loMask);
649        bitblock128_t arg1_high = simd128<128>::srli<(64)>(arg1);
650        bitblock128_t arg2_low = simd_and(arg2, loMask);
651        bitblock128_t arg2_high = simd128<128>::srli<(64)>(arg2);
652        bitblock128_t tmpAns1 = simd128<(64)>::umult(arg1_low, arg2_low);
653        bitblock128_t tmpAns2 = simd128<128>::slli<(64)>(simd128<(64)>::umult(arg1_low, arg2_high));
654        bitblock128_t tmpAns3 = simd128<128>::slli<(64)>(simd128<(64)>::umult(arg1_high, arg2_low));
655        return simd128<128>::add(tmpAns1, simd128<128>::add(tmpAns2, tmpAns3));
656}
657
658//The total number of operations is 43
659template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::gt(bitblock128_t arg1, bitblock128_t arg2)
660{
661        bitblock128_t high_bit = simd128<1>::constant<(1)>();
662        return simd128<1>::ugt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
663}
664
665//The total number of operations is 18
666template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::gt(bitblock128_t arg1, bitblock128_t arg2)
667{
668        bitblock128_t tmp = simd_not(arg1);
669        bitblock128_t tmpAns = simd_or(simd_and(tmp, arg2), simd_and(simd128<128>::slli<1>(simd_and(arg1, simd_not(arg2))), simd_or(tmp, arg2)));
670        return simd128<1>::ifh(simd128<2>::himask(), tmpAns, simd128<128>::srli<1>(tmpAns));
671}
672
673//The total number of operations is 10
674template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::gt(bitblock128_t arg1, bitblock128_t arg2)
675{
676        return simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::gt(simd_and(simd128<(8)>::himask(), arg1), arg2), simd128<(8)>::gt(simd128<(8)>::slli<4>(arg1), simd128<(8)>::slli<4>(arg2)));
677}
678
679//The total number of operations is 1
680template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::gt(bitblock128_t arg1, bitblock128_t arg2)
681{
682        return _mm_cmpgt_epi8(arg1, arg2);
683}
684
685//The total number of operations is 1
686template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::gt(bitblock128_t arg1, bitblock128_t arg2)
687{
688        return _mm_cmpgt_epi16(arg1, arg2);
689}
690
691//The total number of operations is 1
692template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::gt(bitblock128_t arg1, bitblock128_t arg2)
693{
694        return _mm_cmpgt_epi32(arg1, arg2);
695}
696
697//The total number of operations is 15
698template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::gt(bitblock128_t arg1, bitblock128_t arg2)
699{
700        bitblock128_t hiAns = simd128<(32)>::gt(arg1, arg2);
701        bitblock128_t loAns = simd128<(32)>::ugt(arg1, arg2);
702        bitblock128_t mask = simd_and(loAns, simd128<64>::srli<(32)>(simd128<(32)>::eq(arg1, arg2)));
703        mask = simd_or(mask, simd128<64>::slli<(32)>(mask));
704        return simd_or(simd128<64>::srai<(32)>(hiAns), mask);
705}
706
707//The total number of operations is 66
708template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::gt(bitblock128_t arg1, bitblock128_t arg2)
709{
710        bitblock128_t hiAns = simd128<(64)>::gt(arg1, arg2);
711        bitblock128_t loAns = simd128<(64)>::ugt(arg1, arg2);
712        bitblock128_t mask = simd_and(loAns, simd128<128>::srli<(64)>(simd128<(64)>::eq(arg1, arg2)));
713        mask = simd_or(mask, simd128<128>::slli<(64)>(mask));
714        return simd_or(simd128<128>::srai<(64)>(hiAns), mask);
715}
716
717//The total number of operations is 289
718template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umult(bitblock128_t arg1, bitblock128_t arg2)
719{
720        bitblock128_t loMask = simd128<(2)>::lomask();
721        bitblock128_t tmpAns1 = simd128<(2)>::umult(simd_and(loMask, arg1), simd_and(loMask, arg2));
722        bitblock128_t tmpAns2 = simd128<(2)>::umult(simd_and(loMask, simd128<(4)>::srli<(2)>(arg1)), simd_and(loMask, simd128<(4)>::srli<(2)>(arg2)));
723        return simd_or(tmpAns1, simd128<(4)>::slli<(2)>(tmpAns2));
724}
725
726//The total number of operations is 139
727template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umult(bitblock128_t arg1, bitblock128_t arg2)
728{
729        bitblock128_t loMask = simd128<(4)>::lomask();
730        bitblock128_t tmpAns1 = simd128<(4)>::umult(simd_and(loMask, arg1), simd_and(loMask, arg2));
731        bitblock128_t tmpAns2 = simd128<(4)>::umult(simd_and(loMask, simd128<(8)>::srli<(4)>(arg1)), simd_and(loMask, simd128<(8)>::srli<(4)>(arg2)));
732        return simd_or(tmpAns1, simd128<(8)>::slli<(4)>(tmpAns2));
733}
734
735//The total number of operations is 64
736template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umult(bitblock128_t arg1, bitblock128_t arg2)
737{
738        bitblock128_t loMask = simd128<(8)>::lomask();
739        bitblock128_t tmpAns1 = simd128<(8)>::umult(simd_and(loMask, arg1), simd_and(loMask, arg2));
740        bitblock128_t tmpAns2 = simd128<(8)>::umult(simd_and(loMask, simd128<(16)>::srli<(8)>(arg1)), simd_and(loMask, simd128<(16)>::srli<(8)>(arg2)));
741        return simd_or(tmpAns1, simd128<(16)>::slli<(8)>(tmpAns2));
742}
743
744//The total number of operations is 28
745template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umult(bitblock128_t arg1, bitblock128_t arg2)
746{
747        bitblock128_t loMask = simd128<(16)>::lomask();
748        bitblock128_t tmpAns1 = simd128<(16)>::umult(simd_and(loMask, arg1), simd_and(loMask, arg2));
749        bitblock128_t tmpAns2 = simd128<(16)>::umult(simd_and(loMask, simd128<(32)>::srli<(16)>(arg1)), simd_and(loMask, simd128<(32)>::srli<(16)>(arg2)));
750        return simd_or(tmpAns1, simd128<(32)>::slli<(16)>(tmpAns2));
751}
752
753//The total number of operations is 10
754template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umult(bitblock128_t arg1, bitblock128_t arg2)
755{
756        bitblock128_t loMask = simd128<(32)>::lomask();
757        bitblock128_t tmpAns1 = simd128<(32)>::umult(simd_and(loMask, arg1), simd_and(loMask, arg2));
758        bitblock128_t tmpAns2 = simd128<(32)>::umult(simd_and(loMask, simd128<(64)>::srli<(32)>(arg1)), simd_and(loMask, simd128<(64)>::srli<(32)>(arg2)));
759        return simd_or(tmpAns1, simd128<(64)>::slli<(32)>(tmpAns2));
760}
761
762//The total number of operations is 1
763template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umult(bitblock128_t arg1, bitblock128_t arg2)
764{
765        return _mm_mul_epu32(arg1, arg2);
766}
767
768//The total number of operations is 55
769template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umult(bitblock128_t arg1, bitblock128_t arg2)
770{
771        bitblock128_t loMask1 = simd128<(128)>::lomask();
772        bitblock128_t arg11 = simd_and(arg1, loMask1);
773        bitblock128_t arg22 = simd_and(arg2, loMask1);
774        bitblock128_t loMask2 = simd128<64>::lomask();
775        bitblock128_t arg1_low = simd_and(arg11, loMask2);
776        bitblock128_t arg1_high = simd128<64>::srli<(32)>(arg11);
777        bitblock128_t arg2_low = simd_and(arg22, loMask2);
778        bitblock128_t arg2_high = simd128<64>::srli<(32)>(arg22);
779        bitblock128_t tmpAns1 = simd128<(32)>::umult(arg1_low, arg2_low);
780        bitblock128_t tmpAns2 = simd128<(128)>::slli<(32)>(simd128<(32)>::umult(arg1_low, arg2_high));
781        bitblock128_t tmpAns3 = simd128<(128)>::slli<(32)>(simd128<(32)>::umult(arg1_high, arg2_low));
782        bitblock128_t tmpAns4 = simd128<(128)>::slli<64>(simd128<(32)>::umult(arg1_high, arg2_high));
783        return simd128<(128)>::add(tmpAns1, simd128<(128)>::add(tmpAns2, simd128<(128)>::add(tmpAns3, tmpAns4)));
784}
785
786//The total number of operations is 41
787template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ult(bitblock128_t arg1, bitblock128_t arg2)
788{
789        return simd_or(simd_and(simd128<(2)>::himask(), simd128<(2)>::ult(simd_and(simd128<(2)>::himask(), arg1), simd_and(simd128<(2)>::himask(), arg2))), simd_and(simd128<(2)>::lomask(), simd128<(2)>::ult(simd_and(simd128<(2)>::lomask(), arg1), simd_and(simd128<(2)>::lomask(), arg2))));
790}
791
792//The total number of operations is 17
793template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ult(bitblock128_t arg1, bitblock128_t arg2)
794{
795        bitblock128_t tmp = simd_not(arg1);
796        bitblock128_t tmpAns = simd_or(simd_and(tmp, arg2), simd_and(simd128<128>::slli<1>(simd_and(tmp, arg2)), simd_or(tmp, arg2)));
797        return simd128<1>::ifh(simd128<2>::himask(), tmpAns, simd128<128>::srli<1>(tmpAns));
798}
799
800//The total number of operations is 20
801template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ult(bitblock128_t arg1, bitblock128_t arg2)
802{
803        bitblock128_t high_bit = simd128<4>::constant<(8)>();
804        return simd128<4>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
805}
806
807//The total number of operations is 7
808template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ult(bitblock128_t arg1, bitblock128_t arg2)
809{
810        bitblock128_t high_bit = simd128<8>::constant<(128)>();
811        return simd128<8>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
812}
813
814//The total number of operations is 7
815template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ult(bitblock128_t arg1, bitblock128_t arg2)
816{
817        bitblock128_t high_bit = simd128<16>::constant<(32768)>();
818        return simd128<16>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
819}
820
821//The total number of operations is 7
822template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ult(bitblock128_t arg1, bitblock128_t arg2)
823{
824        bitblock128_t high_bit = simd128<32>::constant<(2147483648UL)>();
825        return simd128<32>::lt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
826}
827
828//The total number of operations is 18
829template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ult(bitblock128_t arg1, bitblock128_t arg2)
830{
831        bitblock128_t tmpAns = simd128<(32)>::ult(arg1, arg2);
832        bitblock128_t mask = simd_and(tmpAns, simd128<64>::srli<(32)>(simd128<(32)>::eq(arg1, arg2)));
833        mask = simd_or(mask, simd128<64>::slli<(32)>(mask));
834        return simd_or(simd128<64>::srai<(32)>(tmpAns), mask);
835}
836
837//The total number of operations is 55
838template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ult(bitblock128_t arg1, bitblock128_t arg2)
839{
840        return simd_and(simd128<128>::srai<(127)>(simd_or(simd_and(simd_not(arg1), arg2), simd_and(simd_not(simd_xor(arg1, arg2)), simd128<128>::sub(arg1, arg2)))), simd_not(simd128<128>::eq(arg1, arg2)));
841}
842
843//The total number of operations is 43
844template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::lt(bitblock128_t arg1, bitblock128_t arg2)
845{
846        bitblock128_t high_bit = simd128<1>::constant<(1)>();
847        return simd128<1>::ult(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
848}
849
850//The total number of operations is 18
851template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::lt(bitblock128_t arg1, bitblock128_t arg2)
852{
853        bitblock128_t tmp = simd_not(arg2);
854        bitblock128_t tmpAns = simd_or(simd_and(arg1, tmp), simd_and(simd128<128>::slli<1>(simd_and(simd_not(arg1), arg2)), simd_or(arg1, tmp)));
855        return simd128<1>::ifh(simd128<2>::himask(), tmpAns, simd128<128>::srli<1>(tmpAns));
856}
857
858//The total number of operations is 18
859template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::lt(bitblock128_t arg1, bitblock128_t arg2)
860{
861        return simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::lt(arg1, simd_and(simd128<(8)>::himask(), arg2)), simd128<(8)>::lt(simd128<(8)>::slli<4>(arg1), simd128<(8)>::slli<4>(arg2)));
862}
863
864//The total number of operations is 5
865template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::lt(bitblock128_t arg1, bitblock128_t arg2)
866{
867        return simd_and(simd_not(simd128<8>::gt(arg1, arg2)), simd_not(simd128<8>::eq(arg1, arg2)));
868}
869
870//The total number of operations is 5
871template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::lt(bitblock128_t arg1, bitblock128_t arg2)
872{
873        return simd_and(simd_not(simd128<16>::gt(arg1, arg2)), simd_not(simd128<16>::eq(arg1, arg2)));
874}
875
876//The total number of operations is 5
877template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::lt(bitblock128_t arg1, bitblock128_t arg2)
878{
879        return simd_and(simd_not(simd128<32>::gt(arg1, arg2)), simd_not(simd128<32>::eq(arg1, arg2)));
880}
881
882//The total number of operations is 20
883template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::lt(bitblock128_t arg1, bitblock128_t arg2)
884{
885        bitblock128_t high_bit = simd128<64>::constant<(9223372036854775808UL)>();
886        return simd128<64>::ult(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
887}
888
889//The total number of operations is 75
890template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::lt(bitblock128_t arg1, bitblock128_t arg2)
891{
892        bitblock128_t hiAns = simd128<(64)>::lt(arg1, arg2);
893        bitblock128_t loAns = simd128<(64)>::ult(arg1, arg2);
894        bitblock128_t mask = simd_and(loAns, simd128<128>::srli<(64)>(simd128<(64)>::eq(arg1, arg2)));
895        mask = simd_or(mask, simd128<128>::slli<(64)>(mask));
896        return simd_or(simd128<128>::srai<(64)>(hiAns), mask);
897}
898
899//The total number of operations is 2
900template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::srli(bitblock128_t arg1)
901{
902        return simd_and(simd128<32>::srli<sh>(arg1), simd128<2>::constant<((3)>>sh)>());
903}
904
905//The total number of operations is 2
906template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::srli(bitblock128_t arg1)
907{
908        return simd_and(simd128<32>::srli<sh>(arg1), simd128<4>::constant<((15)>>sh)>());
909}
910
911//The total number of operations is 2
912template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::srli(bitblock128_t arg1)
913{
914        return simd_and(simd128<32>::srli<sh>(arg1), simd128<8>::constant<((255)>>sh)>());
915}
916
917//The total number of operations is 1
918template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::srli(bitblock128_t arg1)
919{
920        return _mm_srli_epi16(arg1, (int32_t)(sh));
921}
922
923//The total number of operations is 1
924template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::srli(bitblock128_t arg1)
925{
926        return _mm_srli_epi32(arg1, (int32_t)(sh));
927}
928
929//The total number of operations is 1
930template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srli(bitblock128_t arg1)
931{
932        return _mm_srli_epi64(arg1, (int32_t)(sh));
933}
934
935//The total number of operations is 4
936template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srli(bitblock128_t arg1)
937{
938        return (((sh%8) == 0) ? _mm_srli_si128(arg1, (int32_t)((sh/8))) : ((sh >= 64) ? simd128<64>::srli<(sh-64)>(_mm_srli_si128(arg1, (int32_t)(8))) : simd_or(simd128<64>::srli<sh>(arg1), _mm_srli_si128(simd128<64>::slli<(64-sh)>(arg1), (int32_t)(8)))));
939}
940
941//The total number of operations is 1
942template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ctz(bitblock128_t arg1)
943{
944        return simd_not(arg1);
945}
946
947//The total number of operations is 14
948template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ctz(bitblock128_t arg1)
949{
950        bitblock128_t tmp = simd_not(arg1);
951        return simd128<1>::ifh(simd128<2>::himask(), simd_and(tmp, simd128<128>::slli<1>(tmp)), simd_and(simd128<128>::srli<1>(arg1), tmp));
952}
953
954//The total number of operations is 14
955template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ctz(bitblock128_t arg1)
956{
957        return simd128<4>::popcount(simd_andc(simd128<4>::sub(arg1, simd128<4>::constant<1>()), arg1));
958}
959
960//The total number of operations is 13
961template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ctz(bitblock128_t arg1)
962{
963        return simd128<8>::popcount(simd_andc(simd128<8>::sub(arg1, simd128<8>::constant<1>()), arg1));
964}
965
966//The total number of operations is 16
967template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ctz(bitblock128_t arg1)
968{
969        return simd128<16>::popcount(simd_andc(simd128<16>::sub(arg1, simd128<16>::constant<1>()), arg1));
970}
971
972//The total number of operations is 19
973template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ctz(bitblock128_t arg1)
974{
975        return simd128<32>::popcount(simd_andc(simd128<32>::sub(arg1, simd128<32>::constant<1>()), arg1));
976}
977
978//The total number of operations is 14
979template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ctz(bitblock128_t arg1)
980{
981        return simd128<64>::popcount(simd_andc(simd128<64>::sub(arg1, simd128<64>::constant<1>()), arg1));
982}
983
984//The total number of operations is 30
985template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ctz(bitblock128_t arg1)
986{
987        return simd128<128>::popcount(simd_andc(simd128<128>::sub(arg1, simd128<128>::constant<1>()), arg1));
988}
989
990//The total number of operations is 7
991template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
992{
993        return simd128<1>::ifh(simd128<128>::himask(), _mm_sll_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_sll_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
994}
995
996//The total number of operations is 11
997template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::sll(bitblock128_t arg1, bitblock128_t shift_mask)
998{
999        return simd_or(_mm_sll_epi64(arg1, shift_mask), simd_or(_mm_slli_si128(_mm_sll_epi64(arg1, simd128<32>::sub(shift_mask, _mm_cvtsi32_si128((int32_t)(64)))), (int32_t)(8)), _mm_slli_si128(_mm_srl_epi64(arg1, simd128<32>::sub(_mm_cvtsi32_si128((int32_t)(64)), shift_mask)), (int32_t)(8))));
1000}
1001
1002//The total number of operations is 41
1003template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1004{
1005        return simd_or(simd_and(simd128<(2)>::himask(), simd128<(2)>::ugt(simd_and(simd128<(2)>::himask(), arg1), simd_and(simd128<(2)>::himask(), arg2))), simd_and(simd128<(2)>::lomask(), simd128<(2)>::ugt(simd_and(simd128<(2)>::lomask(), arg1), simd_and(simd128<(2)>::lomask(), arg2))));
1006}
1007
1008//The total number of operations is 17
1009template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1010{
1011        bitblock128_t tmp = simd_not(arg2);
1012        bitblock128_t tmpAns = simd_or(simd_and(arg1, tmp), simd_and(simd128<128>::slli<1>(simd_and(arg1, tmp)), simd_or(arg1, tmp)));
1013        return simd128<1>::ifh(simd128<2>::himask(), tmpAns, simd128<128>::srli<1>(tmpAns));
1014}
1015
1016//The total number of operations is 12
1017template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1018{
1019        bitblock128_t high_bit = simd128<4>::constant<(8)>();
1020        return simd128<4>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
1021}
1022
1023//The total number of operations is 3
1024template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1025{
1026        bitblock128_t high_bit = simd128<8>::constant<(128)>();
1027        return simd128<8>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
1028}
1029
1030//The total number of operations is 3
1031template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1032{
1033        bitblock128_t high_bit = simd128<16>::constant<(32768)>();
1034        return simd128<16>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
1035}
1036
1037//The total number of operations is 3
1038template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1039{
1040        bitblock128_t high_bit = simd128<32>::constant<(2147483648UL)>();
1041        return simd128<32>::gt(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit));
1042}
1043
1044//The total number of operations is 14
1045template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1046{
1047        bitblock128_t tmpAns = simd128<(32)>::ugt(arg1, arg2);
1048        bitblock128_t mask = simd_and(tmpAns, simd128<64>::srli<(32)>(simd128<(32)>::eq(arg1, arg2)));
1049        mask = simd_or(mask, simd128<64>::slli<(32)>(mask));
1050        return simd_or(simd128<64>::srai<(32)>(tmpAns), mask);
1051}
1052
1053//The total number of operations is 51
1054template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ugt(bitblock128_t arg1, bitblock128_t arg2)
1055{
1056        bitblock128_t tmpAns = simd128<(64)>::ugt(arg1, arg2);
1057        bitblock128_t mask = simd_and(tmpAns, simd128<128>::srli<(64)>(simd128<(64)>::eq(arg1, arg2)));
1058        mask = simd_or(mask, simd128<128>::slli<(64)>(mask));
1059        return simd_or(simd128<128>::srai<(64)>(tmpAns), mask);
1060}
1061
1062//The total number of operations is 4
1063template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::xor_hl(bitblock128_t arg1)
1064{
1065        return simd_xor(simd128<2>::srli<(1)>(arg1), simd_and(arg1, simd128<2>::lomask()));
1066}
1067
1068//The total number of operations is 4
1069template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::xor_hl(bitblock128_t arg1)
1070{
1071        return simd_xor(simd128<4>::srli<(2)>(arg1), simd_and(arg1, simd128<4>::lomask()));
1072}
1073
1074//The total number of operations is 4
1075template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::xor_hl(bitblock128_t arg1)
1076{
1077        return simd_xor(simd128<8>::srli<(4)>(arg1), simd_and(arg1, simd128<8>::lomask()));
1078}
1079
1080//The total number of operations is 3
1081template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::xor_hl(bitblock128_t arg1)
1082{
1083        return simd_xor(simd128<16>::srli<(8)>(arg1), simd_and(arg1, simd128<16>::lomask()));
1084}
1085
1086//The total number of operations is 3
1087template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::xor_hl(bitblock128_t arg1)
1088{
1089        return simd_xor(simd128<32>::srli<(16)>(arg1), simd_and(arg1, simd128<32>::lomask()));
1090}
1091
1092//The total number of operations is 3
1093template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::xor_hl(bitblock128_t arg1)
1094{
1095        return simd_xor(simd128<64>::srli<(32)>(arg1), simd_and(arg1, simd128<64>::lomask()));
1096}
1097
1098//The total number of operations is 6
1099template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::xor_hl(bitblock128_t arg1)
1100{
1101        return simd_xor(simd128<128>::srli<(64)>(arg1), simd_and(arg1, simd128<128>::lomask()));
1102}
1103
1104//The total number of operations is 0
1105template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::popcount(bitblock128_t arg1)
1106{
1107        return arg1;
1108}
1109
1110//The total number of operations is 3
1111template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::popcount(bitblock128_t arg1)
1112{
1113        return simd128<2>::add_hl(simd128<(1)>::popcount(arg1));
1114}
1115
1116//The total number of operations is 7
1117template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::popcount(bitblock128_t arg1)
1118{
1119        return simd128<4>::add_hl(simd128<(2)>::popcount(arg1));
1120}
1121
1122//The total number of operations is 11
1123template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::popcount(bitblock128_t arg1)
1124{
1125        return simd128<8>::add_hl(simd128<(4)>::popcount(arg1));
1126}
1127
1128//The total number of operations is 14
1129template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::popcount(bitblock128_t arg1)
1130{
1131        return simd128<16>::add_hl(simd128<(8)>::popcount(arg1));
1132}
1133
1134//The total number of operations is 17
1135template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::popcount(bitblock128_t arg1)
1136{
1137        return simd128<32>::add_hl(simd128<(16)>::popcount(arg1));
1138}
1139
1140//The total number of operations is 12
1141template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::popcount(bitblock128_t arg1)
1142{
1143        return _mm_sad_epu8(simd128<8>::popcount(arg1), simd128<8>::constant<0>());
1144}
1145
1146//The total number of operations is 18
1147template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::popcount(bitblock128_t arg1)
1148{
1149        bitblock128_t tmpAns = simd128<(64)>::popcount(arg1);
1150        return simd128<(64)>::add(simd_and(tmpAns, simd128<128>::lomask()), simd128<128>::srli<(64)>(tmpAns));
1151}
1152
1153//The total number of operations is 26
1154template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::neg(bitblock128_t arg1)
1155{
1156        return simd128<1>::sub(simd128<1>::constant<0>(), arg1);
1157}
1158
1159//The total number of operations is 8
1160template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::neg(bitblock128_t arg1)
1161{
1162        return simd128<1>::ifh(simd128<2>::himask(), simd_xor(arg1, simd128<128>::slli<1>(arg1)), arg1);
1163}
1164
1165//The total number of operations is 6
1166template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::neg(bitblock128_t arg1)
1167{
1168        return simd128<4>::sub(simd128<4>::constant<0>(), arg1);
1169}
1170
1171//The total number of operations is 1
1172template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::neg(bitblock128_t arg1)
1173{
1174        return simd128<8>::sub(simd128<8>::constant<0>(), arg1);
1175}
1176
1177//The total number of operations is 1
1178template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::neg(bitblock128_t arg1)
1179{
1180        return simd128<16>::sub(simd128<16>::constant<0>(), arg1);
1181}
1182
1183//The total number of operations is 1
1184template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::neg(bitblock128_t arg1)
1185{
1186        return simd128<32>::sub(simd128<32>::constant<0>(), arg1);
1187}
1188
1189//The total number of operations is 1
1190template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::neg(bitblock128_t arg1)
1191{
1192        return simd128<64>::sub(simd128<64>::constant<0>(), arg1);
1193}
1194
1195//The total number of operations is 11
1196template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::neg(bitblock128_t arg1)
1197{
1198        return simd128<128>::sub(simd128<128>::constant<0>(), arg1);
1199}
1200
1201//The total number of operations is 2
1202template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::slli(bitblock128_t arg1)
1203{
1204        return simd_and(simd128<32>::slli<sh>(arg1), simd128<2>::constant<(((3)<<sh)&(3))>());
1205}
1206
1207//The total number of operations is 2
1208template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::slli(bitblock128_t arg1)
1209{
1210        return simd_and(simd128<32>::slli<sh>(arg1), simd128<4>::constant<(((15)<<sh)&(15))>());
1211}
1212
1213//The total number of operations is 2
1214template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::slli(bitblock128_t arg1)
1215{
1216        return simd_and(simd128<32>::slli<sh>(arg1), simd128<8>::constant<(((255)<<sh)&(255))>());
1217}
1218
1219//The total number of operations is 1
1220template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::slli(bitblock128_t arg1)
1221{
1222        return _mm_slli_epi16(arg1, (int32_t)(sh));
1223}
1224
1225//The total number of operations is 1
1226template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::slli(bitblock128_t arg1)
1227{
1228        return _mm_slli_epi32(arg1, (int32_t)(sh));
1229}
1230
1231//The total number of operations is 1
1232template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::slli(bitblock128_t arg1)
1233{
1234        return _mm_slli_epi64(arg1, (int32_t)(sh));
1235}
1236
1237//The total number of operations is 4
1238template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::slli(bitblock128_t arg1)
1239{
1240        return (((sh%8) == 0) ? _mm_slli_si128(arg1, (int32_t)((sh/8))) : ((sh >= 64) ? simd128<64>::slli<(sh-64)>(_mm_slli_si128(arg1, (int32_t)(8))) : simd_or(simd128<64>::slli<sh>(arg1), _mm_slli_si128(simd128<64>::srli<(64-sh)>(arg1), (int32_t)(8)))));
1241}
1242
1243//The total number of operations is 3
1244template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1245{
1246        return simd_or(simd_and(arg2, arg1), simd_andc(arg3, arg1));
1247}
1248
1249//The total number of operations is 8
1250template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1251{
1252        return simd128<(1)>::ifh(simd128<1>::ifh(simd128<2>::himask(), arg1, simd128<2>::srli<(1)>(arg1)), arg2, arg3);
1253}
1254
1255//The total number of operations is 13
1256template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1257{
1258        return simd128<1>::ifh(simd128<4>::gt(simd128<4>::constant<0>(), arg1), arg2, arg3);
1259}
1260
1261//The total number of operations is 4
1262template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1263{
1264        return simd128<1>::ifh(simd128<8>::gt(simd128<8>::constant<0>(), arg1), arg2, arg3);
1265}
1266
1267//The total number of operations is 4
1268template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1269{
1270        return simd128<1>::ifh(simd128<16>::gt(simd128<16>::constant<0>(), arg1), arg2, arg3);
1271}
1272
1273//The total number of operations is 4
1274template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1275{
1276        return simd128<1>::ifh(simd128<32>::gt(simd128<32>::constant<0>(), arg1), arg2, arg3);
1277}
1278
1279//The total number of operations is 8
1280template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1281{
1282        return simd128<(32)>::ifh(simd128<1>::ifh(simd128<64>::himask(), arg1, simd128<64>::srli<(32)>(arg1)), arg2, arg3);
1283}
1284
1285//The total number of operations is 15
1286template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::ifh(bitblock128_t arg1, bitblock128_t arg2, bitblock128_t arg3)
1287{
1288        return simd128<(64)>::ifh(simd128<1>::ifh(simd128<128>::himask(), arg1, simd128<128>::srli<(64)>(arg1)), arg2, arg3);
1289}
1290
1291//The total number of operations is 26
1292template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::sub(bitblock128_t arg1, bitblock128_t arg2)
1293{
1294        return simd128<1>::ifh(simd128<(2)>::himask(), simd128<(2)>::sub(arg1, simd_and(simd128<(2)>::himask(), arg2)), simd128<(2)>::sub(arg1, arg2));
1295}
1296
1297//The total number of operations is 11
1298template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::sub(bitblock128_t arg1, bitblock128_t arg2)
1299{
1300        bitblock128_t tmp = simd_xor(arg1, arg2);
1301        return simd128<1>::ifh(simd128<2>::himask(), simd_xor(tmp, simd128<128>::slli<1>(simd_and(simd_not(arg1), arg2))), tmp);
1302}
1303
1304//The total number of operations is 6
1305template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::sub(bitblock128_t arg1, bitblock128_t arg2)
1306{
1307        return simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::sub(arg1, simd_and(simd128<(8)>::himask(), arg2)), simd128<(8)>::sub(arg1, arg2));
1308}
1309
1310//The total number of operations is 1
1311template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::sub(bitblock128_t arg1, bitblock128_t arg2)
1312{
1313        return _mm_sub_epi8(arg1, arg2);
1314}
1315
1316//The total number of operations is 1
1317template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::sub(bitblock128_t arg1, bitblock128_t arg2)
1318{
1319        return _mm_sub_epi16(arg1, arg2);
1320}
1321
1322//The total number of operations is 1
1323template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::sub(bitblock128_t arg1, bitblock128_t arg2)
1324{
1325        return _mm_sub_epi32(arg1, arg2);
1326}
1327
1328//The total number of operations is 1
1329template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::sub(bitblock128_t arg1, bitblock128_t arg2)
1330{
1331        return _mm_sub_epi64(arg1, arg2);
1332}
1333
1334//The total number of operations is 11
1335template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::sub(bitblock128_t arg1, bitblock128_t arg2)
1336{
1337        bitblock128_t partial = simd128<(64)>::sub(arg1, arg2);
1338        bitblock128_t borrowMask = simd_or(simd_andc(arg2, arg1), simd_andc(partial, simd_xor(arg1, arg2)));
1339        bitblock128_t borrow = simd128<128>::slli<(64)>(simd128<(64)>::srli<(63)>(borrowMask));
1340        return simd128<(64)>::sub(partial, borrow);
1341}
1342
1343//The total number of operations is 3
1344template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::add_hl(bitblock128_t arg1)
1345{
1346        return simd128<16>::sub(arg1, simd_and(simd128<2>::lomask(), simd128<16>::srli<1>(arg1)));
1347}
1348
1349//The total number of operations is 4
1350template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::add_hl(bitblock128_t arg1)
1351{
1352        return simd128<(8)>::add(simd128<4>::srli<(2)>(arg1), simd_and(arg1, simd128<4>::lomask()));
1353}
1354
1355//The total number of operations is 4
1356template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::add_hl(bitblock128_t arg1)
1357{
1358        return simd128<(16)>::add(simd128<8>::srli<(4)>(arg1), simd_and(arg1, simd128<8>::lomask()));
1359}
1360
1361//The total number of operations is 3
1362template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::add_hl(bitblock128_t arg1)
1363{
1364        return simd128<(32)>::add(simd128<16>::srli<(8)>(arg1), simd_and(arg1, simd128<16>::lomask()));
1365}
1366
1367//The total number of operations is 3
1368template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::add_hl(bitblock128_t arg1)
1369{
1370        return simd128<(64)>::add(simd128<32>::srli<(16)>(arg1), simd_and(arg1, simd128<32>::lomask()));
1371}
1372
1373//The total number of operations is 3
1374template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::add_hl(bitblock128_t arg1)
1375{
1376        return simd128<64>::add(simd128<64>::srli<(32)>(arg1), simd_and(arg1, simd128<64>::lomask()));
1377}
1378
1379//The total number of operations is 16
1380template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::add_hl(bitblock128_t arg1)
1381{
1382        return simd128<128>::add(simd128<128>::srli<(64)>(arg1), simd_and(arg1, simd128<128>::lomask()));
1383}
1384
1385//The total number of operations is 7
1386template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
1387{
1388        return simd128<1>::ifh(simd128<128>::himask(), _mm_srl_epi64(arg1, _mm_srli_si128(shift_mask, (int32_t)(8))), _mm_srl_epi64(arg1, simd_andc(shift_mask, simd128<128>::himask())));
1389}
1390
1391//The total number of operations is 11
1392template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srl(bitblock128_t arg1, bitblock128_t shift_mask)
1393{
1394        return simd_or(_mm_srl_epi64(arg1, shift_mask), simd_or(_mm_srli_si128(_mm_srl_epi64(arg1, simd128<32>::sub(shift_mask, _mm_cvtsi32_si128((int32_t)(64)))), (int32_t)(8)), _mm_srli_si128(_mm_sll_epi64(arg1, simd128<32>::sub(_mm_cvtsi32_si128((int32_t)(64)), shift_mask)), (int32_t)(8))));
1395}
1396
1397//The total number of operations is 0
1398template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::lomask()
1399{
1400        return simd128<2>::constant<(1)>();
1401}
1402
1403//The total number of operations is 0
1404template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::lomask()
1405{
1406        return simd128<4>::constant<(3)>();
1407}
1408
1409//The total number of operations is 0
1410template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::lomask()
1411{
1412        return simd128<8>::constant<(15)>();
1413}
1414
1415//The total number of operations is 0
1416template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::lomask()
1417{
1418        return simd128<16>::constant<(255)>();
1419}
1420
1421//The total number of operations is 0
1422template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::lomask()
1423{
1424        return simd128<32>::constant<(65535)>();
1425}
1426
1427//The total number of operations is 0
1428template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::lomask()
1429{
1430        return _mm_set_epi32((int32_t)(0), (int32_t)(-1), (int32_t)(0), (int32_t)(-1));
1431}
1432
1433//The total number of operations is 0
1434template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::lomask()
1435{
1436        return _mm_set_epi32((int32_t)(0), (int32_t)(0), (int32_t)(-1), (int32_t)(-1));
1437}
1438
1439//The total number of operations is 0
1440template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::constant()
1441{
1442        return simd128<32>::constant<(-1*val)>();
1443}
1444
1445//The total number of operations is 0
1446template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::constant()
1447{
1448        return ((val < 0) ? simd128<(4)>::constant<((val<<2)|(val^(-4)))>() : simd128<(4)>::constant<((val<<2)|val)>());
1449}
1450
1451//The total number of operations is 0
1452template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::constant()
1453{
1454        return ((val < 0) ? simd128<(8)>::constant<((val<<4)|(val^(-16)))>() : simd128<(8)>::constant<((val<<4)|val)>());
1455}
1456
1457//The total number of operations is 0
1458template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::constant()
1459{
1460        return _mm_set1_epi8((int32_t)(val));
1461}
1462
1463//The total number of operations is 0
1464template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::constant()
1465{
1466        return _mm_set1_epi16((int32_t)(val));
1467}
1468
1469//The total number of operations is 0
1470template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::constant()
1471{
1472        return _mm_set1_epi32((int32_t)(val));
1473}
1474
1475//The total number of operations is 0
1476template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::constant()
1477{
1478        return _mm_set_epi32((int32_t)((val>>32)), (int32_t)(val), (int32_t)((val>>32)), (int32_t)(val));
1479}
1480
1481//The total number of operations is 0
1482template <> template <uint64_t val> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::constant()
1483{
1484        return _mm_set_epi32((int32_t)(0), (int32_t)(0), (int32_t)((val>>32)), (int32_t)(val));
1485}
1486
1487//The total number of operations is 39
1488template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::min(bitblock128_t arg1, bitblock128_t arg2)
1489{
1490        bitblock128_t high_bit = simd128<1>::constant<(1)>();
1491        return simd_xor(simd128<1>::umin(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1492}
1493
1494//The total number of operations is 19
1495template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::min(bitblock128_t arg1, bitblock128_t arg2)
1496{
1497        bitblock128_t high_bit = simd128<2>::constant<(2)>();
1498        return simd_xor(simd128<2>::umin(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1499}
1500
1501//The total number of operations is 9
1502template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::min(bitblock128_t arg1, bitblock128_t arg2)
1503{
1504        bitblock128_t high_bit = simd128<4>::constant<(8)>();
1505        return simd_xor(simd128<4>::umin(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1506}
1507
1508//The total number of operations is 4
1509template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::min(bitblock128_t arg1, bitblock128_t arg2)
1510{
1511        return simd128<1>::ifh(simd128<8>::gt(arg1, arg2), arg2, arg1);
1512}
1513
1514//The total number of operations is 1
1515template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::min(bitblock128_t arg1, bitblock128_t arg2)
1516{
1517        return _mm_min_epi16(arg1, arg2);
1518}
1519
1520//The total number of operations is 4
1521template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::min(bitblock128_t arg1, bitblock128_t arg2)
1522{
1523        return simd128<1>::ifh(simd128<32>::gt(arg1, arg2), arg2, arg1);
1524}
1525
1526//The total number of operations is 18
1527template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::min(bitblock128_t arg1, bitblock128_t arg2)
1528{
1529        return simd128<1>::ifh(simd128<64>::gt(arg1, arg2), arg2, arg1);
1530}
1531
1532//The total number of operations is 65
1533template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::min(bitblock128_t arg1, bitblock128_t arg2)
1534{
1535        bitblock128_t hiAns = simd128<(64)>::min(arg1, arg2);
1536        bitblock128_t loAns = simd128<(64)>::umin(arg1, arg2);
1537        bitblock128_t eqMask1 = simd128<128>::srli<(64)>(simd128<(64)>::eq(hiAns, arg1));
1538        bitblock128_t eqMask2 = simd128<128>::srli<(64)>(simd128<(64)>::eq(hiAns, arg2));
1539        return simd128<1>::ifh(simd128<128>::himask(), hiAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, loAns, arg1), arg2));
1540}
1541
1542//The total number of operations is 36
1543template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umin(bitblock128_t arg1, bitblock128_t arg2)
1544{
1545        return simd_or(simd_and(simd128<(2)>::himask(), simd128<(2)>::umin(arg1, arg2)), simd128<(2)>::umin(simd_and(simd128<(2)>::lomask(), arg1), simd_and(simd128<(2)>::lomask(), arg2)));
1546}
1547
1548//The total number of operations is 16
1549template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umin(bitblock128_t arg1, bitblock128_t arg2)
1550{
1551        return simd_or(simd_and(simd128<(4)>::himask(), simd128<(4)>::umin(arg1, arg2)), simd128<(4)>::umin(simd_and(simd128<(4)>::lomask(), arg1), simd_and(simd128<(4)>::lomask(), arg2)));
1552}
1553
1554//The total number of operations is 6
1555template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umin(bitblock128_t arg1, bitblock128_t arg2)
1556{
1557        return simd_or(simd_and(simd128<(8)>::himask(), simd128<(8)>::umin(arg1, arg2)), simd128<(8)>::umin(simd_and(simd128<(8)>::lomask(), arg1), simd_and(simd128<(8)>::lomask(), arg2)));
1558}
1559
1560//The total number of operations is 1
1561template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umin(bitblock128_t arg1, bitblock128_t arg2)
1562{
1563        return _mm_min_epu8(arg1, arg2);
1564}
1565
1566//The total number of operations is 4
1567template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umin(bitblock128_t arg1, bitblock128_t arg2)
1568{
1569        bitblock128_t high_bit = simd128<16>::constant<(32768)>();
1570        return simd_xor(simd128<16>::min(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1571}
1572
1573//The total number of operations is 7
1574template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umin(bitblock128_t arg1, bitblock128_t arg2)
1575{
1576        bitblock128_t high_bit = simd128<32>::constant<(2147483648UL)>();
1577        return simd_xor(simd128<32>::min(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1578}
1579
1580//The total number of operations is 20
1581template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umin(bitblock128_t arg1, bitblock128_t arg2)
1582{
1583        bitblock128_t tmpAns = simd128<(32)>::umin(arg1, arg2);
1584        bitblock128_t eqMask1 = simd128<64>::srli<(32)>(simd128<(32)>::eq(tmpAns, arg1));
1585        bitblock128_t eqMask2 = simd128<64>::srli<(32)>(simd128<(32)>::eq(tmpAns, arg2));
1586        return simd128<1>::ifh(simd128<64>::himask(), tmpAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, tmpAns, arg1), arg2));
1587}
1588
1589//The total number of operations is 47
1590template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::umin(bitblock128_t arg1, bitblock128_t arg2)
1591{
1592        bitblock128_t tmpAns = simd128<(64)>::umin(arg1, arg2);
1593        bitblock128_t eqMask1 = simd128<128>::srli<(64)>(simd128<(64)>::eq(tmpAns, arg1));
1594        bitblock128_t eqMask2 = simd128<128>::srli<(64)>(simd128<(64)>::eq(tmpAns, arg2));
1595        return simd128<1>::ifh(simd128<128>::himask(), tmpAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, tmpAns, arg1), arg2));
1596}
1597
1598//The total number of operations is 36
1599template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::umax(bitblock128_t arg1, bitblock128_t arg2)
1600{
1601        return simd_or(simd_and(simd128<(2)>::himask(), simd128<(2)>::umax(arg1, arg2)), simd128<(2)>::umax(simd_and(simd128<(2)>::lomask(), arg1), simd_and(simd128<(2)>::lomask(), arg2)));
1602}
1603
1604//The total number of operations is 16
1605template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::umax(bitblock128_t arg1, bitblock128_t arg2)
1606{
1607        return simd_or(simd_and(simd128<(4)>::himask(), simd128<(4)>::umax(arg1, arg2)), simd128<(4)>::umax(simd_and(simd128<(4)>::lomask(), arg1), simd_and(simd128<(4)>::lomask(), arg2)));
1608}
1609
1610//The total number of operations is 6
1611template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::umax(bitblock128_t arg1, bitblock128_t arg2)
1612{
1613        return simd_or(simd_and(simd128<(8)>::himask(), simd128<(8)>::umax(arg1, arg2)), simd128<(8)>::umax(simd_and(simd128<(8)>::lomask(), arg1), simd_and(simd128<(8)>::lomask(), arg2)));
1614}
1615
1616//The total number of operations is 1
1617template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::umax(bitblock128_t arg1, bitblock128_t arg2)
1618{
1619        return _mm_max_epu8(arg1, arg2);
1620}
1621
1622//The total number of operations is 4
1623template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::umax(bitblock128_t arg1, bitblock128_t arg2)
1624{
1625        bitblock128_t high_bit = simd128<16>::constant<(32768)>();
1626        return simd_xor(simd128<16>::max(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1627}
1628
1629//The total number of operations is 7
1630template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::umax(bitblock128_t arg1, bitblock128_t arg2)
1631{
1632        bitblock128_t high_bit = simd128<32>::constant<(2147483648UL)>();
1633        return simd_xor(simd128<32>::max(simd_xor(arg1, high_bit), simd_xor(arg2, high_bit)), high_bit);
1634}
1635
1636//The total number of operations is 20
1637template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::umax(bitblock128_t arg1, bitblock128_t arg2)
1638{
1639        bitblock128_t tmpAns = simd128<(32)>::umax(arg1, arg2);
1640        bitblock128_t eqMask1 = simd128<64>::srli<(32)>(simd128<(32)>::eq(tmpAns, arg1));
1641        bitblock128_t eqMask2 = simd128<64>::srli<(32)>(simd128<(32)>::eq(tmpAns, arg2));
1642        return simd128<1>::ifh(simd128<64>::himask(), tmpAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, tmpAns, arg1), arg2));
1643}
1644
1645//The total number of operations is 47
1646template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::umax(bitblock128_t arg1, bitblock128_t arg2)
1647{
1648        bitblock128_t tmpAns = simd128<(64)>::umax(arg1, arg2);
1649        bitblock128_t eqMask1 = simd128<128>::srli<(64)>(simd128<(64)>::eq(tmpAns, arg1));
1650        bitblock128_t eqMask2 = simd128<128>::srli<(64)>(simd128<(64)>::eq(tmpAns, arg2));
1651        return simd128<1>::ifh(simd128<128>::himask(), tmpAns, simd128<1>::ifh(eqMask1, simd128<1>::ifh(eqMask2, tmpAns, arg1), arg2));
1652}
1653
1654//The total number of operations is 37
1655template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::eq(bitblock128_t arg1, bitblock128_t arg2)
1656{
1657        return simd_or(simd_and(simd128<(2)>::himask(), simd128<(2)>::eq(simd_and(simd128<(2)>::himask(), arg1), simd_and(simd128<(2)>::himask(), arg2))), simd_and(simd128<(2)>::lomask(), simd128<(2)>::eq(simd_and(simd128<(2)>::lomask(), arg1), simd_and(simd128<(2)>::lomask(), arg2))));
1658}
1659
1660//The total number of operations is 15
1661template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::eq(bitblock128_t arg1, bitblock128_t arg2)
1662{
1663        bitblock128_t tmp = simd_xor(arg1, arg2);
1664        bitblock128_t tmpAns = simd_and(simd_not(simd128<128>::slli<1>(tmp)), simd_not(tmp));
1665        return simd128<1>::ifh(simd128<2>::himask(), tmpAns, simd128<128>::srli<1>(tmpAns));
1666}
1667
1668//The total number of operations is 9
1669template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::eq(bitblock128_t arg1, bitblock128_t arg2)
1670{
1671        return simd_or(simd_and(simd128<(8)>::himask(), simd128<(8)>::eq(simd_and(simd128<(8)>::himask(), arg1), simd_and(simd128<(8)>::himask(), arg2))), simd_and(simd128<(8)>::lomask(), simd128<(8)>::eq(simd_and(simd128<(8)>::lomask(), arg1), simd_and(simd128<(8)>::lomask(), arg2))));
1672}
1673
1674//The total number of operations is 1
1675template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::eq(bitblock128_t arg1, bitblock128_t arg2)
1676{
1677        return _mm_cmpeq_epi8(arg1, arg2);
1678}
1679
1680//The total number of operations is 1
1681template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::eq(bitblock128_t arg1, bitblock128_t arg2)
1682{
1683        return _mm_cmpeq_epi16(arg1, arg2);
1684}
1685
1686//The total number of operations is 1
1687template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::eq(bitblock128_t arg1, bitblock128_t arg2)
1688{
1689        return _mm_cmpeq_epi32(arg1, arg2);
1690}
1691
1692//The total number of operations is 5
1693template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::eq(bitblock128_t arg1, bitblock128_t arg2)
1694{
1695        bitblock128_t tmpAns = simd128<(32)>::eq(arg1, arg2);
1696        bitblock128_t loMask = simd_and(tmpAns, simd128<64>::srli<(32)>(tmpAns));
1697        bitblock128_t hiMask = simd128<64>::slli<(32)>(loMask);
1698        return simd_or(loMask, hiMask);
1699}
1700
1701//The total number of operations is 15
1702template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::eq(bitblock128_t arg1, bitblock128_t arg2)
1703{
1704        bitblock128_t tmpAns = simd128<(64)>::eq(arg1, arg2);
1705        bitblock128_t loMask = simd_and(tmpAns, simd128<128>::srli<(64)>(tmpAns));
1706        bitblock128_t hiMask = simd128<128>::slli<(64)>(loMask);
1707        return simd_or(loMask, hiMask);
1708}
1709
1710//The total number of operations is 4
1711template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::srai(bitblock128_t arg1)
1712{
1713        return ((sh == 0) ? arg1 : simd_or(simd_and(simd128<2>::himask(), arg1), simd128<2>::srli<1>(arg1)));
1714}
1715
1716//The total number of operations is 10
1717template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::srai(bitblock128_t arg1)
1718{
1719        bitblock128_t tmp = simd128<4>::srli<((sh >= 4) ? (3) : ((sh < 0) ? 0 : sh))>(arg1);
1720        return simd_or(tmp, simd128<4>::sub(simd128<4>::constant<0>(), simd_and(simd128<4>::constant<(1<<((4-((sh >= 4) ? (3) : ((sh < 0) ? 0 : sh)))-1))>(), tmp)));
1721}
1722
1723//The total number of operations is 5
1724template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::srai(bitblock128_t arg1)
1725{
1726        bitblock128_t tmp = simd128<8>::srli<((sh >= 8) ? (7) : ((sh < 0) ? 0 : sh))>(arg1);
1727        return simd_or(tmp, simd128<8>::sub(simd128<8>::constant<0>(), simd_and(simd128<8>::constant<(1<<((8-((sh >= 8) ? (7) : ((sh < 0) ? 0 : sh)))-1))>(), tmp)));
1728}
1729
1730//The total number of operations is 1
1731template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::srai(bitblock128_t arg1)
1732{
1733        return _mm_srai_epi16(arg1, (int32_t)(sh));
1734}
1735
1736//The total number of operations is 1
1737template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::srai(bitblock128_t arg1)
1738{
1739        return _mm_srai_epi32(arg1, (int32_t)(sh));
1740}
1741
1742//The total number of operations is 5
1743template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::srai(bitblock128_t arg1)
1744{
1745        bitblock128_t tmp = simd128<64>::srli<((sh >= 64) ? (63) : ((sh < 0) ? 0 : sh))>(arg1);
1746        return simd_or(tmp, simd128<64>::sub(simd128<64>::constant<0>(), simd_and(simd128<64>::slli<((64-((sh >= 64) ? (63) : ((sh < 0) ? 0 : sh)))-1)>(simd128<64>::constant<1>()), tmp)));
1747}
1748
1749//The total number of operations is 21
1750template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::srai(bitblock128_t arg1)
1751{
1752        bitblock128_t tmp = simd128<128>::srli<((sh >= 128) ? (127) : ((sh < 0) ? 0 : sh))>(arg1);
1753        return simd_or(tmp, simd128<128>::sub(simd128<128>::constant<0>(), simd_and(simd128<128>::slli<((128-((sh >= 128) ? (127) : ((sh < 0) ? 0 : sh)))-1)>(simd128<128>::constant<1>()), tmp)));
1754}
1755
1756//The total number of operations is 0
1757template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::himask()
1758{
1759        return simd128<2>::constant<(2)>();
1760}
1761
1762//The total number of operations is 0
1763template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::himask()
1764{
1765        return simd128<4>::constant<(12)>();
1766}
1767
1768//The total number of operations is 0
1769template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::himask()
1770{
1771        return simd128<8>::constant<(240)>();
1772}
1773
1774//The total number of operations is 0
1775template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::himask()
1776{
1777        return simd128<16>::constant<(65280)>();
1778}
1779
1780//The total number of operations is 0
1781template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::himask()
1782{
1783        return simd128<32>::constant<-65536>();
1784}
1785
1786//The total number of operations is 0
1787template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::himask()
1788{
1789        return _mm_set_epi32((int32_t)(-1), (int32_t)(0), (int32_t)(-1), (int32_t)(0));
1790}
1791
1792//The total number of operations is 0
1793template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::himask()
1794{
1795        return _mm_set_epi32((int32_t)(-1), (int32_t)(-1), (int32_t)(0), (int32_t)(0));
1796}
1797
1798//The total number of operations is 24
1799template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::add(bitblock128_t arg1, bitblock128_t arg2)
1800{
1801        return simd128<1>::ifh(simd128<(2)>::himask(), simd128<(2)>::add(arg1, simd_and(simd128<(2)>::himask(), arg2)), simd128<(2)>::add(arg1, arg2));
1802}
1803
1804//The total number of operations is 10
1805template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::add(bitblock128_t arg1, bitblock128_t arg2)
1806{
1807        bitblock128_t tmp = simd_xor(arg1, arg2);
1808        return simd128<1>::ifh(simd128<2>::himask(), simd_xor(tmp, simd128<128>::slli<1>(simd_and(arg1, arg2))), tmp);
1809}
1810
1811//The total number of operations is 6
1812template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::add(bitblock128_t arg1, bitblock128_t arg2)
1813{
1814        return simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::add(arg1, simd_and(simd128<(8)>::himask(), arg2)), simd128<(8)>::add(arg1, arg2));
1815}
1816
1817//The total number of operations is 1
1818template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::add(bitblock128_t arg1, bitblock128_t arg2)
1819{
1820        return _mm_add_epi8(arg1, arg2);
1821}
1822
1823//The total number of operations is 1
1824template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::add(bitblock128_t arg1, bitblock128_t arg2)
1825{
1826        return _mm_add_epi16(arg1, arg2);
1827}
1828
1829//The total number of operations is 1
1830template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::add(bitblock128_t arg1, bitblock128_t arg2)
1831{
1832        return _mm_add_epi32(arg1, arg2);
1833}
1834
1835//The total number of operations is 1
1836template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::add(bitblock128_t arg1, bitblock128_t arg2)
1837{
1838        return _mm_add_epi64(arg1, arg2);
1839}
1840
1841//The total number of operations is 11
1842template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::add(bitblock128_t arg1, bitblock128_t arg2)
1843{
1844        bitblock128_t partial = simd128<(64)>::add(arg1, arg2);
1845        bitblock128_t carryMask = simd_or(simd_and(arg1, arg2), simd_andc(simd_xor(arg1, arg2), partial));
1846        bitblock128_t carry = simd128<128>::slli<(64)>(simd128<(64)>::srli<(63)>(carryMask));
1847        return simd128<(64)>::add(partial, carry);
1848}
1849
1850//The total number of operations is 72
1851template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<1>::abs(bitblock128_t arg1)
1852{
1853        bitblock128_t gtMask = simd128<1>::gt(arg1, simd128<1>::constant<0>());
1854        return simd128<1>::ifh(gtMask, arg1, simd128<1>::sub(gtMask, arg1));
1855}
1856
1857//The total number of operations is 9
1858template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<2>::abs(bitblock128_t arg1)
1859{
1860        return simd128<1>::ifh(simd128<2>::himask(), simd_and(arg1, simd128<128>::slli<1>(simd_not(arg1))), arg1);
1861}
1862
1863//The total number of operations is 19
1864template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<4>::abs(bitblock128_t arg1)
1865{
1866        bitblock128_t gtMask = simd128<4>::gt(arg1, simd128<4>::constant<0>());
1867        return simd128<1>::ifh(gtMask, arg1, simd128<4>::sub(gtMask, arg1));
1868}
1869
1870//The total number of operations is 5
1871template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<8>::abs(bitblock128_t arg1)
1872{
1873        bitblock128_t gtMask = simd128<8>::gt(arg1, simd128<8>::constant<0>());
1874        return simd128<1>::ifh(gtMask, arg1, simd128<8>::sub(gtMask, arg1));
1875}
1876
1877//The total number of operations is 5
1878template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<16>::abs(bitblock128_t arg1)
1879{
1880        bitblock128_t gtMask = simd128<16>::gt(arg1, simd128<16>::constant<0>());
1881        return simd128<1>::ifh(gtMask, arg1, simd128<16>::sub(gtMask, arg1));
1882}
1883
1884//The total number of operations is 5
1885template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<32>::abs(bitblock128_t arg1)
1886{
1887        bitblock128_t gtMask = simd128<32>::gt(arg1, simd128<32>::constant<0>());
1888        return simd128<1>::ifh(gtMask, arg1, simd128<32>::sub(gtMask, arg1));
1889}
1890
1891//The total number of operations is 17
1892template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<64>::abs(bitblock128_t arg1)
1893{
1894        bitblock128_t eqMask = simd128<64>::eq(simd128<1>::ifh(simd128<64>::himask(), simd128<(32)>::abs(arg1), arg1), arg1);
1895        return simd128<1>::ifh(eqMask, arg1, simd128<64>::sub(eqMask, arg1));
1896}
1897
1898//The total number of operations is 49
1899template <> IDISA_ALWAYS_INLINE bitblock128_t simd128<128>::abs(bitblock128_t arg1)
1900{
1901        bitblock128_t eqMask = simd128<128>::eq(simd128<1>::ifh(simd128<128>::himask(), simd128<(64)>::abs(arg1), arg1), arg1);
1902        return simd128<1>::ifh(eqMask, arg1, simd128<128>::sub(eqMask, arg1));
1903}
1904
1905//The total number of operations is 128
1906template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1907{
1908        return simd128<(1)>::umin(hsimd128<2>::packh(arg1, arg2), hsimd128<2>::packl(arg1, arg2));
1909}
1910
1911//The total number of operations is 80
1912template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1913{
1914        return simd128<(2)>::umin(hsimd128<4>::packh(arg1, arg2), hsimd128<4>::packl(arg1, arg2));
1915}
1916
1917//The total number of operations is 42
1918template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1919{
1920        return simd128<(4)>::umin(hsimd128<8>::packh(arg1, arg2), hsimd128<8>::packl(arg1, arg2));
1921}
1922
1923//The total number of operations is 7
1924template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1925{
1926        return simd128<(8)>::umin(hsimd128<16>::packh(arg1, arg2), hsimd128<16>::packl(arg1, arg2));
1927}
1928
1929//The total number of operations is 44
1930template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1931{
1932        return simd128<(16)>::umin(hsimd128<32>::packh(arg1, arg2), hsimd128<32>::packl(arg1, arg2));
1933}
1934
1935//The total number of operations is 19
1936template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1937{
1938        return simd128<(32)>::umin(hsimd128<64>::packh(arg1, arg2), hsimd128<64>::packl(arg1, arg2));
1939}
1940
1941//The total number of operations is 34
1942template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::umin_hl(bitblock128_t arg1, bitblock128_t arg2)
1943{
1944        return simd128<(64)>::umin(hsimd128<128>::packh(arg1, arg2), hsimd128<128>::packl(arg1, arg2));
1945}
1946
1947//The total number of operations is 116
1948template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1949{
1950        return simd128<(1)>::add(hsimd128<2>::packh(arg1, arg2), hsimd128<2>::packl(arg1, arg2));
1951}
1952
1953//The total number of operations is 74
1954template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1955{
1956        return simd128<(2)>::add(hsimd128<4>::packh(arg1, arg2), hsimd128<4>::packl(arg1, arg2));
1957}
1958
1959//The total number of operations is 42
1960template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1961{
1962        return simd128<(4)>::add(hsimd128<8>::packh(arg1, arg2), hsimd128<8>::packl(arg1, arg2));
1963}
1964
1965//The total number of operations is 7
1966template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1967{
1968        return simd128<(8)>::add(hsimd128<16>::packh(arg1, arg2), hsimd128<16>::packl(arg1, arg2));
1969}
1970
1971//The total number of operations is 41
1972template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1973{
1974        return simd128<(16)>::add(hsimd128<32>::packh(arg1, arg2), hsimd128<32>::packl(arg1, arg2));
1975}
1976
1977//The total number of operations is 13
1978template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1979{
1980        return simd128<(32)>::add(hsimd128<64>::packh(arg1, arg2), hsimd128<64>::packl(arg1, arg2));
1981}
1982
1983//The total number of operations is 15
1984template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::add_hl(bitblock128_t arg1, bitblock128_t arg2)
1985{
1986        return simd128<(64)>::add(hsimd128<128>::packh(arg1, arg2), hsimd128<128>::packl(arg1, arg2));
1987}
1988
1989//The total number of operations is 132
1990template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packss(bitblock128_t arg1, bitblock128_t arg2)
1991{
1992        bitblock128_t hiBound = simd128<2>::srli<1>(simd128<2>::lomask());
1993        bitblock128_t loBound = simd_not(hiBound);
1994        return hsimd128<2>::packl(simd128<1>::ifh(simd128<2>::gt(arg1, hiBound), hiBound, simd128<1>::ifh(simd128<2>::gt(arg1, loBound), arg1, loBound)), simd128<1>::ifh(simd128<2>::gt(arg2, hiBound), hiBound, simd128<1>::ifh(simd128<2>::gt(arg2, loBound), arg2, loBound)));
1995}
1996
1997//The total number of operations is 86
1998template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packss(bitblock128_t arg1, bitblock128_t arg2)
1999{
2000        bitblock128_t hiBound = simd128<4>::srli<1>(simd128<4>::lomask());
2001        bitblock128_t loBound = simd_not(hiBound);
2002        return hsimd128<4>::packl(simd128<1>::ifh(simd128<4>::gt(arg1, hiBound), hiBound, simd128<1>::ifh(simd128<4>::gt(arg1, loBound), arg1, loBound)), simd128<1>::ifh(simd128<4>::gt(arg2, hiBound), hiBound, simd128<1>::ifh(simd128<4>::gt(arg2, loBound), arg2, loBound)));
2003}
2004
2005//The total number of operations is 36
2006template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packss(bitblock128_t arg1, bitblock128_t arg2)
2007{
2008        bitblock128_t hiBound = simd128<8>::srli<1>(simd128<8>::lomask());
2009        bitblock128_t loBound = simd_not(hiBound);
2010        return hsimd128<8>::packl(simd128<1>::ifh(simd128<8>::gt(arg1, hiBound), hiBound, simd128<1>::ifh(simd128<8>::gt(arg1, loBound), arg1, loBound)), simd128<1>::ifh(simd128<8>::gt(arg2, hiBound), hiBound, simd128<1>::ifh(simd128<8>::gt(arg2, loBound), arg2, loBound)));
2011}
2012
2013//The total number of operations is 1
2014template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packss(bitblock128_t arg1, bitblock128_t arg2)
2015{
2016        return _mm_packs_epi16(arg2, arg1);
2017}
2018
2019//The total number of operations is 1
2020template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packss(bitblock128_t arg1, bitblock128_t arg2)
2021{
2022        return _mm_packs_epi32(arg2, arg1);
2023}
2024
2025//The total number of operations is 79
2026template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packss(bitblock128_t arg1, bitblock128_t arg2)
2027{
2028        bitblock128_t hiBound = simd128<64>::srli<1>(simd128<64>::lomask());
2029        bitblock128_t loBound = simd_not(hiBound);
2030        return hsimd128<64>::packl(simd128<1>::ifh(simd128<64>::gt(arg1, hiBound), hiBound, simd128<1>::ifh(simd128<64>::gt(arg1, loBound), arg1, loBound)), simd128<1>::ifh(simd128<64>::gt(arg2, hiBound), hiBound, simd128<1>::ifh(simd128<64>::gt(arg2, loBound), arg2, loBound)));
2031}
2032
2033//The total number of operations is 288
2034template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packss(bitblock128_t arg1, bitblock128_t arg2)
2035{
2036        bitblock128_t hiBound = simd128<128>::srli<1>(simd128<128>::lomask());
2037        bitblock128_t loBound = simd_not(hiBound);
2038        return hsimd128<128>::packl(simd128<1>::ifh(simd128<128>::gt(arg1, hiBound), hiBound, simd128<1>::ifh(simd128<128>::gt(arg1, loBound), arg1, loBound)), simd128<1>::ifh(simd128<128>::gt(arg2, hiBound), hiBound, simd128<1>::ifh(simd128<128>::gt(arg2, loBound), arg2, loBound)));
2039}
2040
2041//The total number of operations is 24
2042template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<4>::signmask(bitblock128_t arg1)
2043{
2044        uint64_t tmpAns1 = hsimd128<(8)>::signmask(esimd128<4>::mergeh(arg1, simd128<4>::constant<0>()));
2045        uint64_t tmpAns2 = hsimd128<(8)>::signmask(esimd128<4>::mergel(arg1, simd128<4>::constant<0>()));
2046        return ((tmpAns1<<(16))+tmpAns2);
2047}
2048
2049//The total number of operations is 1
2050template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<8>::signmask(bitblock128_t arg1)
2051{
2052        return _mm_movemask_epi8(arg1);
2053}
2054
2055//The total number of operations is 4
2056template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<16>::signmask(bitblock128_t arg1)
2057{
2058        return hsimd128<(8)>::signmask(hsimd128<16>::packh(simd128<16>::constant<0>(), arg1));
2059}
2060
2061//The total number of operations is 25
2062template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<32>::signmask(bitblock128_t arg1)
2063{
2064        return hsimd128<(16)>::signmask(hsimd128<32>::packh(simd128<32>::constant<0>(), arg1));
2065}
2066
2067//The total number of operations is 32
2068template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<64>::signmask(bitblock128_t arg1)
2069{
2070        return hsimd128<(32)>::signmask(hsimd128<64>::packh(simd128<64>::constant<0>(), arg1));
2071}
2072
2073//The total number of operations is 39
2074template <> IDISA_ALWAYS_INLINE uint64_t hsimd128<128>::signmask(bitblock128_t arg1)
2075{
2076        return hsimd128<(64)>::signmask(hsimd128<128>::packh(simd128<128>::constant<0>(), arg1));
2077}
2078
2079//The total number of operations is 45
2080template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packl(bitblock128_t arg1, bitblock128_t arg2)
2081{
2082        return hsimd128<(4)>::packl(simd128<1>::ifh(simd128<2>::himask(), simd128<128>::srli<(1)>(arg1), arg1), simd128<1>::ifh(simd128<2>::himask(), simd128<128>::srli<(1)>(arg2), arg2));
2083}
2084
2085//The total number of operations is 31
2086template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packl(bitblock128_t arg1, bitblock128_t arg2)
2087{
2088        return hsimd128<(8)>::packl(simd128<1>::ifh(simd128<4>::himask(), simd128<128>::srli<(2)>(arg1), arg1), simd128<1>::ifh(simd128<4>::himask(), simd128<128>::srli<(2)>(arg2), arg2));
2089}
2090
2091//The total number of operations is 17
2092template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packl(bitblock128_t arg1, bitblock128_t arg2)
2093{
2094        return hsimd128<(16)>::packl(simd128<1>::ifh(simd128<8>::himask(), simd128<128>::srli<(4)>(arg1), arg1), simd128<1>::ifh(simd128<8>::himask(), simd128<128>::srli<(4)>(arg2), arg2));
2095}
2096
2097//The total number of operations is 3
2098template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packl(bitblock128_t arg1, bitblock128_t arg2)
2099{
2100        return hsimd128<16>::packus(simd_and(arg1, simd128<16>::lomask()), simd_and(arg2, simd128<16>::lomask()));
2101}
2102
2103//The total number of operations is 19
2104template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packl(bitblock128_t arg1, bitblock128_t arg2)
2105{
2106        return hsimd128<(64)>::packl(simd128<1>::ifh(simd128<32>::himask(), simd128<128>::srli<(16)>(arg1), arg1), simd128<1>::ifh(simd128<32>::himask(), simd128<128>::srli<(16)>(arg2), arg2));
2107}
2108
2109//The total number of operations is 5
2110template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packl(bitblock128_t arg1, bitblock128_t arg2)
2111{
2112        return simd_or(mvmd128<32>::shufflei<shufflemask4(2, 0, 3, 3)>(simd_andc(arg1, simd128<64>::himask())), mvmd128<32>::shufflei<shufflemask4(3, 3, 2, 0)>(simd_andc(arg2, simd128<64>::himask())));
2113}
2114
2115//The total number of operations is 7
2116template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packl(bitblock128_t arg1, bitblock128_t arg2)
2117{
2118        return simd128<1>::ifh(simd128<128>::himask(), simd128<128>::slli<(64)>(arg1), arg2);
2119}
2120
2121//The total number of operations is 47
2122template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packh(bitblock128_t arg1, bitblock128_t arg2)
2123{
2124        return hsimd128<2>::packl(simd128<64>::srli<(1)>(arg1), simd128<64>::srli<(1)>(arg2));
2125}
2126
2127//The total number of operations is 33
2128template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packh(bitblock128_t arg1, bitblock128_t arg2)
2129{
2130        return hsimd128<4>::packl(simd128<64>::srli<(2)>(arg1), simd128<64>::srli<(2)>(arg2));
2131}
2132
2133//The total number of operations is 19
2134template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packh(bitblock128_t arg1, bitblock128_t arg2)
2135{
2136        return hsimd128<8>::packl(simd128<64>::srli<(4)>(arg1), simd128<64>::srli<(4)>(arg2));
2137}
2138
2139//The total number of operations is 3
2140template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packh(bitblock128_t arg1, bitblock128_t arg2)
2141{
2142        return hsimd128<16>::packus(simd128<16>::srli<(8)>(arg1), simd128<16>::srli<(8)>(arg2));
2143}
2144
2145//The total number of operations is 21
2146template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packh(bitblock128_t arg1, bitblock128_t arg2)
2147{
2148        return hsimd128<32>::packl(simd128<64>::srli<(16)>(arg1), simd128<64>::srli<(16)>(arg2));
2149}
2150
2151//The total number of operations is 7
2152template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packh(bitblock128_t arg1, bitblock128_t arg2)
2153{
2154        return hsimd128<64>::packl(simd128<64>::srli<(32)>(arg1), simd128<64>::srli<(32)>(arg2));
2155}
2156
2157//The total number of operations is 7
2158template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packh(bitblock128_t arg1, bitblock128_t arg2)
2159{
2160        return simd128<1>::ifh(simd128<128>::himask(), arg1, simd128<128>::srli<(64)>(arg2));
2161}
2162
2163//The total number of operations is 131
2164template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2165{
2166        return simd128<(1)>::min(hsimd128<2>::packh(arg1, arg2), hsimd128<2>::packl(arg1, arg2));
2167}
2168
2169//The total number of operations is 83
2170template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2171{
2172        return simd128<(2)>::min(hsimd128<4>::packh(arg1, arg2), hsimd128<4>::packl(arg1, arg2));
2173}
2174
2175//The total number of operations is 45
2176template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2177{
2178        return simd128<(4)>::min(hsimd128<8>::packh(arg1, arg2), hsimd128<8>::packl(arg1, arg2));
2179}
2180
2181//The total number of operations is 10
2182template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2183{
2184        return simd128<(8)>::min(hsimd128<16>::packh(arg1, arg2), hsimd128<16>::packl(arg1, arg2));
2185}
2186
2187//The total number of operations is 41
2188template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2189{
2190        return simd128<(16)>::min(hsimd128<32>::packh(arg1, arg2), hsimd128<32>::packl(arg1, arg2));
2191}
2192
2193//The total number of operations is 16
2194template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2195{
2196        return simd128<(32)>::min(hsimd128<64>::packh(arg1, arg2), hsimd128<64>::packl(arg1, arg2));
2197}
2198
2199//The total number of operations is 32
2200template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::min_hl(bitblock128_t arg1, bitblock128_t arg2)
2201{
2202        return simd128<(64)>::min(hsimd128<128>::packh(arg1, arg2), hsimd128<128>::packl(arg1, arg2));
2203}
2204
2205//The total number of operations is 99
2206template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<2>::packus(bitblock128_t arg1, bitblock128_t arg2)
2207{
2208        bitblock128_t arg11 = simd128<2>::ifh(arg1, simd128<2>::constant<0>(), arg1);
2209        bitblock128_t arg12 = simd_and(simd128<2>::lomask(), arg11);
2210        bitblock128_t arg21 = simd128<2>::ifh(arg2, simd128<2>::constant<0>(), arg2);
2211        bitblock128_t arg22 = simd_and(simd128<2>::lomask(), arg21);
2212        return hsimd128<2>::packl(simd128<1>::ifh(simd128<2>::eq(arg12, arg11), arg12, simd128<2>::lomask()), simd128<1>::ifh(simd128<2>::eq(arg22, arg21), arg22, simd128<2>::lomask()));
2213}
2214
2215//The total number of operations is 83
2216template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<4>::packus(bitblock128_t arg1, bitblock128_t arg2)
2217{
2218        bitblock128_t arg11 = simd128<4>::ifh(arg1, simd128<4>::constant<0>(), arg1);
2219        bitblock128_t arg12 = simd_and(simd128<4>::lomask(), arg11);
2220        bitblock128_t arg21 = simd128<4>::ifh(arg2, simd128<4>::constant<0>(), arg2);
2221        bitblock128_t arg22 = simd_and(simd128<4>::lomask(), arg21);
2222        return hsimd128<4>::packl(simd128<1>::ifh(simd128<4>::eq(arg12, arg11), arg12, simd128<4>::lomask()), simd128<1>::ifh(simd128<4>::eq(arg22, arg21), arg22, simd128<4>::lomask()));
2223}
2224
2225//The total number of operations is 35
2226template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<8>::packus(bitblock128_t arg1, bitblock128_t arg2)
2227{
2228        bitblock128_t arg11 = simd128<8>::ifh(arg1, simd128<8>::constant<0>(), arg1);
2229        bitblock128_t arg12 = simd_and(simd128<8>::lomask(), arg11);
2230        bitblock128_t arg21 = simd128<8>::ifh(arg2, simd128<8>::constant<0>(), arg2);
2231        bitblock128_t arg22 = simd_and(simd128<8>::lomask(), arg21);
2232        return hsimd128<8>::packl(simd128<1>::ifh(simd128<8>::eq(arg12, arg11), arg12, simd128<8>::lomask()), simd128<1>::ifh(simd128<8>::eq(arg22, arg21), arg22, simd128<8>::lomask()));
2233}
2234
2235//The total number of operations is 1
2236template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<16>::packus(bitblock128_t arg1, bitblock128_t arg2)
2237{
2238        return _mm_packus_epi16(arg2, arg1);
2239}
2240
2241//The total number of operations is 37
2242template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<32>::packus(bitblock128_t arg1, bitblock128_t arg2)
2243{
2244        bitblock128_t arg11 = simd128<32>::ifh(arg1, simd128<32>::constant<0>(), arg1);
2245        bitblock128_t arg12 = simd_and(simd128<32>::lomask(), arg11);
2246        bitblock128_t arg21 = simd128<32>::ifh(arg2, simd128<32>::constant<0>(), arg2);
2247        bitblock128_t arg22 = simd_and(simd128<32>::lomask(), arg21);
2248        return hsimd128<32>::packl(simd128<1>::ifh(simd128<32>::eq(arg12, arg11), arg12, simd128<32>::lomask()), simd128<1>::ifh(simd128<32>::eq(arg22, arg21), arg22, simd128<32>::lomask()));
2249}
2250
2251//The total number of operations is 18
2252template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<64>::packus(bitblock128_t arg1, bitblock128_t arg2)
2253{
2254        bitblock128_t hiPart = hsimd128<64>::packh(arg1, arg2);
2255        return simd128<(32)>::ifh(hiPart, simd128<(32)>::constant<0>(), simd_or(simd128<(32)>::gt(hiPart, simd128<(32)>::constant<0>()), hsimd128<64>::packl(arg1, arg2)));
2256}
2257
2258//The total number of operations is 38
2259template <> IDISA_ALWAYS_INLINE bitblock128_t hsimd128<128>::packus(bitblock128_t arg1, bitblock128_t arg2)
2260{
2261        bitblock128_t hiPart = hsimd128<128>::packh(arg1, arg2);
2262        return simd128<(64)>::ifh(hiPart, simd128<(64)>::constant<0>(), simd_or(simd128<(64)>::gt(hiPart, simd128<(64)>::constant<0>()), hsimd128<128>::packl(arg1, arg2)));
2263}
2264
2265//The total number of operations is 31
2266template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2267{
2268        return esimd128<(2)>::mergel(simd128<1>::ifh(simd128<(2)>::himask(), arg1, simd128<(2)>::srli<1>(arg2)), simd128<1>::ifh(simd128<(2)>::himask(), simd128<(2)>::slli<1>(arg1), arg2));
2269}
2270
2271//The total number of operations is 21
2272template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2273{
2274        return esimd128<(4)>::mergel(simd128<1>::ifh(simd128<(4)>::himask(), arg1, simd128<(4)>::srli<2>(arg2)), simd128<1>::ifh(simd128<(4)>::himask(), simd128<(4)>::slli<2>(arg1), arg2));
2275}
2276
2277//The total number of operations is 11
2278template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2279{
2280        return esimd128<(8)>::mergel(simd128<1>::ifh(simd128<(8)>::himask(), arg1, simd128<(8)>::srli<4>(arg2)), simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::slli<4>(arg1), arg2));
2281}
2282
2283//The total number of operations is 1
2284template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2285{
2286        return _mm_unpacklo_epi8(arg2, arg1);
2287}
2288
2289//The total number of operations is 1
2290template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2291{
2292        return _mm_unpacklo_epi16(arg2, arg1);
2293}
2294
2295//The total number of operations is 1
2296template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2297{
2298        return _mm_unpacklo_epi32(arg2, arg1);
2299}
2300
2301//The total number of operations is 1
2302template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::mergel(bitblock128_t arg1, bitblock128_t arg2)
2303{
2304        return _mm_unpacklo_epi64(arg2, arg1);
2305}
2306
2307//The total number of operations is 31
2308template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2309{
2310        return esimd128<(2)>::mergeh(simd128<1>::ifh(simd128<(2)>::himask(), arg1, simd128<(2)>::srli<1>(arg2)), simd128<1>::ifh(simd128<(2)>::himask(), simd128<(2)>::slli<1>(arg1), arg2));
2311}
2312
2313//The total number of operations is 21
2314template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2315{
2316        return esimd128<(4)>::mergeh(simd128<1>::ifh(simd128<(4)>::himask(), arg1, simd128<(4)>::srli<2>(arg2)), simd128<1>::ifh(simd128<(4)>::himask(), simd128<(4)>::slli<2>(arg1), arg2));
2317}
2318
2319//The total number of operations is 11
2320template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2321{
2322        return esimd128<(8)>::mergeh(simd128<1>::ifh(simd128<(8)>::himask(), arg1, simd128<(8)>::srli<4>(arg2)), simd128<1>::ifh(simd128<(8)>::himask(), simd128<(8)>::slli<4>(arg1), arg2));
2323}
2324
2325//The total number of operations is 1
2326template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2327{
2328        return _mm_unpackhi_epi8(arg2, arg1);
2329}
2330
2331//The total number of operations is 1
2332template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2333{
2334        return _mm_unpackhi_epi16(arg2, arg1);
2335}
2336
2337//The total number of operations is 1
2338template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2339{
2340        return _mm_unpackhi_epi32(arg2, arg1);
2341}
2342
2343//The total number of operations is 1
2344template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::mergeh(bitblock128_t arg1, bitblock128_t arg2)
2345{
2346        return _mm_unpackhi_epi64(arg2, arg1);
2347}
2348
2349//The total number of operations is 24
2350template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::zeroextendh(bitblock128_t arg1)
2351{
2352        return esimd128<(2)>::mergeh(simd128<(2)>::srli<1>(arg1), simd_and(simd128<(2)>::lomask(), arg1));
2353}
2354
2355//The total number of operations is 14
2356template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::zeroextendh(bitblock128_t arg1)
2357{
2358        return esimd128<(4)>::mergeh(simd128<(4)>::srli<2>(arg1), simd_and(simd128<(4)>::lomask(), arg1));
2359}
2360
2361//The total number of operations is 4
2362template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::zeroextendh(bitblock128_t arg1)
2363{
2364        return esimd128<(8)>::mergeh(simd128<(8)>::srli<4>(arg1), simd_and(simd128<(8)>::lomask(), arg1));
2365}
2366
2367//The total number of operations is 3
2368template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::zeroextendh(bitblock128_t arg1)
2369{
2370        return esimd128<(16)>::mergeh(simd128<(16)>::srli<8>(arg1), simd_and(simd128<(16)>::lomask(), arg1));
2371}
2372
2373//The total number of operations is 3
2374template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::zeroextendh(bitblock128_t arg1)
2375{
2376        return esimd128<(32)>::mergeh(simd128<(32)>::srli<16>(arg1), simd_and(simd128<(32)>::lomask(), arg1));
2377}
2378
2379//The total number of operations is 3
2380template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::zeroextendh(bitblock128_t arg1)
2381{
2382        return esimd128<(64)>::mergeh(simd128<(64)>::srli<32>(arg1), simd_and(simd128<(64)>::lomask(), arg1));
2383}
2384
2385//The total number of operations is 4
2386template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::zeroextendh(bitblock128_t arg1)
2387{
2388        return simd128<(128)>::srli<64>(arg1);
2389}
2390
2391//The total number of operations is 24
2392template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::zeroextendl(bitblock128_t arg1)
2393{
2394        return esimd128<(2)>::mergel(simd128<(2)>::srli<1>(arg1), simd_and(simd128<(2)>::lomask(), arg1));
2395}
2396
2397//The total number of operations is 14
2398template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::zeroextendl(bitblock128_t arg1)
2399{
2400        return esimd128<(4)>::mergel(simd128<(4)>::srli<2>(arg1), simd_and(simd128<(4)>::lomask(), arg1));
2401}
2402
2403//The total number of operations is 4
2404template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::zeroextendl(bitblock128_t arg1)
2405{
2406        return esimd128<(8)>::mergel(simd128<(8)>::srli<4>(arg1), simd_and(simd128<(8)>::lomask(), arg1));
2407}
2408
2409//The total number of operations is 3
2410template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::zeroextendl(bitblock128_t arg1)
2411{
2412        return esimd128<(16)>::mergel(simd128<(16)>::srli<8>(arg1), simd_and(simd128<(16)>::lomask(), arg1));
2413}
2414
2415//The total number of operations is 3
2416template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::zeroextendl(bitblock128_t arg1)
2417{
2418        return esimd128<(32)>::mergel(simd128<(32)>::srli<16>(arg1), simd_and(simd128<(32)>::lomask(), arg1));
2419}
2420
2421//The total number of operations is 3
2422template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::zeroextendl(bitblock128_t arg1)
2423{
2424        return esimd128<(64)>::mergel(simd128<(64)>::srli<32>(arg1), simd_and(simd128<(64)>::lomask(), arg1));
2425}
2426
2427//The total number of operations is 1
2428template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::zeroextendl(bitblock128_t arg1)
2429{
2430        return simd_and(simd128<(128)>::lomask(), arg1);
2431}
2432
2433//The total number of operations is 31
2434template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::signextendh(bitblock128_t arg1)
2435{
2436        return esimd128<(2)>::mergeh(simd128<(2)>::srai<1>(arg1), simd128<(2)>::srai<1>(simd128<(2)>::slli<1>(arg1)));
2437}
2438
2439//The total number of operations is 33
2440template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::signextendh(bitblock128_t arg1)
2441{
2442        return esimd128<(4)>::mergeh(simd128<(4)>::srai<2>(arg1), simd128<(4)>::srai<2>(simd128<(4)>::slli<2>(arg1)));
2443}
2444
2445//The total number of operations is 13
2446template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::signextendh(bitblock128_t arg1)
2447{
2448        return esimd128<(8)>::mergeh(simd128<(8)>::srai<4>(arg1), simd128<(8)>::srai<4>(simd128<(8)>::slli<4>(arg1)));
2449}
2450
2451//The total number of operations is 4
2452template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::signextendh(bitblock128_t arg1)
2453{
2454        return esimd128<(16)>::mergeh(simd128<(16)>::srai<8>(arg1), simd128<(16)>::srai<8>(simd128<(16)>::slli<8>(arg1)));
2455}
2456
2457//The total number of operations is 4
2458template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::signextendh(bitblock128_t arg1)
2459{
2460        return esimd128<(32)>::mergeh(simd128<(32)>::srai<16>(arg1), simd128<(32)>::srai<16>(simd128<(32)>::slli<16>(arg1)));
2461}
2462
2463//The total number of operations is 12
2464template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::signextendh(bitblock128_t arg1)
2465{
2466        return esimd128<(64)>::mergeh(simd128<(64)>::srai<32>(arg1), simd128<(64)>::srai<32>(simd128<(64)>::slli<32>(arg1)));
2467}
2468
2469//The total number of operations is 21
2470template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::signextendh(bitblock128_t arg1)
2471{
2472        return simd128<(128)>::srai<64>(arg1);
2473}
2474
2475//The total number of operations is 31
2476template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<1>::signextendl(bitblock128_t arg1)
2477{
2478        return esimd128<(2)>::mergel(simd128<(2)>::srai<1>(arg1), simd128<(2)>::srai<1>(simd128<(2)>::slli<1>(arg1)));
2479}
2480
2481//The total number of operations is 33
2482template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<2>::signextendl(bitblock128_t arg1)
2483{
2484        return esimd128<(4)>::mergel(simd128<(4)>::srai<2>(arg1), simd128<(4)>::srai<2>(simd128<(4)>::slli<2>(arg1)));
2485}
2486
2487//The total number of operations is 13
2488template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<4>::signextendl(bitblock128_t arg1)
2489{
2490        return esimd128<(8)>::mergel(simd128<(8)>::srai<4>(arg1), simd128<(8)>::srai<4>(simd128<(8)>::slli<4>(arg1)));
2491}
2492
2493//The total number of operations is 4
2494template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<8>::signextendl(bitblock128_t arg1)
2495{
2496        return esimd128<(16)>::mergel(simd128<(16)>::srai<8>(arg1), simd128<(16)>::srai<8>(simd128<(16)>::slli<8>(arg1)));
2497}
2498
2499//The total number of operations is 4
2500template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<16>::signextendl(bitblock128_t arg1)
2501{
2502        return esimd128<(32)>::mergel(simd128<(32)>::srai<16>(arg1), simd128<(32)>::srai<16>(simd128<(32)>::slli<16>(arg1)));
2503}
2504
2505//The total number of operations is 12
2506template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<32>::signextendl(bitblock128_t arg1)
2507{
2508        return esimd128<(64)>::mergel(simd128<(64)>::srai<32>(arg1), simd128<(64)>::srai<32>(simd128<(64)>::slli<32>(arg1)));
2509}
2510
2511//The total number of operations is 25
2512template <> IDISA_ALWAYS_INLINE bitblock128_t esimd128<64>::signextendl(bitblock128_t arg1)
2513{
2514        return simd128<(128)>::srai<64>(simd128<(128)>::slli<64>(arg1));
2515}
2516
2517//The total number of operations is 17
2518template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::shufflei(bitblock128_t arg1)
2519{
2520        bitblock128_t tmphi = _mm_shufflehi_epi16(arg1, (int32_t)((shufflemask8_to_shufflemask4(msk)>>8)));
2521        bitblock128_t tmpAns = _mm_shufflelo_epi16(tmphi, (int32_t)((shufflemask8_to_shufflemask4(msk)&255)));
2522        bitblock128_t tmplh = _mm_shufflehi_epi16(simd128<128>::slli<64>(arg1), (int32_t)((shufflemask8_to_shufflemask4(msk)>>8)));
2523        bitblock128_t tmphl = _mm_shufflelo_epi16(simd128<128>::srli<64>(arg1), (int32_t)((shufflemask8_to_shufflemask4(msk)&255)));
2524        uint32_t a1 = ((((msk>>21)&4) == 0) ? 0 : (131071));
2525        uint32_t a2 = ((((msk>>18)&4) == 0) ? 0 : (131071));
2526        uint32_t a3 = ((((msk>>15)&4) == 0) ? 0 : (131071));
2527        uint32_t a4 = ((((msk>>12)&4) == 0) ? 0 : (131071));
2528        uint32_t a5 = ((((msk>>9)&4) == 0) ? (131071) : 0);
2529        uint32_t a6 = ((((msk>>6)&4) == 0) ? (131071) : 0);
2530        uint32_t a7 = ((((msk>>3)&4) == 0) ? (131071) : 0);
2531        uint32_t a8 = (((msk&4) == 0) ? (131071) : 0);
2532        return simd128<1>::ifh(mvmd128<16>::fill8(a1, a2, a3, a4, a5, a6, a7, a8), tmpAns, simd_or(tmplh, tmphl));
2533}
2534
2535//The total number of operations is 1
2536template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::shufflei(bitblock128_t arg1)
2537{
2538        return _mm_shuffle_epi32(arg1, (int32_t)(msk));
2539}
2540
2541//The total number of operations is 1
2542template <> template <uint64_t msk> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::shufflei(bitblock128_t arg1)
2543{
2544        return mvmd128<32>::shufflei<shufflemask4_from_shufflemask2(msk)>(arg1);
2545}
2546
2547//The total number of operations is 9
2548template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2549{
2550        return simd_or(mvmd128<2>::srli<sh>(arg1), mvmd128<2>::slli<((64)-sh)>(arg2));
2551}
2552
2553//The total number of operations is 9
2554template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2555{
2556        return simd_or(mvmd128<4>::srli<sh>(arg1), mvmd128<4>::slli<((32)-sh)>(arg2));
2557}
2558
2559//The total number of operations is 9
2560template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2561{
2562        return simd_or(mvmd128<8>::srli<sh>(arg1), mvmd128<8>::slli<((16)-sh)>(arg2));
2563}
2564
2565//The total number of operations is 9
2566template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2567{
2568        return simd_or(mvmd128<16>::srli<sh>(arg1), mvmd128<16>::slli<((8)-sh)>(arg2));
2569}
2570
2571//The total number of operations is 9
2572template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2573{
2574        return simd_or(mvmd128<32>::srli<sh>(arg1), mvmd128<32>::slli<((4)-sh)>(arg2));
2575}
2576
2577//The total number of operations is 9
2578template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2579{
2580        return simd_or(mvmd128<64>::srli<sh>(arg1), mvmd128<64>::slli<((2)-sh)>(arg2));
2581}
2582
2583//The total number of operations is 9
2584template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::dsrli(bitblock128_t arg1, bitblock128_t arg2)
2585{
2586        return simd_or(mvmd128<128>::srli<sh>(arg1), mvmd128<128>::slli<((1)-sh)>(arg2));
2587}
2588
2589//The total number of operations is 1
2590template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill(uint64_t val1)
2591{
2592        return mvmd128<32>::fill((-1*val1));
2593}
2594
2595//The total number of operations is 1
2596template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill(uint64_t val1)
2597{
2598        return mvmd128<(4)>::fill(((val1<<2)|val1));
2599}
2600
2601//The total number of operations is 1
2602template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill(uint64_t val1)
2603{
2604        return mvmd128<(8)>::fill(((val1<<4)|val1));
2605}
2606
2607//The total number of operations is 1
2608template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill(uint64_t val1)
2609{
2610        return _mm_set1_epi8((int32_t)(val1));
2611}
2612
2613//The total number of operations is 1
2614template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill(uint64_t val1)
2615{
2616        return _mm_set1_epi16((int32_t)(val1));
2617}
2618
2619//The total number of operations is 1
2620template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill(uint64_t val1)
2621{
2622        return _mm_set1_epi32((int32_t)(val1));
2623}
2624
2625//The total number of operations is 1
2626template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::fill(uint64_t val1)
2627{
2628        return _mm_set_epi32((int32_t)((val1>>32)), (int32_t)(val1), (int32_t)((val1>>32)), (int32_t)(val1));
2629}
2630
2631//The total number of operations is 1
2632template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::fill(uint64_t val1)
2633{
2634        return _mm_set_epi32((int32_t)(0), (int32_t)(0), (int32_t)((val1>>32)), (int32_t)(val1));
2635}
2636
2637//The total number of operations is 1
2638template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<1>::extract(bitblock128_t arg1)
2639{
2640        return (((pos%2) == 0) ? (mvmd128<(2)>::extract<(pos/2)>(arg1)&(1)) : (mvmd128<(2)>::extract<(pos/2)>(arg1)>>1));
2641}
2642
2643//The total number of operations is 1
2644template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<2>::extract(bitblock128_t arg1)
2645{
2646        return (((pos%2) == 0) ? (mvmd128<(4)>::extract<(pos/2)>(arg1)&(3)) : (mvmd128<(4)>::extract<(pos/2)>(arg1)>>2));
2647}
2648
2649//The total number of operations is 1
2650template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<4>::extract(bitblock128_t arg1)
2651{
2652        return (((pos%2) == 0) ? (mvmd128<(8)>::extract<(pos/2)>(arg1)&(15)) : (mvmd128<(8)>::extract<(pos/2)>(arg1)>>4));
2653}
2654
2655//The total number of operations is 1
2656template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<8>::extract(bitblock128_t arg1)
2657{
2658        return (((pos%2) == 0) ? (mvmd128<(16)>::extract<(pos/2)>(arg1)&(255)) : (mvmd128<(16)>::extract<(pos/2)>(arg1)>>8));
2659}
2660
2661//The total number of operations is 1
2662template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<16>::extract(bitblock128_t arg1)
2663{
2664        return (65535&_mm_extract_epi16(arg1, (int32_t)(pos)));
2665}
2666
2667//The total number of operations is 2
2668template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<32>::extract(bitblock128_t arg1)
2669{
2670        return ((((uint64_t)mvmd128<(16)>::extract<((2*pos)+1)>(arg1))<<(16))|mvmd128<(16)>::extract<(2*pos)>(arg1));
2671}
2672
2673//The total number of operations is 4
2674template <> template <uint64_t pos> IDISA_ALWAYS_INLINE uint64_t mvmd128<64>::extract(bitblock128_t arg1)
2675{
2676        return ((((uint64_t)mvmd128<(32)>::extract<((2*pos)+1)>(arg1))<<(32))|mvmd128<(32)>::extract<(2*pos)>(arg1));
2677}
2678
2679//The total number of operations is 16
2680template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::splat(bitblock128_t arg1)
2681{
2682        return simd128<128>::sub(simd128<128>::constant<0>(), simd_and(simd128<128>::constant<1>(), simd128<128>::srli<pos>(arg1)));
2683}
2684
2685//The total number of operations is 13
2686template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::splat(bitblock128_t arg1)
2687{
2688        bitblock128_t tmpArg = (((pos%2) == 0) ? simd128<(4)>::slli<2>(arg1) : simd128<(4)>::srli<2>(arg1));
2689        bitblock128_t arg11 = (((pos%2) == 0) ? simd_and(simd128<(4)>::lomask(), arg1) : simd_and(simd128<(4)>::himask(), arg1));
2690        return mvmd128<(4)>::splat<(pos/2)>(simd_or(tmpArg, arg11));
2691}
2692
2693//The total number of operations is 9
2694template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::splat(bitblock128_t arg1)
2695{
2696        bitblock128_t tmpArg = (((pos%2) == 0) ? simd128<(8)>::slli<4>(arg1) : simd128<(8)>::srli<4>(arg1));
2697        bitblock128_t arg11 = (((pos%2) == 0) ? simd_and(simd128<(8)>::lomask(), arg1) : simd_and(simd128<(8)>::himask(), arg1));
2698        return mvmd128<(8)>::splat<(pos/2)>(simd_or(tmpArg, arg11));
2699}
2700
2701//The total number of operations is 5
2702template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::splat(bitblock128_t arg1)
2703{
2704        bitblock128_t tmpArg = (((pos%2) == 0) ? simd128<(16)>::slli<8>(arg1) : simd128<(16)>::srli<8>(arg1));
2705        bitblock128_t arg11 = (((pos%2) == 0) ? simd_and(simd128<(16)>::lomask(), arg1) : simd_and(simd128<(16)>::himask(), arg1));
2706        return mvmd128<(16)>::splat<(pos/2)>(simd_or(tmpArg, arg11));
2707}
2708
2709//The total number of operations is 2
2710template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::splat(bitblock128_t arg1)
2711{
2712        return mvmd128<16>::fill(_mm_extract_epi16(arg1, (int32_t)(pos)));
2713}
2714
2715//The total number of operations is 1
2716template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::splat(bitblock128_t arg1)
2717{
2718        return mvmd128<32>::shufflei<shufflemask4(pos, pos, pos, pos)>(arg1);
2719}
2720
2721//The total number of operations is 5
2722template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::splat(bitblock128_t arg1)
2723{
2724        return simd128<1>::ifh(simd128<64>::himask(), mvmd128<(32)>::splat<((2*pos)+1)>(arg1), mvmd128<(32)>::splat<(2*pos)>(arg1));
2725}
2726
2727//The total number of operations is 13
2728template <> template <uint64_t pos> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::splat(bitblock128_t arg1)
2729{
2730        return simd128<1>::ifh(simd128<128>::himask(), mvmd128<(64)>::splat<((2*pos)+1)>(arg1), mvmd128<(64)>::splat<(2*pos)>(arg1));
2731}
2732
2733//The total number of operations is 15
2734template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16)
2735{
2736        return simd_or(mvmd128<(2)>::fill16((val1<<1), (val3<<1), (val5<<1), (val7<<1), (val9<<1), (val11<<1), (val13<<1), (val15<<1), (val1<<1), (val3<<1), (val5<<1), (val7<<1), (val9<<1), (val11<<1), (val13<<1), (val15<<1)), mvmd128<(2)>::fill16((val2&(1)), (val4&(1)), (val6&(1)), (val8&(1)), (val10&(1)), (val12&(1)), (val14&(1)), (val16&(1)), (val2&(1)), (val4&(1)), (val6&(1)), (val8&(1)), (val10&(1)), (val12&(1)), (val14&(1)), (val16&(1))));
2737}
2738
2739//The total number of operations is 7
2740template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16)
2741{
2742        return simd_or(mvmd128<(4)>::fill16((val1<<2), (val3<<2), (val5<<2), (val7<<2), (val9<<2), (val11<<2), (val13<<2), (val15<<2), (val1<<2), (val3<<2), (val5<<2), (val7<<2), (val9<<2), (val11<<2), (val13<<2), (val15<<2)), mvmd128<(4)>::fill16((val2&(3)), (val4&(3)), (val6&(3)), (val8&(3)), (val10&(3)), (val12&(3)), (val14&(3)), (val16&(3)), (val2&(3)), (val4&(3)), (val6&(3)), (val8&(3)), (val10&(3)), (val12&(3)), (val14&(3)), (val16&(3))));
2743}
2744
2745//The total number of operations is 3
2746template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16)
2747{
2748        return simd_or(mvmd128<(8)>::fill16((val1<<4), (val3<<4), (val5<<4), (val7<<4), (val9<<4), (val11<<4), (val13<<4), (val15<<4), (val1<<4), (val3<<4), (val5<<4), (val7<<4), (val9<<4), (val11<<4), (val13<<4), (val15<<4)), mvmd128<(8)>::fill16((val2&(15)), (val4&(15)), (val6&(15)), (val8&(15)), (val10&(15)), (val12&(15)), (val14&(15)), (val16&(15)), (val2&(15)), (val4&(15)), (val6&(15)), (val8&(15)), (val10&(15)), (val12&(15)), (val14&(15)), (val16&(15))));
2749}
2750
2751//The total number of operations is 1
2752template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill16(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8, uint64_t val9, uint64_t val10, uint64_t val11, uint64_t val12, uint64_t val13, uint64_t val14, uint64_t val15, uint64_t val16)
2753{
2754        return _mm_set_epi8((int32_t)(val1), (int32_t)(val2), (int32_t)(val3), (int32_t)(val4), (int32_t)(val5), (int32_t)(val6), (int32_t)(val7), (int32_t)(val8), (int32_t)(val9), (int32_t)(val10), (int32_t)(val11), (int32_t)(val12), (int32_t)(val13), (int32_t)(val14), (int32_t)(val15), (int32_t)(val16));
2755}
2756
2757//The total number of operations is 4
2758template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::slli(bitblock128_t arg1)
2759{
2760        return simd128<128>::slli<(sh*2)>(arg1);
2761}
2762
2763//The total number of operations is 4
2764template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::slli(bitblock128_t arg1)
2765{
2766        return simd128<128>::slli<(sh*4)>(arg1);
2767}
2768
2769//The total number of operations is 4
2770template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::slli(bitblock128_t arg1)
2771{
2772        return simd128<128>::slli<(sh*8)>(arg1);
2773}
2774
2775//The total number of operations is 4
2776template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::slli(bitblock128_t arg1)
2777{
2778        return simd128<128>::slli<(sh*16)>(arg1);
2779}
2780
2781//The total number of operations is 4
2782template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::slli(bitblock128_t arg1)
2783{
2784        return simd128<128>::slli<(sh*32)>(arg1);
2785}
2786
2787//The total number of operations is 4
2788template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::slli(bitblock128_t arg1)
2789{
2790        return simd128<128>::slli<(sh*64)>(arg1);
2791}
2792
2793//The total number of operations is 4
2794template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::slli(bitblock128_t arg1)
2795{
2796        return simd128<128>::slli<(sh*128)>(arg1);
2797}
2798
2799//The total number of operations is 5
2800template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2801{
2802        return simd128<1>::ifh(simd128<(4)>::himask(), mvmd128<1>::fill2(val1, val2), mvmd128<1>::fill2(val3, val4));
2803}
2804
2805//The total number of operations is 5
2806template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2807{
2808        return simd128<1>::ifh(simd128<(8)>::himask(), mvmd128<2>::fill2(val1, val2), mvmd128<2>::fill2(val3, val4));
2809}
2810
2811//The total number of operations is 5
2812template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2813{
2814        return simd128<1>::ifh(simd128<(16)>::himask(), mvmd128<4>::fill2(val1, val2), mvmd128<4>::fill2(val3, val4));
2815}
2816
2817//The total number of operations is 5
2818template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2819{
2820        return simd128<1>::ifh(simd128<(32)>::himask(), mvmd128<8>::fill2(val1, val2), mvmd128<8>::fill2(val3, val4));
2821}
2822
2823//The total number of operations is 3
2824template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2825{
2826        return simd_or(mvmd128<(32)>::fill4((val1<<16), (val3<<16), (val1<<16), (val3<<16)), mvmd128<(32)>::fill4((val2&(65535)), (val4&(65535)), (val2&(65535)), (val4&(65535))));
2827}
2828
2829//The total number of operations is 1
2830template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill4(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4)
2831{
2832        return _mm_set_epi32((int32_t)(val1), (int32_t)(val2), (int32_t)(val3), (int32_t)(val4));
2833}
2834
2835//The total number of operations is 4
2836template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::srli(bitblock128_t arg1)
2837{
2838        return simd128<128>::srli<(sh*2)>(arg1);
2839}
2840
2841//The total number of operations is 4
2842template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::srli(bitblock128_t arg1)
2843{
2844        return simd128<128>::srli<(sh*4)>(arg1);
2845}
2846
2847//The total number of operations is 4
2848template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::srli(bitblock128_t arg1)
2849{
2850        return simd128<128>::srli<(sh*8)>(arg1);
2851}
2852
2853//The total number of operations is 4
2854template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::srli(bitblock128_t arg1)
2855{
2856        return simd128<128>::srli<(sh*16)>(arg1);
2857}
2858
2859//The total number of operations is 4
2860template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::srli(bitblock128_t arg1)
2861{
2862        return simd128<128>::srli<(sh*32)>(arg1);
2863}
2864
2865//The total number of operations is 4
2866template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::srli(bitblock128_t arg1)
2867{
2868        return simd128<128>::srli<(sh*64)>(arg1);
2869}
2870
2871//The total number of operations is 4
2872template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::srli(bitblock128_t arg1)
2873{
2874        return simd128<128>::srli<(sh*128)>(arg1);
2875}
2876
2877//The total number of operations is 1
2878template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill2(uint64_t val1, uint64_t val2)
2879{
2880        return mvmd128<(2)>::fill(((val1<<1)|(val2&(1))));
2881}
2882
2883//The total number of operations is 1
2884template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill2(uint64_t val1, uint64_t val2)
2885{
2886        return mvmd128<(4)>::fill(((val1<<2)|(val2&(3))));
2887}
2888
2889//The total number of operations is 1
2890template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill2(uint64_t val1, uint64_t val2)
2891{
2892        return mvmd128<(8)>::fill(((val1<<4)|(val2&(15))));
2893}
2894
2895//The total number of operations is 1
2896template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill2(uint64_t val1, uint64_t val2)
2897{
2898        return mvmd128<(16)>::fill(((val1<<8)|(val2&(255))));
2899}
2900
2901//The total number of operations is 1
2902template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill2(uint64_t val1, uint64_t val2)
2903{
2904        return mvmd128<(32)>::fill(((val1<<16)|(val2&(65535))));
2905}
2906
2907//The total number of operations is 5
2908template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::fill2(uint64_t val1, uint64_t val2)
2909{
2910        return simd128<1>::ifh(simd128<(64)>::himask(), mvmd128<32>::fill(val1), mvmd128<32>::fill(val2));
2911}
2912
2913//The total number of operations is 5
2914template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::fill2(uint64_t val1, uint64_t val2)
2915{
2916        return simd128<1>::ifh(simd128<(128)>::himask(), mvmd128<64>::fill(val1), mvmd128<64>::fill(val2));
2917}
2918
2919//The total number of operations is 9
2920template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2921{
2922        return simd_or(mvmd128<2>::slli<sh>(arg1), mvmd128<2>::srli<((64)-sh)>(arg2));
2923}
2924
2925//The total number of operations is 9
2926template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2927{
2928        return simd_or(mvmd128<4>::slli<sh>(arg1), mvmd128<4>::srli<((32)-sh)>(arg2));
2929}
2930
2931//The total number of operations is 9
2932template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2933{
2934        return simd_or(mvmd128<8>::slli<sh>(arg1), mvmd128<8>::srli<((16)-sh)>(arg2));
2935}
2936
2937//The total number of operations is 9
2938template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2939{
2940        return simd_or(mvmd128<16>::slli<sh>(arg1), mvmd128<16>::srli<((8)-sh)>(arg2));
2941}
2942
2943//The total number of operations is 9
2944template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<32>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2945{
2946        return simd_or(mvmd128<32>::slli<sh>(arg1), mvmd128<32>::srli<((4)-sh)>(arg2));
2947}
2948
2949//The total number of operations is 9
2950template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<64>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2951{
2952        return simd_or(mvmd128<64>::slli<sh>(arg1), mvmd128<64>::srli<((2)-sh)>(arg2));
2953}
2954
2955//The total number of operations is 9
2956template <> template <uint64_t sh> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<128>::dslli(bitblock128_t arg1, bitblock128_t arg2)
2957{
2958        return simd_or(mvmd128<128>::slli<sh>(arg1), mvmd128<128>::srli<((1)-sh)>(arg2));
2959}
2960
2961//The total number of operations is 13
2962template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<1>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8)
2963{
2964        return simd128<1>::ifh(simd128<(8)>::himask(), mvmd128<1>::fill4(val1, val2, val3, val4), mvmd128<1>::fill4(val5, val6, val7, val8));
2965}
2966
2967//The total number of operations is 13
2968template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<2>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8)
2969{
2970        return simd128<1>::ifh(simd128<(16)>::himask(), mvmd128<2>::fill4(val1, val2, val3, val4), mvmd128<2>::fill4(val5, val6, val7, val8));
2971}
2972
2973//The total number of operations is 7
2974template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<4>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8)
2975{
2976        return simd_or(mvmd128<(8)>::fill8((val1<<4), (val3<<4), (val5<<4), (val7<<4), (val1<<4), (val3<<4), (val5<<4), (val7<<4)), mvmd128<(8)>::fill8((val2&(15)), (val4&(15)), (val6&(15)), (val8&(15)), (val2&(15)), (val4&(15)), (val6&(15)), (val8&(15))));
2977}
2978
2979//The total number of operations is 3
2980template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<8>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8)
2981{
2982        return simd_or(mvmd128<(16)>::fill8((val1<<8), (val3<<8), (val5<<8), (val7<<8), (val1<<8), (val3<<8), (val5<<8), (val7<<8)), mvmd128<(16)>::fill8((val2&(255)), (val4&(255)), (val6&(255)), (val8&(255)), (val2&(255)), (val4&(255)), (val6&(255)), (val8&(255))));
2983}
2984
2985//The total number of operations is 1
2986template <> IDISA_ALWAYS_INLINE bitblock128_t mvmd128<16>::fill8(uint64_t val1, uint64_t val2, uint64_t val3, uint64_t val4, uint64_t val5, uint64_t val6, uint64_t val7, uint64_t val8)
2987{
2988        return _mm_set_epi16((int32_t)(val1), (int32_t)(val2), (int32_t)(val3), (int32_t)(val4), (int32_t)(val5), (int32_t)(val6), (int32_t)(val7), (int32_t)(val8));
2989}
2990
2991//The total number of operations is 22
2992IDISA_ALWAYS_INLINE uint64_t bitblock128::popcount(bitblock128_t arg1)
2993{
2994        return mvmd128<64>::extract<0>(simd128<128>::popcount(arg1));
2995}
2996
2997//The total number of operations is 2
2998IDISA_ALWAYS_INLINE bool bitblock128::all(bitblock128_t arg1)
2999{
3000        return hsimd128<8>::signmask(simd128<8>::eq(arg1, simd128<8>::constant<-1>())) == 65535;
3001}
3002
3003//The total number of operations is 2
3004IDISA_ALWAYS_INLINE bool bitblock128::any(bitblock128_t arg1)
3005{
3006        return hsimd128<8>::signmask(simd128<8>::eq(arg1, simd128<8>::constant<0>())) != 65535;
3007}
3008
3009#endif
Note: See TracBrowser for help on using the repository browser.