Skip to content

Commit 3a9d2d2

Browse files
author
Yuqi Gu
committed
Add fallback implementation for Arm32/v7
Change-Id: I3940e8b579f320288dbf640f0536da017298b00c Signed-off-by: Yuqi Gu <guyuqi@apache.com>
1 parent 5ff34d2 commit 3a9d2d2

10 files changed

+96
-20
lines changed

include/xsimd/types/xsimd_neon_double.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,17 +580,23 @@ namespace xsimd
580580
return vbslq_f64(cond, a, b);
581581
}
582582

583-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
584583
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
585584
{
585+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
586586
return vzip1q_f64(lhs, rhs);
587+
#else
588+
return vcombine_f64(vget_low_f64(lhs), vget_low_f64(rhs));
589+
#endif
587590
}
588591

589592
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
590593
{
594+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
591595
return vzip2q_f64(lhs, rhs);
592-
}
596+
#else
597+
return vcombine_f64(vget_high_f64(lhs), vget_high_f64(rhs));
593598
#endif
599+
}
594600

595601
static batch_bool_type isnan(const batch_type& x)
596602
{

include/xsimd/types/xsimd_neon_float.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,25 @@ namespace xsimd
639639
return vbslq_f32(cond, a, b);
640640
}
641641

642-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
643642
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
644643
{
644+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
645645
return vzip1q_f32(lhs, rhs);
646+
#else
647+
float32x2x2_t tmp = vzip_f32(vget_low_f32(lhs), vget_low_f32(rhs));
648+
return vcombine_f32(tmp.val[0], tmp.val[1]);
649+
#endif
646650
}
647651

648652
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
649653
{
654+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
650655
return vzip2q_f32(lhs, rhs);
651-
}
656+
#else
657+
float32x2x2_t tmp = vzip_f32(vget_high_f32(lhs), vget_high_f32(rhs));
658+
return vcombine_f32(tmp.val[0], tmp.val[1]);
652659
#endif
660+
}
653661

654662
static batch_bool_type isnan(const batch_type& x)
655663
{

include/xsimd/types/xsimd_neon_int16.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,25 @@ namespace xsimd
345345
return vbslq_s16(cond, a, b);
346346
}
347347

348-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
349348
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
350349
{
350+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
351351
return vzip1q_s16(lhs, rhs);
352+
#else
353+
int16x4x2_t tmp = vzip_s16(vget_low_s16(lhs), vget_low_s16(rhs));
354+
return vcombine_s16(tmp.val[0], tmp.val[1]);
355+
#endif
352356
}
353357

354358
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
355359
{
360+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
356361
return vzip2q_s16(lhs, rhs);
357-
}
362+
#else
363+
int16x4x2_t tmp = vzip_s16(vget_high_s16(lhs), vget_high_s16(rhs));
364+
return vcombine_s16(tmp.val[0], tmp.val[1]);
358365
#endif
366+
}
359367
};
360368
}
361369

include/xsimd/types/xsimd_neon_int32.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,25 @@ namespace xsimd
425425
return vbslq_s32(cond, a, b);
426426
}
427427

428-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
429428
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
430429
{
430+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
431431
return vzip1q_s32(lhs, rhs);
432+
#else
433+
int32x2x2_t tmp = vzip_s32(vget_low_s32(lhs), vget_low_s32(rhs));
434+
return vcombine_s32(tmp.val[0], tmp.val[1]);
435+
#endif
432436
}
433437

434438
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
435439
{
440+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
436441
return vzip2q_s32(lhs, rhs);
437-
}
442+
#else
443+
int32x2x2_t tmp = vzip_s32(vget_high_s32(lhs), vget_high_s32(rhs));
444+
return vcombine_s32(tmp.val[0], tmp.val[1]);
438445
#endif
446+
}
439447
};
440448
}
441449

include/xsimd/types/xsimd_neon_int64.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,23 @@ namespace xsimd
440440
return vbslq_s64(cond, a, b);
441441
}
442442

443-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
444443
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
445444
{
445+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
446446
return vzip1q_s64(lhs, rhs);
447+
#else
448+
return vcombine_s64(vget_low_s64(lhs), vget_low_s64(rhs));
449+
#endif
447450
}
448451

449452
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
450453
{
454+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
451455
return vzip2q_s64(lhs, rhs);
452-
}
456+
#else
457+
return vcombine_s64(vget_high_s64(lhs), vget_high_s64(rhs));
453458
#endif
459+
}
454460
};
455461
}
456462

include/xsimd/types/xsimd_neon_int8.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,25 @@ namespace xsimd
346346
return vbslq_s8(cond, a, b);
347347
}
348348

349-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
350349
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
351350
{
351+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
352352
return vzip1q_s8(lhs, rhs);
353+
#else
354+
int8x8x2_t tmp = vzip_s8(vget_low_s8(lhs), vget_low_s8(rhs));
355+
return vcombine_s8(tmp.val[0], tmp.val[1]);
356+
#endif
353357
}
354358

355359
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
356360
{
361+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
357362
return vzip2q_s8(lhs, rhs);
358-
}
363+
#else
364+
int8x8x2_t tmp = vzip_s8(vget_high_s8(lhs), vget_high_s8(rhs));
365+
return vcombine_s8(tmp.val[0], tmp.val[1]);
359366
#endif
367+
}
360368
};
361369
}
362370

include/xsimd/types/xsimd_neon_uint16.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,25 @@ namespace xsimd
319319
return vbslq_u16(cond, a, b);
320320
}
321321

322-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
323322
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
324323
{
324+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
325325
return vzip1q_u16(lhs, rhs);
326+
#else
327+
uint16x4x2_t tmp = vzip_u16(vget_low_u16(lhs), vget_low_u16(rhs));
328+
return vcombine_u16(tmp.val[0], tmp.val[1]);
329+
#endif
326330
}
327331

328332
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
329333
{
334+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
330335
return vzip2q_u16(lhs, rhs);
331-
}
336+
#else
337+
uint16x4x2_t tmp = vzip_u16(vget_high_u16(lhs), vget_high_u16(rhs));
338+
return vcombine_u16(tmp.val[0], tmp.val[1]);
332339
#endif
340+
}
333341
};
334342
}
335343

include/xsimd/types/xsimd_neon_uint32.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,17 +416,26 @@ namespace xsimd
416416
return vbslq_u32(cond, a, b);
417417
}
418418

419-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
420419
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
421420
{
421+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
422422
return vzip1q_u32(lhs, rhs);
423+
#else
424+
uint32x2x2_t tmp = vzip_u32(vget_low_u32(lhs), vget_low_u32(rhs));
425+
return vcombine_u32(tmp.val[0], tmp.val[1]);
426+
#endif
423427
}
424428

425429
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
426430
{
431+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
427432
return vzip2q_u32(lhs, rhs);
428-
}
433+
#else
434+
uint32x2x2_t tmp = vzip_u32(vget_high_u32(lhs), vget_high_u32(rhs));
435+
return vcombine_u32(tmp.val[0], tmp.val[1]);
429436
#endif
437+
}
438+
430439
};
431440

432441
inline batch<uint32_t, 4> shift_left(const batch<uint32_t, 4>& lhs, int32_t n)

include/xsimd/types/xsimd_neon_uint64.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,24 @@ namespace xsimd
468468
return vbslq_u64(cond, a, b);
469469
}
470470

471-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
472471
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
473472
{
473+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
474474
return vzip1q_u64(lhs, rhs);
475+
#else
476+
return vcombine_u64(vget_low_u64(lhs), vget_low_u64(rhs));
477+
#endif
475478
}
476479

477480
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
478481
{
482+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
479483
return vzip2q_u64(lhs, rhs);
480-
}
484+
#else
485+
return vcombine_u64(vget_high_u64(lhs), vget_high_u64(rhs));
481486
#endif
487+
}
488+
482489
};
483490

484491
inline batch<uint64_t, 2> shift_left(const batch<uint64_t, 2>& lhs, int32_t n)

include/xsimd/types/xsimd_neon_uint8.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,25 @@ namespace xsimd
320320
return vbslq_u8(cond, a, b);
321321
}
322322

323-
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
324323
static batch_type zip_lo(const batch_type& lhs, const batch_type& rhs)
325324
{
325+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
326326
return vzip1q_u8(lhs, rhs);
327+
#else
328+
uint8x8x2_t tmp = vzip_u8(vget_low_u8(lhs), vget_low_u8(rhs));
329+
return vcombine_u8(tmp.val[0], tmp.val[1]);
330+
#endif
327331
}
328332

329333
static batch_type zip_hi(const batch_type& lhs, const batch_type& rhs)
330334
{
335+
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
331336
return vzip2q_u8(lhs, rhs);
332-
}
337+
#else
338+
uint8x8x2_t tmp = vzip_u8(vget_high_u8(lhs), vget_high_u8(rhs));
339+
return vcombine_u8(tmp.val[0], tmp.val[1]);
333340
#endif
341+
}
334342
};
335343
}
336344

0 commit comments

Comments
 (0)