Skip to content

Commit 6fbf81d

Browse files
authored
Merge pull request #458 from guyuqi/shuffle128-tests
Add zip_lo/hi test cases for shuffling 128bit data.
2 parents 86bc4c7 + 9741c03 commit 6fbf81d

15 files changed

+268
-0
lines changed

include/xsimd/types/xsimd_avx512_double.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,16 @@ namespace xsimd
536536
{
537537
return _mm512_cmp_pd_mask(x, x, _CMP_UNORD_Q);
538538
}
539+
540+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
541+
{
542+
return _mm512_unpacklo_pd(lhs, rhs);
543+
}
544+
545+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
546+
{
547+
return _mm512_unpackhi_pd(lhs, rhs);
548+
}
539549
};
540550
}
541551

include/xsimd/types/xsimd_avx512_float.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,16 @@ namespace xsimd
595595
#endif
596596
}
597597

598+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
599+
{
600+
return _mm512_unpacklo_ps(lhs, rhs);
601+
}
602+
603+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
604+
{
605+
return _mm512_unpackhi_ps(lhs, rhs);
606+
}
607+
598608
static batch_bool_type isnan(const batch_type& x)
599609
{
600610
return _mm512_cmp_ps_mask(x, x, _CMP_UNORD_Q);

include/xsimd/types/xsimd_avx512_int16.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,17 @@ namespace xsimd
331331
XSIMD_RETURN_MERGED_AVX(res_lo, res_hi);
332332
#endif
333333
}
334+
335+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
336+
{
337+
return _mm512_unpacklo_epi16(lhs, rhs);
338+
}
339+
340+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
341+
{
342+
return _mm512_unpackhi_epi16(lhs, rhs);
343+
}
344+
334345
};
335346

336347
template <>

include/xsimd/types/xsimd_avx512_int32.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,17 @@ namespace xsimd
244244
{
245245
return _mm512_mask_blend_epi32(cond, b, a);
246246
}
247+
248+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
249+
{
250+
return _mm512_unpacklo_epi32(lhs, rhs);
251+
}
252+
253+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
254+
{
255+
return _mm512_unpackhi_epi32(lhs, rhs);
256+
}
257+
247258
};
248259

249260
template <>

include/xsimd/types/xsimd_avx512_int64.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,17 @@ namespace xsimd
313313
XSIMD_RETURN_MERGED_AVX(res_lo, res_hi);
314314
#endif
315315
}
316+
317+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
318+
{
319+
return _mm512_unpacklo_epi64(lhs, rhs);
320+
}
321+
322+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
323+
{
324+
return _mm512_unpackhi_epi64(lhs, rhs);
325+
}
326+
316327
};
317328

318329
template <>

include/xsimd/types/xsimd_avx512_int8.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,17 @@ namespace xsimd
335335
XSIMD_RETURN_MERGED_AVX(res_lo, res_hi);
336336
#endif
337337
}
338+
339+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
340+
{
341+
return _mm512_unpacklo_epi8(lhs, rhs);
342+
}
343+
344+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
345+
{
346+
return _mm512_unpackhi_epi8(lhs, rhs);
347+
}
348+
338349
};
339350

340351
template <>

include/xsimd/types/xsimd_avx_double.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,17 @@ namespace xsimd
665665
return _mm256_blend_pd(b, a, mask);
666666
}
667667

668+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
669+
{
670+
return _mm256_unpacklo_pd(lhs, rhs);
671+
}
672+
673+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
674+
{
675+
return _mm256_unpackhi_pd(lhs, rhs);
676+
}
677+
678+
668679
static batch_bool_type isnan(const batch_type& x)
669680
{
670681
return _mm256_cmp_pd(x, x, _CMP_UNORD_Q);

include/xsimd/types/xsimd_avx_float.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,16 @@ namespace xsimd
713713
return _mm256_blend_ps(b, a, mask);
714714
}
715715

716+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
717+
{
718+
return _mm256_unpacklo_ps(lhs, rhs);
719+
}
720+
721+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
722+
{
723+
return _mm256_unpackhi_ps(lhs, rhs);
724+
}
725+
716726
static batch_bool_type isnan(const batch_type& x)
717727
{
718728
return _mm256_cmp_ps(x, x, _CMP_UNORD_Q);

include/xsimd/types/xsimd_avx_int16.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,17 @@ namespace xsimd
277277
XSIMD_RETURN_MERGED_SSE(res_low, res_high);
278278
#endif
279279
}
280+
281+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
282+
{
283+
return _mm256_unpacklo_epi16(lhs, rhs);
284+
}
285+
286+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
287+
{
288+
return _mm256_unpackhi_epi16(lhs, rhs);
289+
}
290+
280291
};
281292

282293
template <>

include/xsimd/types/xsimd_avx_int32.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,17 @@ namespace xsimd
332332
XSIMD_RETURN_MERGED_SSE(res_low, res_high);
333333
#endif
334334
}
335+
336+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
337+
{
338+
return _mm256_unpacklo_epi32(lhs, rhs);
339+
}
340+
341+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
342+
{
343+
return _mm256_unpackhi_epi32(lhs, rhs);
344+
}
345+
335346
};
336347

337348
template <>
@@ -498,6 +509,17 @@ namespace xsimd
498509
XSIMD_RETURN_MERGED_SSE(res_low, res_high);
499510
#endif
500511
}
512+
513+
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
514+
{
515+
return _mm256_unpacklo_epi32(lhs, rhs);
516+
}
517+
518+
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
519+
{
520+
return _mm256_unpackhi_epi32(lhs, rhs);
521+
}
522+
501523
};
502524
}
503525

0 commit comments

Comments
 (0)