f_div.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // This file is generated by tools/gen_operators.pl. CHANGES WILL BE OVERWRITTEN
  2. /* Copyright (C) 2013-2014 Povilas Kanapickas <[email protected]>
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef LIBSIMDPP_SIMDPP_CORE_F_DIV_OPERATOR_H
  8. #define LIBSIMDPP_SIMDPP_CORE_F_DIV_OPERATOR_H
  9. #ifndef LIBSIMDPP_SIMD_H
  10. #error "This file must be included through simd.h"
  11. #endif
  12. #include <simdpp/types.h>
  13. #include <simdpp/detail/insn/f_div.h>
  14. #include <simdpp/core/detail/scalar_arg_impl.h>
  15. namespace simdpp {
  16. namespace SIMDPP_ARCH_NAMESPACE {
  17. /** Divides the values of two vectors.
  18. @code
  19. r0 = a0 / b0
  20. ...
  21. rN = aN / bN
  22. @endcode
  23. @icost{NEON, 6}
  24. @icost{ALTIVEC, 10}
  25. @par 256-bit version:
  26. @icost{SSE2-SSE4.1, 2}
  27. @icost{NEON, 12}
  28. @icost{ALTIVEC, 19}
  29. */
  30. template<unsigned N, class E1, class E2> SIMDPP_INL
  31. float32<N,expr_empty> operator/(const float32<N,E1>& a, const float32<N,E2>& b)
  32. {
  33. return detail::insn::i_div(a.eval(), b.eval());
  34. }
  35. SIMDPP_SCALAR_ARG_IMPL_VEC(operator/, float32, float32)
  36. /** Divides the values of two vectors
  37. @code
  38. r0 = a0 / b0
  39. ...
  40. rN = aN / bN
  41. @endcode
  42. @par 128-bit version:
  43. @novec{NEON, ALTIVEC}
  44. @par 256-bit version:
  45. @icost{SSE2-SSE4.1, 2}
  46. @novec{NEON, ALTIVEC}
  47. */
  48. template<unsigned N, class E1, class E2> SIMDPP_INL
  49. float64<N,expr_empty> operator/(const float64<N,E1>& a, const float64<N,E2>& b)
  50. {
  51. return detail::insn::i_div(a.eval(), b.eval());
  52. }
  53. SIMDPP_SCALAR_ARG_IMPL_VEC(operator/, float64, float64)
  54. } // namespace SIMDPP_ARCH_NAMESPACE
  55. } // namespace simdpp
  56. #endif