@@ -24,9 +24,9 @@ namespace
2424 using shuffle_vector_type = std::array<T, N>;
2525 shuffle_vector_type lhs_in, rhs_in, exp_lo, exp_hi;
2626
27- std::vector<shuffle_vector_type> create_vectors ()
27+ std::vector<shuffle_vector_type, xsimd::aligned_allocator<shuffle_vector_type> > create_vectors ()
2828 {
29- std::vector<shuffle_vector_type> vects;
29+ std::vector<shuffle_vector_type, xsimd::aligned_allocator<shuffle_vector_type> > vects;
3030 vects.reserve (4 );
3131
3232 /* Generate input data: lhs, rhs */
@@ -69,9 +69,9 @@ struct zip_test : zip_base<typename B::value_type, B::size>
6969 auto v_rhs = zipped_vecs[1 ];
7070 auto v_exp_lo = zipped_vecs[2 ];
7171
72- B b_lhs = B::load_unaligned (v_lhs.data ());
73- B b_rhs = B::load_unaligned (v_rhs.data ());
74- B b_exp_lo = B::load_unaligned (v_exp_lo.data ());
72+ B b_lhs = B::load_aligned (v_lhs.data ());
73+ B b_rhs = B::load_aligned (v_rhs.data ());
74+ B b_exp_lo = B::load_aligned (v_exp_lo.data ());
7575
7676 B b_res_lo = xsimd::zip_lo (b_lhs, b_rhs);
7777 CHECK_BATCH_EQ (b_res_lo, b_exp_lo);
@@ -83,9 +83,9 @@ struct zip_test : zip_base<typename B::value_type, B::size>
8383 auto v_rhs = zipped_vecs[1 ];
8484 auto v_exp_hi = zipped_vecs[3 ];
8585
86- B b_lhs = B::load_unaligned (v_lhs.data ());
87- B b_rhs = B::load_unaligned (v_rhs.data ());
88- B b_exp_hi = B::load_unaligned (v_exp_hi.data ());
86+ B b_lhs = B::load_aligned (v_lhs.data ());
87+ B b_rhs = B::load_aligned (v_rhs.data ());
88+ B b_exp_hi = B::load_aligned (v_exp_hi.data ());
8989
9090 B b_res_hi = xsimd::zip_hi (b_lhs, b_rhs);
9191 CHECK_BATCH_EQ (b_res_hi, b_exp_hi);
@@ -181,13 +181,13 @@ struct slide_test : public init_slide_base<typename B::value_type, B::size>
181181
182182 void slide_left ()
183183 {
184- B b_in = B::load_unaligned (this ->v_in .data ());
185- B b_left0 = B::load_unaligned (this ->v_left0 .data ());
186- B b_left_full = B::load_unaligned (this ->v_left_full .data ());
187- B b_left_half = B::load_unaligned (this ->v_left_half .data ());
188- B b_left_one = B::load_unaligned (this ->v_left_one .data ());
189- B b_left_above_half = B::load_unaligned (this ->v_left_above_half .data ());
190- B b_left_below_half = B::load_unaligned (this ->v_left_below_half .data ());
184+ B b_in = B::load_aligned (this ->v_in .data ());
185+ B b_left0 = B::load_aligned (this ->v_left0 .data ());
186+ B b_left_full = B::load_aligned (this ->v_left_full .data ());
187+ B b_left_half = B::load_aligned (this ->v_left_half .data ());
188+ B b_left_one = B::load_aligned (this ->v_left_one .data ());
189+ B b_left_above_half = B::load_aligned (this ->v_left_above_half .data ());
190+ B b_left_below_half = B::load_aligned (this ->v_left_below_half .data ());
191191
192192 B b_res_left0 = xsimd::slide_left<0 >(b_in);
193193 INFO (" slide_left 0" );
@@ -219,13 +219,13 @@ struct slide_test : public init_slide_base<typename B::value_type, B::size>
219219
220220 void slide_right ()
221221 {
222- B b_in = B::load_unaligned (this ->v_in .data ());
223- B b_right0 = B::load_unaligned (this ->v_right0 .data ());
224- B b_right_full = B::load_unaligned (this ->v_right_full .data ());
225- B b_right_half = B::load_unaligned (this ->v_right_half .data ());
226- B b_right_one = B::load_unaligned (this ->v_right_one .data ());
227- B b_right_above_half = B::load_unaligned (this ->v_right_above_half .data ());
228- B b_right_below_half = B::load_unaligned (this ->v_right_below_half .data ());
222+ B b_in = B::load_aligned (this ->v_in .data ());
223+ B b_right0 = B::load_aligned (this ->v_right0 .data ());
224+ B b_right_full = B::load_aligned (this ->v_right_full .data ());
225+ B b_right_half = B::load_aligned (this ->v_right_half .data ());
226+ B b_right_one = B::load_aligned (this ->v_right_one .data ());
227+ B b_right_above_half = B::load_aligned (this ->v_right_above_half .data ());
228+ B b_right_below_half = B::load_aligned (this ->v_right_below_half .data ());
229229
230230 B b_res_right0 = xsimd::slide_right<0 >(b_in);
231231 INFO (" slide_right 0" );
@@ -297,8 +297,8 @@ struct compress_test
297297 expected[i] = input[i];
298298
299299 auto b = xsimd::compress (
300- batch_type::load_unaligned (input.data ()),
301- mask_batch_type::load_unaligned (mask.data ()));
300+ batch_type::load_aligned (input.data ()),
301+ mask_batch_type::load_aligned (mask.data ()));
302302 CHECK_BATCH_EQ (b, expected);
303303 }
304304
@@ -310,8 +310,8 @@ struct compress_test
310310 expected[i] = 0 ;
311311
312312 auto b = xsimd::compress (
313- batch_type::load_unaligned (input.data ()),
314- mask_batch_type::load_unaligned (mask.data ()));
313+ batch_type::load_aligned (input.data ()),
314+ mask_batch_type::load_aligned (mask.data ()));
315315 CHECK_BATCH_EQ (b, expected);
316316 }
317317
@@ -324,8 +324,8 @@ struct compress_test
324324 expected[i] = i < size / 2 ? input[2 * i] : 0 ;
325325
326326 auto b = xsimd::compress (
327- batch_type::load_unaligned (input.data ()),
328- mask_batch_type::load_unaligned (mask.data ()));
327+ batch_type::load_aligned (input.data ()),
328+ mask_batch_type::load_aligned (mask.data ()));
329329 CHECK_BATCH_EQ (b, expected);
330330 }
331331
@@ -338,8 +338,8 @@ struct compress_test
338338 expected[i] = i < size / 3 ? input[3 * i] : 0 ;
339339
340340 auto b = xsimd::compress (
341- batch_type::load_unaligned (input.data ()),
342- mask_batch_type::load_unaligned (mask.data ()));
341+ batch_type::load_aligned (input.data ()),
342+ mask_batch_type::load_aligned (mask.data ()));
343343 CHECK_BATCH_EQ (b, expected);
344344 }
345345};
@@ -395,8 +395,8 @@ struct expand_test
395395 expected[i] = input[i];
396396
397397 auto b = xsimd::expand (
398- batch_type::load_unaligned (input.data ()),
399- mask_batch_type::load_unaligned (mask.data ()));
398+ batch_type::load_aligned (input.data ()),
399+ mask_batch_type::load_aligned (mask.data ()));
400400 CHECK_BATCH_EQ (b, expected);
401401 }
402402
@@ -408,8 +408,8 @@ struct expand_test
408408 expected[i] = 0 ;
409409
410410 auto b = xsimd::expand (
411- batch_type::load_unaligned (input.data ()),
412- mask_batch_type::load_unaligned (mask.data ()));
411+ batch_type::load_aligned (input.data ()),
412+ mask_batch_type::load_aligned (mask.data ()));
413413 CHECK_BATCH_EQ (b, expected);
414414 }
415415
@@ -422,8 +422,8 @@ struct expand_test
422422 expected[i] = mask[i] ? input[j++] : 0 ;
423423
424424 auto b = xsimd::expand (
425- batch_type::load_unaligned (input.data ()),
426- mask_batch_type::load_unaligned (mask.data ()));
425+ batch_type::load_aligned (input.data ()),
426+ mask_batch_type::load_aligned (mask.data ()));
427427 CHECK_BATCH_EQ (b, expected);
428428 }
429429
@@ -436,8 +436,8 @@ struct expand_test
436436 expected[i] = mask[i] ? input[j++] : 0 ;
437437
438438 auto b = xsimd::expand (
439- batch_type::load_unaligned (input.data ()),
440- mask_batch_type::load_unaligned (mask.data ()));
439+ batch_type::load_aligned (input.data ()),
440+ mask_batch_type::load_aligned (mask.data ()));
441441 CHECK_BATCH_EQ (b, expected);
442442 }
443443};
@@ -487,8 +487,8 @@ struct shuffle_test
487487
488488 void no_op ()
489489 {
490- B b_lhs = B::load_unaligned (lhs.data ());
491- B b_rhs = B::load_unaligned (rhs.data ());
490+ B b_lhs = B::load_aligned (lhs.data ());
491+ B b_rhs = B::load_aligned (rhs.data ());
492492
493493 struct no_op_lhs_generator
494494 {
@@ -517,8 +517,8 @@ struct shuffle_test
517517
518518 void common ()
519519 {
520- B b_lhs = B::load_unaligned (lhs.data ());
521- B b_rhs = B::load_unaligned (rhs.data ());
520+ B b_lhs = B::load_aligned (lhs.data ());
521+ B b_rhs = B::load_aligned (rhs.data ());
522522
523523 struct common_generator
524524 {
@@ -534,16 +534,16 @@ struct shuffle_test
534534 size_t ri = size - i - 1 ;
535535 ref[i] = (i & 1 ) ? lhs[ri] : rhs[ri];
536536 }
537- B b_ref = B::load_unaligned (ref.data ());
537+ B b_ref = B::load_aligned (ref.data ());
538538
539539 B b_res = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, common_generator, arch_type>());
540540 CHECK_BATCH_EQ (b_res, b_ref);
541541 }
542542
543543 void pick ()
544544 {
545- B b_lhs = B::load_unaligned (lhs.data ());
546- B b_rhs = B::load_unaligned (rhs.data ());
545+ B b_lhs = B::load_aligned (lhs.data ());
546+ B b_rhs = B::load_aligned (rhs.data ());
547547
548548 struct pick_generator
549549 {
@@ -556,16 +556,16 @@ struct shuffle_test
556556 std::array<value_type, size> ref;
557557 for (size_t i = 0 ; i < size; ++i)
558558 ref[i] = (i > 2 ) ? lhs[0 ] : rhs[0 ];
559- B b_ref = B::load_unaligned (ref.data ());
559+ B b_ref = B::load_aligned (ref.data ());
560560
561561 B b_res = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, pick_generator, arch_type>());
562562 CHECK_BATCH_EQ (b_res, b_ref);
563563 }
564564
565565 void shuffle ()
566566 {
567- B b_lhs = B::load_unaligned (lhs.data ());
568- B b_rhs = B::load_unaligned (rhs.data ());
567+ B b_lhs = B::load_aligned (lhs.data ());
568+ B b_rhs = B::load_aligned (rhs.data ());
569569
570570 {
571571 struct shuffle_lo_generator
@@ -579,7 +579,7 @@ struct shuffle_test
579579 std::array<value_type, size> ref;
580580 for (size_t i = 0 ; i < size; ++i)
581581 ref[i] = lhs[size - i - 1 ];
582- B b_ref = B::load_unaligned (ref.data ());
582+ B b_ref = B::load_aligned (ref.data ());
583583
584584 INFO (" shuffle first batch" );
585585 B b_res = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, shuffle_lo_generator, arch_type>());
@@ -598,7 +598,7 @@ struct shuffle_test
598598 std::array<value_type, size> ref;
599599 for (size_t i = 0 ; i < size; ++i)
600600 ref[i] = rhs[size - i - 1 ];
601- B b_ref = B::load_unaligned (ref.data ());
601+ B b_ref = B::load_aligned (ref.data ());
602602
603603 INFO (" shuffle second batch" );
604604 B b_res = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, shuffle_hi_generator, arch_type>());
@@ -608,7 +608,7 @@ struct shuffle_test
608608
609609 void transpose ()
610610 {
611- B b_lhs = B::load_unaligned (lhs.data ());
611+ B b_lhs = B::load_aligned (lhs.data ());
612612 std::array<B, size> b_matrix;
613613 for (size_t i = 0 ; i < size; ++i)
614614 b_matrix[i] = b_lhs;
@@ -621,14 +621,14 @@ struct shuffle_test
621621 xsimd::transpose (b_matrix.data (), b_matrix.data () + b_matrix.size ());
622622 for (size_t i = 0 ; i < size; ++i)
623623 {
624- CHECK_BATCH_EQ (b_matrix[i], B::load_unaligned (&ref_matrix[i * size]));
624+ CHECK_BATCH_EQ (b_matrix[i], B::load_aligned (&ref_matrix[i * size]));
625625 }
626626 }
627627
628628 void select ()
629629 {
630- B b_lhs = B::load_unaligned (lhs.data ());
631- B b_rhs = B::load_unaligned (rhs.data ());
630+ B b_lhs = B::load_aligned (lhs.data ());
631+ B b_rhs = B::load_aligned (rhs.data ());
632632
633633 struct select_generator
634634 {
@@ -641,7 +641,7 @@ struct shuffle_test
641641 std::array<value_type, size> ref;
642642 for (size_t i = 0 ; i < size; ++i)
643643 ref[i] = (i % 3 ) ? rhs[i] : lhs[i];
644- B b_ref = B::load_unaligned (ref.data ());
644+ B b_ref = B::load_aligned (ref.data ());
645645
646646 INFO (" select" );
647647 B b_res = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, select_generator, arch_type>());
@@ -650,8 +650,8 @@ struct shuffle_test
650650
651651 void zip ()
652652 {
653- B b_lhs = B::load_unaligned (lhs.data ());
654- B b_rhs = B::load_unaligned (rhs.data ());
653+ B b_lhs = B::load_aligned (lhs.data ());
654+ B b_rhs = B::load_aligned (rhs.data ());
655655
656656 struct zip_lo_generator
657657 {
@@ -664,7 +664,7 @@ struct shuffle_test
664664 std::array<value_type, size> ref_lo;
665665 for (size_t i = 0 ; i < size; ++i)
666666 ref_lo[i] = (i & 1 ) ? rhs[i / 2 ] : lhs[i / 2 ];
667- B b_ref_lo = B::load_unaligned (ref_lo.data ());
667+ B b_ref_lo = B::load_aligned (ref_lo.data ());
668668
669669 INFO (" zip_lo" );
670670 B b_res_lo = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, zip_lo_generator, arch_type>());
@@ -678,12 +678,12 @@ struct shuffle_test
678678 }
679679 };
680680
681- std::array<value_type, size> ref_hi;
681+ alignas ( arch_type::alignment ()) std::array<value_type, size> ref_hi;
682682 for (size_t i = 0 ; i < size; ++i)
683683 {
684684 ref_hi[i] = (i & 1 ) ? rhs[size / 2 + i / 2 ] : lhs[size / 2 + i / 2 ];
685685 }
686- B b_ref_hi = B::load_unaligned (ref_hi.data ());
686+ B b_ref_hi = B::load_aligned (ref_hi.data ());
687687
688688 INFO (" zip_hi" );
689689 B b_res_hi = xsimd::shuffle (b_lhs, b_rhs, xsimd::make_batch_constant<mask_type, zip_hi_generator, arch_type>());
0 commit comments