source: trunk/lib/idisa_cpp/idisa_sse4_2.cpp @ 1570

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

bitblock::(load,store) (aligned,unaligned); <1>::add, sub

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