Skip to content

Commit d6cae65

Browse files
committed
Experimental: Simplify removal of __2x calls
include/ChangeLog: * bits/simd_math.h (_GLIBCXX_SIMD_MATH_CALL2_HANDLE_2X): New. (_GLIBCXX_SIMD_MATH_CALL2): Use _GLIBCXX_SIMD_MATH_CALL2_HANDLE_2X.
1 parent 5cdf61c commit d6cae65

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

include/bits/simd_math.h

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,24 @@ namespace std::simd
262262
return _Vp::_S_init(fn<_Traits>(__x._M_get_low()), fn(__x._M_get_high())); \
263263
}
264264
265+
#if 1
266+
#define _GLIBCXX_SIMD_MATH_CALL2_HANDLE_2X(fn) \
267+
else if constexpr (_Vp::abi_type::_S_nreg == 2 && _Traits._M_fast_math() \
268+
&& !_GLIBCXX_SIMD_HAS_SIMD_CLONE(fn)) \
269+
{ \
270+
_GLIBCXX_SIMD_MATH_2X_CALL2(__fast_2x_##fn<_ArchTraits(_Traits)._M_math_abi()>, \
271+
__x, __y); \
272+
return _Vp::_S_init(__lo, __hi); \
273+
} \
274+
else if constexpr (_Vp::abi_type::_S_nreg == 2 && !_Traits._M_fast_math()) \
275+
{ \
276+
_GLIBCXX_SIMD_MATH_2X_CALL2(__2x_##fn<_Traits._M_math_abi()>, __x, __y); \
277+
return _Vp::_S_init(__lo, __hi); \
278+
}
279+
#else
280+
#define _GLIBCXX_SIMD_MATH_CALL2_HANDLE_2X(fn)
281+
#endif
282+
265283
#define _GLIBCXX_SIMD_MATH_CALL2(fn, allow_clone) \
266284
template <_ArchTraits, __simd_clonable _TV> \
267285
requires (allow_clone && _GLIBCXX_SIMD_HAS_SIMD_CLONE(fn)) \
@@ -311,18 +329,7 @@ namespace std::simd
311329
return __fast_##fn<_ArchTraits(_Traits)._M_math_abi()>(__x._M_get(), __y._M_get()); \
312330
else if constexpr (_Vp::abi_type::_S_nreg == 1) \
313331
return __##fn<_Traits._M_math_abi()>(__x._M_get(), __y._M_get()); \
314-
else if constexpr (_Vp::abi_type::_S_nreg == 2 && _Traits._M_fast_math() \
315-
&& !_GLIBCXX_SIMD_HAS_SIMD_CLONE(fn)) \
316-
{ \
317-
_GLIBCXX_SIMD_MATH_2X_CALL2(__fast_2x_##fn<_ArchTraits(_Traits)._M_math_abi()>, \
318-
__x, __y); \
319-
return _Vp::_S_init(__lo, __hi); \
320-
} \
321-
else if constexpr (_Vp::abi_type::_S_nreg == 2 && !_Traits._M_fast_math()) \
322-
{ \
323-
_GLIBCXX_SIMD_MATH_2X_CALL2(__2x_##fn<_Traits._M_math_abi()>, __x, __y); \
324-
return _Vp::_S_init(__lo, __hi); \
325-
} \
332+
_GLIBCXX_SIMD_MATH_CALL2_HANDLE_2X(fn) \
326333
else \
327334
return _Vp::_S_init(fn<_Traits>(__x._M_get_low(), __y._M_get_low()), \
328335
fn<_Traits>(__x._M_get_high(), __y._M_get_high())); \

0 commit comments

Comments
 (0)