@@ -1698,8 +1698,7 @@ namespace xsimd
1698
1698
return self;
1699
1699
}
1700
1700
// 1) duplicate‐low‐half?
1701
- constexpr bool dup_lo = detail::is_dup_lo (mask);
1702
- XSIMD_IF_CONSTEXPR (dup_lo)
1701
+ XSIMD_IF_CONSTEXPR (detail::is_dup_lo (mask))
1703
1702
{
1704
1703
// permute low half and broadcast
1705
1704
const auto lo = _mm_shufflelo_epi16 (self, imm_lo);
@@ -1708,8 +1707,7 @@ namespace xsimd
1708
1707
}
1709
1708
1710
1709
// 2) duplicate‐high‐half?
1711
- constexpr bool dup_hi = detail::is_dup_hi (mask);
1712
- XSIMD_IF_CONSTEXPR (dup_hi)
1710
+ XSIMD_IF_CONSTEXPR (detail::is_dup_hi (mask))
1713
1711
{
1714
1712
// permute high half and broadcast
1715
1713
const auto hi = _mm_shufflehi_epi16 (self, imm_lo);
@@ -1725,26 +1723,28 @@ namespace xsimd
1725
1723
_mm_shufflelo_epi16 (self, imm_hi), // permute words 0-3 (hi pattern)
1726
1724
_mm_shufflelo_epi16 (self, imm_hi));
1727
1725
1728
- const auto hi0_all = [&]
1726
+ __m128i hi0_all;
1727
+ XSIMD_IF_CONSTEXPR (!detail::is_identity<uint16_t , V0, V1, V2, V3>())
1729
1728
{
1730
- XSIMD_IF_CONSTEXPR (detail::is_identity<uint32_t , V0, V1, V2, V3>())
1731
- {
1732
- return _mm_unpackhi_epi64 (self, self);
1733
- }
1734
- __m128i hi = _mm_shufflehi_epi16 (self, imm_lo); // permute 4-7
1735
- return _mm_unpackhi_epi64 (hi, hi); // broadcast
1736
- }();
1729
+ __m128i hi = _mm_shufflehi_epi16 (self, imm_lo);
1730
+ hi0_all = _mm_unpackhi_epi64 (hi, hi);
1731
+ }
1732
+ else
1733
+ {
1734
+ // if the “low-pattern” is identity in the high half, just keep it
1735
+ hi0_all = _mm_unpackhi_epi64 (self, self);
1736
+ }
1737
1737
1738
- // ----- build hi1_all ---------------------------------------------------
1739
- const auto hi1_all = [&]
1738
+ __m128i hi1_all;
1739
+ XSIMD_IF_CONSTEXPR (!detail::is_identity< int32_t , V4 - 4 , V5 - 4 , V6 - 4 , V7 - 4 >())
1740
1740
{
1741
- XSIMD_IF_CONSTEXPR (detail::is_identity<int32_t , V4 - 4 , V5 - 4 , V6 - 4 , V7 - 4 >())
1742
- {
1743
- return _mm_unpackhi_epi64 (self, self);
1744
- }
1745
1741
__m128i hi = _mm_shufflehi_epi16 (self, imm_hi);
1746
- return _mm_unpackhi_epi64 (hi, hi);
1747
- }();
1742
+ hi1_all = _mm_unpackhi_epi64 (hi, hi);
1743
+ }
1744
+ else
1745
+ {
1746
+ hi1_all = _mm_unpackhi_epi64 (self, self);
1747
+ }
1748
1748
1749
1749
// merge halves
1750
1750
const auto low_all = _mm_unpacklo_epi64 (lo0_all, lo1_all);
0 commit comments