Coverage Report

Created: 2024-07-25 06:36

/src/highwayhash/highwayhash/vector128.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2016 Google Inc. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef HIGHWAYHASH_VECTOR128_H_
16
#define HIGHWAYHASH_VECTOR128_H_
17
18
// Defines SIMD vector classes ("V2x64U") with overloaded arithmetic operators:
19
// const V2x64U masked_sum = (a + b) & m;
20
// This is shorter and more readable than compiler intrinsics:
21
// const __m128i masked_sum = _mm_and_si128(_mm_add_epi64(a, b), m);
22
// There is typically no runtime cost for these abstractions.
23
//
24
// The naming convention is VNxBBT where N is the number of lanes, BB the
25
// number of bits per lane and T is the lane type: unsigned integer (U),
26
// signed integer (I), or floating-point (F).
27
28
// WARNING: this is a "restricted" header because it is included from
29
// translation units compiled with different flags. This header and its
30
// dependencies must not define any function unless it is static inline and/or
31
// within namespace HH_TARGET_NAME. See arch_specific.h for details.
32
33
#include <stddef.h>
34
#include <stdint.h>
35
36
#include "highwayhash/arch_specific.h"
37
#include "highwayhash/compiler_specific.h"
38
39
// For auto-dependency generation, we need to include all headers but not their
40
// contents (otherwise compilation fails because -msse4.1 is not specified).
41
#ifndef HH_DISABLE_TARGET_SPECIFIC
42
43
// WARNING: smmintrin.h will also be included through immintrin.h in the AVX2
44
// translation unit, which is compiled with different flags. This risks ODR
45
// violations, and can cause crashes when functions are not inlined and the
46
// linker selects the AVX2 version. Unfortunately this include cannot reside
47
// within a namespace due to conflicts with other system headers. We need to
48
// assume all the intrinsic functions (defined as static inline by Clang's
49
// library and as extern inline by GCC) are in fact inlined. targets.bzl
50
// generates a test that verifies this by detecting duplicate symbols.
51
#include <smmintrin.h>  // SSE4.1
52
53
namespace highwayhash {
54
// To prevent ODR violations when including this from multiple translation
55
// units (TU) that are compiled with different flags, the contents must reside
56
// in a namespace whose name is unique to the TU. NOTE: this behavior is
57
// incompatible with precompiled modules and requires textual inclusion instead.
58
namespace HH_TARGET_NAME {
59
60
// Primary template for 128-bit SSE4.1 vectors; only specializations are used.
61
template <typename T>
62
class V128 {};
63
64
template <>
65
class V128<uint8_t> {
66
 public:
67
  using Intrinsic = __m128i;
68
  using T = uint8_t;
69
  static constexpr size_t N = 16;
70
71
  // Leaves v_ uninitialized - typically used for output parameters.
72
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::V128()
73
74
  // Broadcasts i to all lanes (usually by loading from memory).
75
0
  HH_INLINE explicit V128(T i) : v_(_mm_set1_epi8(i)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::V128(unsigned char)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::V128(unsigned char)
76
77
  // Copy from other vector.
78
0
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::V128(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::V128(highwayhash::SSE41::V128<unsigned char> const&)
79
  template <typename U>
80
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
81
0
  HH_INLINE V128& operator=(const V128& other) {
82
0
    v_ = other.v_;
83
0
    return *this;
84
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator=(highwayhash::SSE41::V128<unsigned char> const&)
85
86
  // Convert from/to intrinsics.
87
0
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::V128(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::V128(long long __vector(2) const&)
88
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
89
0
    v_ = v;
90
0
    return *this;
91
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator=(long long __vector(2) const&)
92
0
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator long long __vector(2)() const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator long long __vector(2)() const
93
94
  // There are no greater-than comparison instructions for unsigned T.
95
0
  HH_INLINE V128 operator==(const V128& other) const {
96
0
    return V128(_mm_cmpeq_epi8(v_, other.v_));
97
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator==(highwayhash::AVX2::V128<unsigned char> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator==(highwayhash::SSE41::V128<unsigned char> const&) const
98
99
0
  HH_INLINE V128& operator+=(const V128& other) {
100
0
    v_ = _mm_add_epi8(v_, other.v_);
101
0
    return *this;
102
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator+=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator+=(highwayhash::SSE41::V128<unsigned char> const&)
103
0
  HH_INLINE V128& operator-=(const V128& other) {
104
0
    v_ = _mm_sub_epi8(v_, other.v_);
105
0
    return *this;
106
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator-=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator-=(highwayhash::SSE41::V128<unsigned char> const&)
107
108
0
  HH_INLINE V128& operator&=(const V128& other) {
109
0
    v_ = _mm_and_si128(v_, other.v_);
110
0
    return *this;
111
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator&=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator&=(highwayhash::SSE41::V128<unsigned char> const&)
112
0
  HH_INLINE V128& operator|=(const V128& other) {
113
0
    v_ = _mm_or_si128(v_, other.v_);
114
0
    return *this;
115
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator|=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator|=(highwayhash::SSE41::V128<unsigned char> const&)
116
0
  HH_INLINE V128& operator^=(const V128& other) {
117
0
    v_ = _mm_xor_si128(v_, other.v_);
118
0
    return *this;
119
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char>::operator^=(highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char>::operator^=(highwayhash::SSE41::V128<unsigned char> const&)
120
121
 private:
122
  Intrinsic v_;
123
};
124
125
template <>
126
class V128<uint16_t> {
127
 public:
128
  using Intrinsic = __m128i;
129
  using T = uint16_t;
130
  static constexpr size_t N = 8;
131
132
  // Leaves v_ uninitialized - typically used for output parameters.
133
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::V128()
134
135
  // Lane 0 (p_0) is the lowest.
136
  HH_INLINE V128(T p_7, T p_6, T p_5, T p_4, T p_3, T p_2, T p_1, T p_0)
137
0
      : v_(_mm_set_epi16(p_7, p_6, p_5, p_4, p_3, p_2, p_1, p_0)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::V128(unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::V128(unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short, unsigned short)
138
139
  // Broadcasts i to all lanes (usually by loading from memory).
140
0
  HH_INLINE explicit V128(T i) : v_(_mm_set1_epi16(i)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::V128(unsigned short)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::V128(unsigned short)
141
142
  // Copy from other vector.
143
0
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::V128(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::V128(highwayhash::SSE41::V128<unsigned short> const&)
144
  template <typename U>
145
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
146
0
  HH_INLINE V128& operator=(const V128& other) {
147
0
    v_ = other.v_;
148
0
    return *this;
149
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator=(highwayhash::SSE41::V128<unsigned short> const&)
150
151
  // Convert from/to intrinsics.
152
0
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::V128(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::V128(long long __vector(2) const&)
153
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
154
0
    v_ = v;
155
0
    return *this;
156
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator=(long long __vector(2) const&)
157
0
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator long long __vector(2)() const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator long long __vector(2)() const
158
159
  // There are no greater-than comparison instructions for unsigned T.
160
0
  HH_INLINE V128 operator==(const V128& other) const {
161
0
    return V128(_mm_cmpeq_epi16(v_, other.v_));
162
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator==(highwayhash::AVX2::V128<unsigned short> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator==(highwayhash::SSE41::V128<unsigned short> const&) const
163
164
0
  HH_INLINE V128& operator+=(const V128& other) {
165
0
    v_ = _mm_add_epi16(v_, other.v_);
166
0
    return *this;
167
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator+=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator+=(highwayhash::SSE41::V128<unsigned short> const&)
168
0
  HH_INLINE V128& operator-=(const V128& other) {
169
0
    v_ = _mm_sub_epi16(v_, other.v_);
170
0
    return *this;
171
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator-=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator-=(highwayhash::SSE41::V128<unsigned short> const&)
172
173
0
  HH_INLINE V128& operator&=(const V128& other) {
174
0
    v_ = _mm_and_si128(v_, other.v_);
175
0
    return *this;
176
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator&=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator&=(highwayhash::SSE41::V128<unsigned short> const&)
177
0
  HH_INLINE V128& operator|=(const V128& other) {
178
0
    v_ = _mm_or_si128(v_, other.v_);
179
0
    return *this;
180
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator|=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator|=(highwayhash::SSE41::V128<unsigned short> const&)
181
0
  HH_INLINE V128& operator^=(const V128& other) {
182
0
    v_ = _mm_xor_si128(v_, other.v_);
183
0
    return *this;
184
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator^=(highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator^=(highwayhash::SSE41::V128<unsigned short> const&)
185
186
0
  HH_INLINE V128& operator<<=(const int count) {
187
0
    v_ = _mm_slli_epi16(v_, count);
188
0
    return *this;
189
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator<<=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator<<=(int)
190
0
  HH_INLINE V128& operator<<=(const Intrinsic& count) {
191
0
    v_ = _mm_sll_epi16(v_, count);
192
0
    return *this;
193
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator<<=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator<<=(long long __vector(2) const&)
194
195
0
  HH_INLINE V128& operator>>=(const int count) {
196
0
    v_ = _mm_srli_epi16(v_, count);
197
0
    return *this;
198
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator>>=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator>>=(int)
199
0
  HH_INLINE V128& operator>>=(const Intrinsic& count) {
200
0
    v_ = _mm_srl_epi16(v_, count);
201
0
    return *this;
202
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short>::operator>>=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short>::operator>>=(long long __vector(2) const&)
203
204
 private:
205
  Intrinsic v_;
206
};
207
208
template <>
209
class V128<uint32_t> {
210
 public:
211
  using Intrinsic = __m128i;
212
  using T = uint32_t;
213
  static constexpr size_t N = 4;
214
215
  // Leaves v_ uninitialized - typically used for output parameters.
216
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::V128()
217
218
  // Lane 0 (p_0) is the lowest.
219
  HH_INLINE V128(T p_3, T p_2, T p_1, T p_0)
220
21
      : v_(_mm_set_epi32(p_3, p_2, p_1, p_0)) {}
highwayhash::AVX2::V128<unsigned int>::V128(unsigned int, unsigned int, unsigned int, unsigned int)
Line
Count
Source
220
21
      : v_(_mm_set_epi32(p_3, p_2, p_1, p_0)) {}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::V128(unsigned int, unsigned int, unsigned int, unsigned int)
221
222
  // Broadcasts i to all lanes (usually by loading from memory).
223
0
  HH_INLINE explicit V128(T i) : v_(_mm_set1_epi32(i)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::V128(unsigned int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::V128(unsigned int)
224
225
  // Copy from other vector.
226
0
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::V128(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::V128(highwayhash::SSE41::V128<unsigned int> const&)
227
  template <typename U>
228
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
229
0
  HH_INLINE V128& operator=(const V128& other) {
230
0
    v_ = other.v_;
231
0
    return *this;
232
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator=(highwayhash::SSE41::V128<unsigned int> const&)
233
234
  // Convert from/to intrinsics.
235
100
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
highwayhash::AVX2::V128<unsigned int>::V128(long long __vector(2) const&)
Line
Count
Source
235
100
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::V128(long long __vector(2) const&)
236
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
237
0
    v_ = v;
238
0
    return *this;
239
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator=(long long __vector(2) const&)
240
121
  HH_INLINE operator Intrinsic() const { return v_; }
highwayhash::AVX2::V128<unsigned int>::operator long long __vector(2)() const
Line
Count
Source
240
121
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator long long __vector(2)() const
241
242
  // There are no greater-than comparison instructions for unsigned T.
243
0
  HH_INLINE V128 operator==(const V128& other) const {
244
0
    return V128(_mm_cmpeq_epi32(v_, other.v_));
245
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator==(highwayhash::AVX2::V128<unsigned int> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator==(highwayhash::SSE41::V128<unsigned int> const&) const
246
247
0
  HH_INLINE V128& operator+=(const V128& other) {
248
0
    v_ = _mm_add_epi32(v_, other.v_);
249
0
    return *this;
250
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator+=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator+=(highwayhash::SSE41::V128<unsigned int> const&)
251
0
  HH_INLINE V128& operator-=(const V128& other) {
252
0
    v_ = _mm_sub_epi32(v_, other.v_);
253
0
    return *this;
254
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator-=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator-=(highwayhash::SSE41::V128<unsigned int> const&)
255
256
0
  HH_INLINE V128& operator&=(const V128& other) {
257
0
    v_ = _mm_and_si128(v_, other.v_);
258
0
    return *this;
259
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator&=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator&=(highwayhash::SSE41::V128<unsigned int> const&)
260
0
  HH_INLINE V128& operator|=(const V128& other) {
261
0
    v_ = _mm_or_si128(v_, other.v_);
262
0
    return *this;
263
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator|=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator|=(highwayhash::SSE41::V128<unsigned int> const&)
264
0
  HH_INLINE V128& operator^=(const V128& other) {
265
0
    v_ = _mm_xor_si128(v_, other.v_);
266
0
    return *this;
267
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator^=(highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator^=(highwayhash::SSE41::V128<unsigned int> const&)
268
269
0
  HH_INLINE V128& operator<<=(const int count) {
270
0
    v_ = _mm_slli_epi32(v_, count);
271
0
    return *this;
272
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator<<=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator<<=(int)
273
0
  HH_INLINE V128& operator<<=(const Intrinsic& count) {
274
0
    v_ = _mm_sll_epi32(v_, count);
275
0
    return *this;
276
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator<<=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator<<=(long long __vector(2) const&)
277
278
0
  HH_INLINE V128& operator>>=(const int count) {
279
0
    v_ = _mm_srli_epi32(v_, count);
280
0
    return *this;
281
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator>>=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator>>=(int)
282
0
  HH_INLINE V128& operator>>=(const Intrinsic& count) {
283
0
    v_ = _mm_srl_epi32(v_, count);
284
0
    return *this;
285
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int>::operator>>=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int>::operator>>=(long long __vector(2) const&)
286
287
 private:
288
  Intrinsic v_;
289
};
290
291
template <>
292
class V128<uint64_t> {
293
 public:
294
  using Intrinsic = __m128i;
295
  using T = uint64_t;
296
  static constexpr size_t N = 2;
297
298
  // Leaves v_ uninitialized - typically used for output parameters.
299
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::V128()
300
301
  // Lane 0 (p_0) is the lowest.
302
0
  HH_INLINE V128(T p_1, T p_0) : v_(_mm_set_epi64x(p_1, p_0)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::V128(unsigned long, unsigned long)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::V128(unsigned long, unsigned long)
303
304
  // Broadcasts i to all lanes (usually by loading from memory).
305
0
  HH_INLINE explicit V128(T i) : v_(_mm_set_epi64x(i, i)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::V128(unsigned long)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::V128(unsigned long)
306
307
  // Copy from other vector.
308
48
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
highwayhash::AVX2::V128<unsigned long>::V128(highwayhash::AVX2::V128<unsigned long> const&)
Line
Count
Source
308
48
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::V128(highwayhash::SSE41::V128<unsigned long> const&)
309
  template <typename U>
310
0
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
311
0
  HH_INLINE V128& operator=(const V128& other) {
312
0
    v_ = other.v_;
313
0
    return *this;
314
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator=(highwayhash::AVX2::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator=(highwayhash::SSE41::V128<unsigned long> const&)
315
316
  // Convert from/to intrinsics.
317
144
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
highwayhash::AVX2::V128<unsigned long>::V128(long long __vector(2) const&)
Line
Count
Source
317
144
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::V128(long long __vector(2) const&)
318
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
319
0
    v_ = v;
320
0
    return *this;
321
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator=(long long __vector(2) const&)
322
96
  HH_INLINE operator Intrinsic() const { return v_; }
highwayhash::AVX2::V128<unsigned long>::operator long long __vector(2)() const
Line
Count
Source
322
96
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator long long __vector(2)() const
323
324
  // There are no greater-than comparison instructions for unsigned T.
325
0
  HH_INLINE V128 operator==(const V128& other) const {
326
0
    return V128(_mm_cmpeq_epi64(v_, other.v_));
327
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator==(highwayhash::AVX2::V128<unsigned long> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator==(highwayhash::SSE41::V128<unsigned long> const&) const
328
329
48
  HH_INLINE V128& operator+=(const V128& other) {
330
48
    v_ = _mm_add_epi64(v_, other.v_);
331
48
    return *this;
332
48
  }
highwayhash::AVX2::V128<unsigned long>::operator+=(highwayhash::AVX2::V128<unsigned long> const&)
Line
Count
Source
329
48
  HH_INLINE V128& operator+=(const V128& other) {
330
48
    v_ = _mm_add_epi64(v_, other.v_);
331
48
    return *this;
332
48
  }
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator+=(highwayhash::SSE41::V128<unsigned long> const&)
333
0
  HH_INLINE V128& operator-=(const V128& other) {
334
0
    v_ = _mm_sub_epi64(v_, other.v_);
335
0
    return *this;
336
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator-=(highwayhash::AVX2::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator-=(highwayhash::SSE41::V128<unsigned long> const&)
337
338
0
  HH_INLINE V128& operator&=(const V128& other) {
339
0
    v_ = _mm_and_si128(v_, other.v_);
340
0
    return *this;
341
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator&=(highwayhash::AVX2::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator&=(highwayhash::SSE41::V128<unsigned long> const&)
342
0
  HH_INLINE V128& operator|=(const V128& other) {
343
0
    v_ = _mm_or_si128(v_, other.v_);
344
0
    return *this;
345
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator|=(highwayhash::AVX2::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator|=(highwayhash::SSE41::V128<unsigned long> const&)
346
0
  HH_INLINE V128& operator^=(const V128& other) {
347
0
    v_ = _mm_xor_si128(v_, other.v_);
348
0
    return *this;
349
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator^=(highwayhash::AVX2::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator^=(highwayhash::SSE41::V128<unsigned long> const&)
350
351
0
  HH_INLINE V128& operator<<=(const int count) {
352
0
    v_ = _mm_slli_epi64(v_, count);
353
0
    return *this;
354
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator<<=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator<<=(int)
355
0
  HH_INLINE V128& operator<<=(const Intrinsic& count) {
356
0
    v_ = _mm_sll_epi64(v_, count);
357
0
    return *this;
358
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator<<=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator<<=(long long __vector(2) const&)
359
360
0
  HH_INLINE V128& operator>>=(const int count) {
361
0
    v_ = _mm_srli_epi64(v_, count);
362
0
    return *this;
363
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator>>=(int)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator>>=(int)
364
0
  HH_INLINE V128& operator>>=(const Intrinsic& count) {
365
0
    v_ = _mm_srl_epi64(v_, count);
366
0
    return *this;
367
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long>::operator>>=(long long __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long>::operator>>=(long long __vector(2) const&)
368
369
 private:
370
  Intrinsic v_;
371
};
372
373
template <>
374
class V128<float> {
375
 public:
376
  using Intrinsic = __m128;
377
  using T = float;
378
  static constexpr size_t N = 4;
379
380
  // Leaves v_ uninitialized - typically used for output parameters.
381
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<float>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<float>::V128()
382
383
  // Lane 0 (p_0) is the lowest.
384
  HH_INLINE V128(T p_3, T p_2, T p_1, T p_0)
385
0
      : v_(_mm_set_ps(p_3, p_2, p_1, p_0)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<float>::V128(float, float, float, float)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::V128(float, float, float, float)
386
387
  // Broadcasts to all lanes.
388
0
  HH_INLINE explicit V128(T f) : v_(_mm_set1_ps(f)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<float>::V128(float)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::V128(float)
389
390
  // Copy from other vector.
391
0
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::AVX2::V128<float>::V128(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::V128(highwayhash::SSE41::V128<float> const&)
392
  template <typename U>
393
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
394
0
  HH_INLINE V128& operator=(const V128& other) {
395
0
    v_ = other.v_;
396
0
    return *this;
397
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator=(highwayhash::SSE41::V128<float> const&)
398
399
  // Convert from/to intrinsics.
400
0
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::AVX2::V128<float>::V128(float __vector(4) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::V128(float __vector(4) const&)
401
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
402
0
    v_ = v;
403
0
    return *this;
404
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator=(float __vector(4) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator=(float __vector(4) const&)
405
0
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator float __vector(4)() const
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator float __vector(4)() const
406
407
0
  HH_INLINE V128 operator==(const V128& other) const {
408
0
    return V128(_mm_cmpeq_ps(v_, other.v_));
409
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator==(highwayhash::AVX2::V128<float> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator==(highwayhash::SSE41::V128<float> const&) const
410
0
  HH_INLINE V128 operator<(const V128& other) const {
411
0
    return V128(_mm_cmplt_ps(v_, other.v_));
412
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator<(highwayhash::AVX2::V128<float> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator<(highwayhash::SSE41::V128<float> const&) const
413
0
  HH_INLINE V128 operator>(const V128& other) const {
414
0
    return V128(_mm_cmplt_ps(other.v_, v_));
415
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator>(highwayhash::AVX2::V128<float> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator>(highwayhash::SSE41::V128<float> const&) const
416
417
0
  HH_INLINE V128& operator*=(const V128& other) {
418
0
    v_ = _mm_mul_ps(v_, other.v_);
419
0
    return *this;
420
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator*=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator*=(highwayhash::SSE41::V128<float> const&)
421
0
  HH_INLINE V128& operator/=(const V128& other) {
422
0
    v_ = _mm_div_ps(v_, other.v_);
423
0
    return *this;
424
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator/=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator/=(highwayhash::SSE41::V128<float> const&)
425
0
  HH_INLINE V128& operator+=(const V128& other) {
426
0
    v_ = _mm_add_ps(v_, other.v_);
427
0
    return *this;
428
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator+=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator+=(highwayhash::SSE41::V128<float> const&)
429
0
  HH_INLINE V128& operator-=(const V128& other) {
430
0
    v_ = _mm_sub_ps(v_, other.v_);
431
0
    return *this;
432
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator-=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator-=(highwayhash::SSE41::V128<float> const&)
433
434
0
  HH_INLINE V128& operator&=(const V128& other) {
435
0
    v_ = _mm_and_ps(v_, other.v_);
436
0
    return *this;
437
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator&=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator&=(highwayhash::SSE41::V128<float> const&)
438
0
  HH_INLINE V128& operator|=(const V128& other) {
439
0
    v_ = _mm_or_ps(v_, other.v_);
440
0
    return *this;
441
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator|=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator|=(highwayhash::SSE41::V128<float> const&)
442
0
  HH_INLINE V128& operator^=(const V128& other) {
443
0
    v_ = _mm_xor_ps(v_, other.v_);
444
0
    return *this;
445
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<float>::operator^=(highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float>::operator^=(highwayhash::SSE41::V128<float> const&)
446
447
 private:
448
  Intrinsic v_;
449
};
450
451
template <>
452
class V128<double> {
453
 public:
454
  using Intrinsic = __m128d;
455
  using T = double;
456
  static constexpr size_t N = 2;
457
458
  // Leaves v_ uninitialized - typically used for output parameters.
459
0
  HH_INLINE V128() {}
Unexecuted instantiation: highwayhash::AVX2::V128<double>::V128()
Unexecuted instantiation: highwayhash::SSE41::V128<double>::V128()
460
461
  // Lane 0 (p_0) is the lowest.
462
0
  HH_INLINE V128(T p_1, T p_0) : v_(_mm_set_pd(p_1, p_0)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<double>::V128(double, double)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::V128(double, double)
463
464
  // Broadcasts to all lanes.
465
0
  HH_INLINE explicit V128(T f) : v_(_mm_set1_pd(f)) {}
Unexecuted instantiation: highwayhash::AVX2::V128<double>::V128(double)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::V128(double)
466
467
  // Copy from other vector.
468
0
  HH_INLINE explicit V128(const V128& other) : v_(other.v_) {}
Unexecuted instantiation: highwayhash::AVX2::V128<double>::V128(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::V128(highwayhash::SSE41::V128<double> const&)
469
  template <typename U>
470
  HH_INLINE explicit V128(const V128<U>& other) : v_(other) {}
471
0
  HH_INLINE V128& operator=(const V128& other) {
472
0
    v_ = other.v_;
473
0
    return *this;
474
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator=(highwayhash::SSE41::V128<double> const&)
475
476
  // Convert from/to intrinsics.
477
0
  HH_INLINE V128(const Intrinsic& v) : v_(v) {}
Unexecuted instantiation: highwayhash::AVX2::V128<double>::V128(double __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::V128(double __vector(2) const&)
478
0
  HH_INLINE V128& operator=(const Intrinsic& v) {
479
0
    v_ = v;
480
0
    return *this;
481
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator=(double __vector(2) const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator=(double __vector(2) const&)
482
0
  HH_INLINE operator Intrinsic() const { return v_; }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator double __vector(2)() const
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator double __vector(2)() const
483
484
0
  HH_INLINE V128 operator==(const V128& other) const {
485
0
    return V128(_mm_cmpeq_pd(v_, other.v_));
486
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator==(highwayhash::AVX2::V128<double> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator==(highwayhash::SSE41::V128<double> const&) const
487
0
  HH_INLINE V128 operator<(const V128& other) const {
488
0
    return V128(_mm_cmplt_pd(v_, other.v_));
489
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator<(highwayhash::AVX2::V128<double> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator<(highwayhash::SSE41::V128<double> const&) const
490
0
  HH_INLINE V128 operator>(const V128& other) const {
491
0
    return V128(_mm_cmplt_pd(other.v_, v_));
492
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator>(highwayhash::AVX2::V128<double> const&) const
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator>(highwayhash::SSE41::V128<double> const&) const
493
494
0
  HH_INLINE V128& operator*=(const V128& other) {
495
0
    v_ = _mm_mul_pd(v_, other.v_);
496
0
    return *this;
497
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator*=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator*=(highwayhash::SSE41::V128<double> const&)
498
0
  HH_INLINE V128& operator/=(const V128& other) {
499
0
    v_ = _mm_div_pd(v_, other.v_);
500
0
    return *this;
501
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator/=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator/=(highwayhash::SSE41::V128<double> const&)
502
0
  HH_INLINE V128& operator+=(const V128& other) {
503
0
    v_ = _mm_add_pd(v_, other.v_);
504
0
    return *this;
505
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator+=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator+=(highwayhash::SSE41::V128<double> const&)
506
0
  HH_INLINE V128& operator-=(const V128& other) {
507
0
    v_ = _mm_sub_pd(v_, other.v_);
508
0
    return *this;
509
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator-=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator-=(highwayhash::SSE41::V128<double> const&)
510
511
0
  HH_INLINE V128& operator&=(const V128& other) {
512
0
    v_ = _mm_and_pd(v_, other.v_);
513
0
    return *this;
514
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator&=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator&=(highwayhash::SSE41::V128<double> const&)
515
0
  HH_INLINE V128& operator|=(const V128& other) {
516
0
    v_ = _mm_or_pd(v_, other.v_);
517
0
    return *this;
518
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator|=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator|=(highwayhash::SSE41::V128<double> const&)
519
0
  HH_INLINE V128& operator^=(const V128& other) {
520
0
    v_ = _mm_xor_pd(v_, other.v_);
521
0
    return *this;
522
0
  }
Unexecuted instantiation: highwayhash::AVX2::V128<double>::operator^=(highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double>::operator^=(highwayhash::SSE41::V128<double> const&)
523
524
 private:
525
  Intrinsic v_;
526
};
527
528
// Nonmember functions for any V128 via member functions.
529
530
template <typename T>
531
HH_INLINE V128<T> operator*(const V128<T>& left, const V128<T>& right) {
532
  V128<T> t(left);
533
  return t *= right;
534
}
535
536
template <typename T>
537
HH_INLINE V128<T> operator/(const V128<T>& left, const V128<T>& right) {
538
  V128<T> t(left);
539
  return t /= right;
540
}
541
542
template <typename T>
543
48
HH_INLINE V128<T> operator+(const V128<T>& left, const V128<T>& right) {
544
48
  V128<T> t(left);
545
48
  return t += right;
546
48
}
highwayhash::AVX2::V128<unsigned long> highwayhash::AVX2::operator+<unsigned long>(highwayhash::AVX2::V128<unsigned long> const&, highwayhash::AVX2::V128<unsigned long> const&)
Line
Count
Source
543
48
HH_INLINE V128<T> operator+(const V128<T>& left, const V128<T>& right) {
544
48
  V128<T> t(left);
545
48
  return t += right;
546
48
}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long> highwayhash::SSE41::operator+<unsigned long>(highwayhash::SSE41::V128<unsigned long> const&, highwayhash::SSE41::V128<unsigned long> const&)
547
548
template <typename T>
549
0
HH_INLINE V128<T> operator-(const V128<T>& left, const V128<T>& right) {
550
0
  V128<T> t(left);
551
0
  return t -= right;
552
0
}
553
554
template <typename T>
555
0
HH_INLINE V128<T> operator&(const V128<T>& left, const V128<T>& right) {
556
0
  V128<T> t(left);
557
0
  return t &= right;
558
0
}
559
560
template <typename T>
561
0
HH_INLINE V128<T> operator|(const V128<T>& left, const V128<T>& right) {
562
0
  V128<T> t(left);
563
0
  return t |= right;
564
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int> highwayhash::AVX2::operator|<unsigned int>(highwayhash::AVX2::V128<unsigned int> const&, highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long> highwayhash::SSE41::operator|<unsigned long>(highwayhash::SSE41::V128<unsigned long> const&, highwayhash::SSE41::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int> highwayhash::SSE41::operator|<unsigned int>(highwayhash::SSE41::V128<unsigned int> const&, highwayhash::SSE41::V128<unsigned int> const&)
565
566
template <typename T>
567
0
HH_INLINE V128<T> operator^(const V128<T>& left, const V128<T>& right) {
568
0
  V128<T> t(left);
569
0
  return t ^= right;
570
0
}
571
572
template <typename T>
573
HH_INLINE V128<T> operator<<(const V128<T>& v, const int count) {
574
  V128<T> t(v);
575
  return t <<= count;
576
}
577
578
template <typename T>
579
0
HH_INLINE V128<T> operator>>(const V128<T>& v, const int count) {
580
0
  V128<T> t(v);
581
0
  return t >>= count;
582
0
}
583
584
template <typename T>
585
HH_INLINE V128<T> operator<<(const V128<T>& v, const __m128i& count) {
586
  V128<T> t(v);
587
  return t <<= count;
588
}
589
590
template <typename T>
591
HH_INLINE V128<T> operator>>(const V128<T>& v, const __m128i& count) {
592
  V128<T> t(v);
593
  return t >>= count;
594
}
595
596
using V16x8U = V128<uint8_t>;
597
using V8x16U = V128<uint16_t>;
598
using V4x32U = V128<uint32_t>;
599
using V2x64U = V128<uint64_t>;
600
using V4x32F = V128<float>;
601
using V2x64F = V128<double>;
602
603
// Load/Store for any V128.
604
605
// We differentiate between targets' vector types via template specialization.
606
// Calling Load<V>(floats) is more natural than Load(V8x32F(), floats) and may
607
// generate better code in unoptimized builds. Only declare the primary
608
// templates to avoid needing mutual exclusion with vector256.
609
610
template <class V>
611
HH_INLINE V Load(const typename V::T* const HH_RESTRICT from);
612
613
template <class V>
614
HH_INLINE V LoadUnaligned(const typename V::T* const HH_RESTRICT from);
615
616
// "from" must be vector-aligned.
617
template <>
618
0
HH_INLINE V16x8U Load<V16x8U>(const V16x8U::T* const HH_RESTRICT from) {
619
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
620
0
  return V16x8U(_mm_load_si128(p));
621
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char> highwayhash::AVX2::Load<highwayhash::AVX2::V128<unsigned char> >(highwayhash::AVX2::V128<unsigned char>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char> highwayhash::SSE41::Load<highwayhash::SSE41::V128<unsigned char> >(highwayhash::SSE41::V128<unsigned char>::T const*)
622
template <>
623
0
HH_INLINE V8x16U Load<V8x16U>(const V8x16U::T* const HH_RESTRICT from) {
624
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
625
0
  return V8x16U(_mm_load_si128(p));
626
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short> highwayhash::AVX2::Load<highwayhash::AVX2::V128<unsigned short> >(highwayhash::AVX2::V128<unsigned short>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short> highwayhash::SSE41::Load<highwayhash::SSE41::V128<unsigned short> >(highwayhash::SSE41::V128<unsigned short>::T const*)
627
template <>
628
0
HH_INLINE V4x32U Load<V4x32U>(const V4x32U::T* const HH_RESTRICT from) {
629
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
630
0
  return V4x32U(_mm_load_si128(p));
631
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int> highwayhash::AVX2::Load<highwayhash::AVX2::V128<unsigned int> >(highwayhash::AVX2::V128<unsigned int>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int> highwayhash::SSE41::Load<highwayhash::SSE41::V128<unsigned int> >(highwayhash::SSE41::V128<unsigned int>::T const*)
632
template <>
633
0
HH_INLINE V2x64U Load<V2x64U>(const V2x64U::T* const HH_RESTRICT from) {
634
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
635
0
  return V2x64U(_mm_load_si128(p));
636
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long> highwayhash::AVX2::Load<highwayhash::AVX2::V128<unsigned long> >(highwayhash::AVX2::V128<unsigned long>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long> highwayhash::SSE41::Load<highwayhash::SSE41::V128<unsigned long> >(highwayhash::SSE41::V128<unsigned long>::T const*)
637
template <>
638
0
HH_INLINE V4x32F Load<V4x32F>(const V4x32F::T* const HH_RESTRICT from) {
639
0
  return V4x32F(_mm_load_ps(from));
640
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<float> highwayhash::AVX2::Load<highwayhash::AVX2::V128<float> >(highwayhash::AVX2::V128<float>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<float> highwayhash::SSE41::Load<highwayhash::SSE41::V128<float> >(highwayhash::SSE41::V128<float>::T const*)
641
template <>
642
0
HH_INLINE V2x64F Load<V2x64F>(const V2x64F::T* const HH_RESTRICT from) {
643
0
  return V2x64F(_mm_load_pd(from));
644
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<double> highwayhash::AVX2::Load<highwayhash::AVX2::V128<double> >(highwayhash::AVX2::V128<double>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<double> highwayhash::SSE41::Load<highwayhash::SSE41::V128<double> >(highwayhash::SSE41::V128<double>::T const*)
645
646
template <>
647
HH_INLINE V16x8U
648
0
LoadUnaligned<V16x8U>(const V16x8U::T* const HH_RESTRICT from) {
649
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
650
0
  return V16x8U(_mm_loadu_si128(p));
651
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned char> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<unsigned char> >(highwayhash::AVX2::V128<unsigned char>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned char> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<unsigned char> >(highwayhash::SSE41::V128<unsigned char>::T const*)
652
template <>
653
HH_INLINE V8x16U
654
0
LoadUnaligned<V8x16U>(const V8x16U::T* const HH_RESTRICT from) {
655
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
656
0
  return V8x16U(_mm_loadu_si128(p));
657
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned short> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<unsigned short> >(highwayhash::AVX2::V128<unsigned short>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned short> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<unsigned short> >(highwayhash::SSE41::V128<unsigned short>::T const*)
658
template <>
659
HH_INLINE V4x32U
660
16
LoadUnaligned<V4x32U>(const V4x32U::T* const HH_RESTRICT from) {
661
16
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
662
16
  return V4x32U(_mm_loadu_si128(p));
663
16
}
highwayhash::AVX2::V128<unsigned int> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<unsigned int> >(highwayhash::AVX2::V128<unsigned int>::T const*)
Line
Count
Source
660
16
LoadUnaligned<V4x32U>(const V4x32U::T* const HH_RESTRICT from) {
661
16
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
662
16
  return V4x32U(_mm_loadu_si128(p));
663
16
}
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<unsigned int> >(highwayhash::SSE41::V128<unsigned int>::T const*)
664
template <>
665
HH_INLINE V2x64U
666
0
LoadUnaligned<V2x64U>(const V2x64U::T* const HH_RESTRICT from) {
667
0
  const __m128i* const HH_RESTRICT p = reinterpret_cast<const __m128i*>(from);
668
0
  return V2x64U(_mm_loadu_si128(p));
669
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned long> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<unsigned long> >(highwayhash::AVX2::V128<unsigned long>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<unsigned long> >(highwayhash::SSE41::V128<unsigned long>::T const*)
670
template <>
671
HH_INLINE V4x32F
672
0
LoadUnaligned<V4x32F>(const V4x32F::T* const HH_RESTRICT from) {
673
0
  return V4x32F(_mm_loadu_ps(from));
674
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<float> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<float> >(highwayhash::AVX2::V128<float>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<float> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<float> >(highwayhash::SSE41::V128<float>::T const*)
675
template <>
676
HH_INLINE V2x64F
677
0
LoadUnaligned<V2x64F>(const V2x64F::T* const HH_RESTRICT from) {
678
0
  return V2x64F(_mm_loadu_pd(from));
679
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<double> highwayhash::AVX2::LoadUnaligned<highwayhash::AVX2::V128<double> >(highwayhash::AVX2::V128<double>::T const*)
Unexecuted instantiation: highwayhash::SSE41::V128<double> highwayhash::SSE41::LoadUnaligned<highwayhash::SSE41::V128<double> >(highwayhash::SSE41::V128<double>::T const*)
680
681
// "to" must be vector-aligned.
682
template <typename T>
683
0
HH_INLINE void Store(const V128<T>& v, T* const HH_RESTRICT to) {
684
0
  _mm_store_si128(reinterpret_cast<__m128i * HH_RESTRICT>(to), v);
685
0
}
686
0
HH_INLINE void Store(const V128<float>& v, float* const HH_RESTRICT to) {
687
0
  _mm_store_ps(to, v);
688
0
}
Unexecuted instantiation: highwayhash::AVX2::Store(highwayhash::AVX2::V128<float> const&, float*)
Unexecuted instantiation: highwayhash::SSE41::Store(highwayhash::SSE41::V128<float> const&, float*)
689
0
HH_INLINE void Store(const V128<double>& v, double* const HH_RESTRICT to) {
690
0
  _mm_store_pd(to, v);
691
0
}
Unexecuted instantiation: highwayhash::AVX2::Store(highwayhash::AVX2::V128<double> const&, double*)
Unexecuted instantiation: highwayhash::SSE41::Store(highwayhash::SSE41::V128<double> const&, double*)
692
693
template <typename T>
694
0
HH_INLINE void StoreUnaligned(const V128<T>& v, T* const HH_RESTRICT to) {
695
0
  _mm_storeu_si128(reinterpret_cast<__m128i * HH_RESTRICT>(to), v);
696
0
}
697
HH_INLINE void StoreUnaligned(const V128<float>& v,
698
0
                              float* const HH_RESTRICT to) {
699
0
  _mm_storeu_ps(to, v);
700
0
}
Unexecuted instantiation: highwayhash::AVX2::StoreUnaligned(highwayhash::AVX2::V128<float> const&, float*)
Unexecuted instantiation: highwayhash::SSE41::StoreUnaligned(highwayhash::SSE41::V128<float> const&, float*)
701
HH_INLINE void StoreUnaligned(const V128<double>& v,
702
0
                              double* const HH_RESTRICT to) {
703
0
  _mm_storeu_pd(to, v);
704
0
}
Unexecuted instantiation: highwayhash::AVX2::StoreUnaligned(highwayhash::AVX2::V128<double> const&, double*)
Unexecuted instantiation: highwayhash::SSE41::StoreUnaligned(highwayhash::SSE41::V128<double> const&, double*)
705
706
// Writes directly to (aligned) memory, bypassing the cache. This is useful for
707
// data that will not be read again in the near future.
708
template <typename T>
709
HH_INLINE void Stream(const V128<T>& v, T* const HH_RESTRICT to) {
710
  _mm_stream_si128(reinterpret_cast<__m128i * HH_RESTRICT>(to), v);
711
}
712
0
HH_INLINE void Stream(const V128<float>& v, float* const HH_RESTRICT to) {
713
0
  _mm_stream_ps(to, v);
714
0
}
Unexecuted instantiation: highwayhash::AVX2::Stream(highwayhash::AVX2::V128<float> const&, float*)
Unexecuted instantiation: highwayhash::SSE41::Stream(highwayhash::SSE41::V128<float> const&, float*)
715
0
HH_INLINE void Stream(const V128<double>& v, double* const HH_RESTRICT to) {
716
0
  _mm_stream_pd(to, v);
717
0
}
Unexecuted instantiation: highwayhash::AVX2::Stream(highwayhash::AVX2::V128<double> const&, double*)
Unexecuted instantiation: highwayhash::SSE41::Stream(highwayhash::SSE41::V128<double> const&, double*)
718
719
// Miscellaneous functions.
720
721
template <typename T>
722
HH_INLINE V128<T> RotateLeft(const V128<T>& v, const int count) {
723
  constexpr size_t num_bits = sizeof(T) * 8;
724
  return (v << count) | (v >> (num_bits - count));
725
}
726
727
template <typename T>
728
0
HH_INLINE V128<T> AndNot(const V128<T>& neg_mask, const V128<T>& values) {
729
0
  return V128<T>(_mm_andnot_si128(neg_mask, values));
730
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<unsigned int> highwayhash::AVX2::AndNot<unsigned int>(highwayhash::AVX2::V128<unsigned int> const&, highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned long> highwayhash::SSE41::AndNot<unsigned long>(highwayhash::SSE41::V128<unsigned long> const&, highwayhash::SSE41::V128<unsigned long> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<unsigned int> highwayhash::SSE41::AndNot<unsigned int>(highwayhash::SSE41::V128<unsigned int> const&, highwayhash::SSE41::V128<unsigned int> const&)
731
template <>
732
HH_INLINE V128<float> AndNot(const V128<float>& neg_mask,
733
0
                             const V128<float>& values) {
734
0
  return V128<float>(_mm_andnot_ps(neg_mask, values));
735
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<float> highwayhash::AVX2::AndNot<float>(highwayhash::AVX2::V128<float> const&, highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<float> highwayhash::SSE41::AndNot<float>(highwayhash::SSE41::V128<float> const&, highwayhash::SSE41::V128<float> const&)
736
template <>
737
HH_INLINE V128<double> AndNot(const V128<double>& neg_mask,
738
0
                              const V128<double>& values) {
739
0
  return V128<double>(_mm_andnot_pd(neg_mask, values));
740
0
}
Unexecuted instantiation: highwayhash::AVX2::V128<double> highwayhash::AVX2::AndNot<double>(highwayhash::AVX2::V128<double> const&, highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::V128<double> highwayhash::SSE41::AndNot<double>(highwayhash::SSE41::V128<double> const&, highwayhash::SSE41::V128<double> const&)
741
742
0
HH_INLINE V4x32F Select(const V4x32F& a, const V4x32F& b, const V4x32F& mask) {
743
0
  return V4x32F(_mm_blendv_ps(a, b, mask));
744
0
}
Unexecuted instantiation: highwayhash::AVX2::Select(highwayhash::AVX2::V128<float> const&, highwayhash::AVX2::V128<float> const&, highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::Select(highwayhash::SSE41::V128<float> const&, highwayhash::SSE41::V128<float> const&, highwayhash::SSE41::V128<float> const&)
745
746
0
HH_INLINE V2x64F Select(const V2x64F& a, const V2x64F& b, const V2x64F& mask) {
747
0
  return V2x64F(_mm_blendv_pd(a, b, mask));
748
0
}
Unexecuted instantiation: highwayhash::AVX2::Select(highwayhash::AVX2::V128<double> const&, highwayhash::AVX2::V128<double> const&, highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::Select(highwayhash::SSE41::V128<double> const&, highwayhash::SSE41::V128<double> const&, highwayhash::SSE41::V128<double> const&)
749
750
// Min/Max
751
752
0
HH_INLINE V16x8U Min(const V16x8U& v0, const V16x8U& v1) {
753
0
  return V16x8U(_mm_min_epu8(v0, v1));
754
0
}
Unexecuted instantiation: highwayhash::AVX2::Min(highwayhash::AVX2::V128<unsigned char> const&, highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::Min(highwayhash::SSE41::V128<unsigned char> const&, highwayhash::SSE41::V128<unsigned char> const&)
755
756
0
HH_INLINE V16x8U Max(const V16x8U& v0, const V16x8U& v1) {
757
0
  return V16x8U(_mm_max_epu8(v0, v1));
758
0
}
Unexecuted instantiation: highwayhash::AVX2::Max(highwayhash::AVX2::V128<unsigned char> const&, highwayhash::AVX2::V128<unsigned char> const&)
Unexecuted instantiation: highwayhash::SSE41::Max(highwayhash::SSE41::V128<unsigned char> const&, highwayhash::SSE41::V128<unsigned char> const&)
759
760
0
HH_INLINE V8x16U Min(const V8x16U& v0, const V8x16U& v1) {
761
0
  return V8x16U(_mm_min_epu16(v0, v1));
762
0
}
Unexecuted instantiation: highwayhash::AVX2::Min(highwayhash::AVX2::V128<unsigned short> const&, highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::Min(highwayhash::SSE41::V128<unsigned short> const&, highwayhash::SSE41::V128<unsigned short> const&)
763
764
0
HH_INLINE V8x16U Max(const V8x16U& v0, const V8x16U& v1) {
765
0
  return V8x16U(_mm_max_epu16(v0, v1));
766
0
}
Unexecuted instantiation: highwayhash::AVX2::Max(highwayhash::AVX2::V128<unsigned short> const&, highwayhash::AVX2::V128<unsigned short> const&)
Unexecuted instantiation: highwayhash::SSE41::Max(highwayhash::SSE41::V128<unsigned short> const&, highwayhash::SSE41::V128<unsigned short> const&)
767
768
0
HH_INLINE V4x32U Min(const V4x32U& v0, const V4x32U& v1) {
769
0
  return V4x32U(_mm_min_epu32(v0, v1));
770
0
}
Unexecuted instantiation: highwayhash::AVX2::Min(highwayhash::AVX2::V128<unsigned int> const&, highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::Min(highwayhash::SSE41::V128<unsigned int> const&, highwayhash::SSE41::V128<unsigned int> const&)
771
772
0
HH_INLINE V4x32U Max(const V4x32U& v0, const V4x32U& v1) {
773
0
  return V4x32U(_mm_max_epu32(v0, v1));
774
0
}
Unexecuted instantiation: highwayhash::AVX2::Max(highwayhash::AVX2::V128<unsigned int> const&, highwayhash::AVX2::V128<unsigned int> const&)
Unexecuted instantiation: highwayhash::SSE41::Max(highwayhash::SSE41::V128<unsigned int> const&, highwayhash::SSE41::V128<unsigned int> const&)
775
776
0
HH_INLINE V4x32F Min(const V4x32F& v0, const V4x32F& v1) {
777
0
  return V4x32F(_mm_min_ps(v0, v1));
778
0
}
Unexecuted instantiation: highwayhash::AVX2::Min(highwayhash::AVX2::V128<float> const&, highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::Min(highwayhash::SSE41::V128<float> const&, highwayhash::SSE41::V128<float> const&)
779
780
0
HH_INLINE V4x32F Max(const V4x32F& v0, const V4x32F& v1) {
781
0
  return V4x32F(_mm_max_ps(v0, v1));
782
0
}
Unexecuted instantiation: highwayhash::AVX2::Max(highwayhash::AVX2::V128<float> const&, highwayhash::AVX2::V128<float> const&)
Unexecuted instantiation: highwayhash::SSE41::Max(highwayhash::SSE41::V128<float> const&, highwayhash::SSE41::V128<float> const&)
783
784
0
HH_INLINE V2x64F Min(const V2x64F& v0, const V2x64F& v1) {
785
0
  return V2x64F(_mm_min_pd(v0, v1));
786
0
}
Unexecuted instantiation: highwayhash::AVX2::Min(highwayhash::AVX2::V128<double> const&, highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::Min(highwayhash::SSE41::V128<double> const&, highwayhash::SSE41::V128<double> const&)
787
788
0
HH_INLINE V2x64F Max(const V2x64F& v0, const V2x64F& v1) {
789
0
  return V2x64F(_mm_max_pd(v0, v1));
790
0
}
Unexecuted instantiation: highwayhash::AVX2::Max(highwayhash::AVX2::V128<double> const&, highwayhash::AVX2::V128<double> const&)
Unexecuted instantiation: highwayhash::SSE41::Max(highwayhash::SSE41::V128<double> const&, highwayhash::SSE41::V128<double> const&)
791
792
}  // namespace HH_TARGET_NAME
793
}  // namespace highwayhash
794
795
#endif  // HH_DISABLE_TARGET_SPECIFIC
796
#endif  // HIGHWAYHASH_VECTOR128_H_