mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
use __builtin_constant_p() instead for arm as well
This commit is contained in:
parent
725a8d8f1a
commit
cd95b1a38c
@ -328,11 +328,12 @@ m128 palignr_imm(m128 r, m128 l, int offset) {
|
|||||||
|
|
||||||
static really_really_inline
|
static really_really_inline
|
||||||
m128 palignr(m128 r, m128 l, int offset) {
|
m128 palignr(m128 r, m128 l, int offset) {
|
||||||
#if defined(HS_OPTIMIZE)
|
#if defined(HAVE__BUILTIN_CONSTANT_P)
|
||||||
return (m128)vextq_s8((int8x16_t)l, (int8x16_t)r, offset);
|
if (__builtin_constant_p(offset)) {
|
||||||
#else
|
return (m128)vextq_s8((int8x16_t)l, (int8x16_t)r, offset);
|
||||||
return palignr_imm(r, l, offset);
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return palignr_imm(r, l, offset);
|
||||||
}
|
}
|
||||||
#undef CASE_ALIGN_VECTORS
|
#undef CASE_ALIGN_VECTORS
|
||||||
|
|
||||||
|
@ -482,34 +482,27 @@ really_inline SuperVector<16> SuperVector<16>::vshr(uint8_t const N) const
|
|||||||
return vshr_128(N);
|
return vshr_128(N);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HS_OPTIMIZE
|
|
||||||
template <>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
|
|
||||||
{
|
|
||||||
return {vextq_u8(u.u8x16[0], vdupq_n_u8(0), N)};
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
|
really_inline SuperVector<16> SuperVector<16>::operator>>(uint8_t const N) const
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE__BUILTIN_CONSTANT_P)
|
||||||
|
if (__builtin_constant_p(N)) {
|
||||||
|
return {vextq_u8(u.u8x16[0], vdupq_n_u8(0), N)};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return vshr_128(N);
|
return vshr_128(N);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HS_OPTIMIZE
|
|
||||||
template <>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
|
|
||||||
{
|
|
||||||
return {vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N)};
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
|
really_inline SuperVector<16> SuperVector<16>::operator<<(uint8_t const N) const
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE__BUILTIN_CONSTANT_P)
|
||||||
|
if (__builtin_constant_p(N)) {
|
||||||
|
return {vextq_u8(vdupq_n_u8(0), u.u8x16[0], 16 - N)};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return vshl_128(N);
|
return vshl_128(N);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
really_inline SuperVector<16> SuperVector<16>::Ones_vshr(uint8_t const N)
|
really_inline SuperVector<16> SuperVector<16>::Ones_vshr(uint8_t const N)
|
||||||
@ -547,20 +540,18 @@ really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, uint
|
|||||||
return mask & v;
|
return mask & v;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HS_OPTIMIZE
|
|
||||||
template<>
|
template<>
|
||||||
really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, int8_t offset)
|
really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, int8_t offset)
|
||||||
{
|
{
|
||||||
if (offset == 16) {
|
#if defined(HAVE__BUILTIN_CONSTANT_P)
|
||||||
return *this;
|
if (__builtin_constant_p(offset)) {
|
||||||
} else {
|
if (offset == 16) {
|
||||||
return {vextq_u8(other.u.u8x16[0], u.u8x16[0], offset)};
|
return *this;
|
||||||
|
} else {
|
||||||
|
return {vextq_u8(other.u.u8x16[0], u.u8x16[0], offset)};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
#else
|
|
||||||
template<>
|
|
||||||
really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, int8_t offset)
|
|
||||||
{
|
|
||||||
switch(offset) {
|
switch(offset) {
|
||||||
case 0: return other; break;
|
case 0: return other; break;
|
||||||
case 1: return {vextq_u8( other.u.u8x16[0], u.u8x16[0], 1)}; break;
|
case 1: return {vextq_u8( other.u.u8x16[0], u.u8x16[0], 1)}; break;
|
||||||
@ -583,7 +574,6 @@ really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, in
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user