bit_or.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_BIT_OR_OPERATOR_H
  8. #define LIBSIMDPP_SIMDPP_CORE_BIT_OR_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/bit_or.h>
  14. #include <simdpp/detail/expr/bit_or.h>
  15. #include <simdpp/core/detail/get_expr_bitwise.h>
  16. #include <simdpp/core/detail/scalar_arg_impl.h>
  17. namespace simdpp {
  18. namespace SIMDPP_ARCH_NAMESPACE {
  19. /** Computes bitwise OR of integer vectors.
  20. @code
  21. r0 = a0 | b0
  22. ...
  23. rN = aN | bN
  24. @endcode
  25. @todo icost
  26. */
  27. template<unsigned N, class V1, class V2> SIMDPP_INL
  28. typename detail::get_expr_bit_or<V1, V2>::type
  29. operator|(const any_vec<N,V1>& a, const any_vec<N,V2>& b)
  30. {
  31. return { { a.wrapped(), b.wrapped() } };
  32. }
  33. // support scalar arguments
  34. template<unsigned N, class V> SIMDPP_INL
  35. typename detail::get_expr_bitwise2_and<expr_bit_or, unsigned, V>::type
  36. operator|(const unsigned& a, const any_vec<N,V>& b)
  37. {
  38. return { { a, b.wrapped() } };
  39. }
  40. template<unsigned N, class V> SIMDPP_INL
  41. typename detail::get_expr_bitwise2_and<expr_bit_or, unsigned long, V>::type
  42. operator|(const unsigned long& a, const any_vec<N,V>& b)
  43. {
  44. return { { a, b.wrapped() } };
  45. }
  46. template<unsigned N, class V> SIMDPP_INL
  47. typename detail::get_expr_bitwise2_and<expr_bit_or, unsigned long long, V>::type
  48. operator|(const unsigned long long& a, const any_vec<N,V>& b)
  49. {
  50. return { { a, b.wrapped() } };
  51. }
  52. template<unsigned N, class V> SIMDPP_INL
  53. typename detail::get_expr_bitwise2_and<expr_bit_or, int, V>::type
  54. operator|(const int& a, const any_vec<N,V>& b)
  55. {
  56. return { { a, b.wrapped() } };
  57. }
  58. template<unsigned N, class V> SIMDPP_INL
  59. typename detail::get_expr_bitwise2_and<expr_bit_or, long, V>::type
  60. operator|(const long& a, const any_vec<N,V>& b)
  61. {
  62. return { { a, b.wrapped() } };
  63. }
  64. template<unsigned N, class V> SIMDPP_INL
  65. typename detail::get_expr_bitwise2_and<expr_bit_or, long long, V>::type
  66. operator|(const long long& a, const any_vec<N,V>& b)
  67. {
  68. return { { a, b.wrapped() } };
  69. }
  70. template<unsigned N, class V> SIMDPP_INL
  71. typename detail::get_expr_bitwise2_and<expr_bit_or, V, unsigned>::type
  72. operator|(const any_vec<N,V>& a, const unsigned& b)
  73. {
  74. return { { a.wrapped(), b } };
  75. }
  76. template<unsigned N, class V> SIMDPP_INL
  77. typename detail::get_expr_bitwise2_and<expr_bit_or, V, unsigned long>::type
  78. operator|(const any_vec<N,V>& a, const unsigned long& b)
  79. {
  80. return { { a.wrapped(), b } };
  81. }
  82. template<unsigned N, class V> SIMDPP_INL
  83. typename detail::get_expr_bitwise2_and<expr_bit_or, V, unsigned long long>::type
  84. operator|(const any_vec<N,V>& a, const unsigned long long& b)
  85. {
  86. return { { a.wrapped(), b } };
  87. }
  88. template<unsigned N, class V> SIMDPP_INL
  89. typename detail::get_expr_bitwise2_and<expr_bit_or, V, int>::type
  90. operator|(const any_vec<N,V>& a, const int& b)
  91. {
  92. return { { a.wrapped(), b } };
  93. }
  94. template<unsigned N, class V> SIMDPP_INL
  95. typename detail::get_expr_bitwise2_and<expr_bit_or, V, long>::type
  96. operator|(const any_vec<N,V>& a, const long& b)
  97. {
  98. return { { a.wrapped(), b } };
  99. }
  100. template<unsigned N, class V> SIMDPP_INL
  101. typename detail::get_expr_bitwise2_and<expr_bit_or, V, long long>::type
  102. operator|(const any_vec<N,V>& a, const long long& b)
  103. {
  104. return { { a.wrapped(), b } };
  105. }
  106. } // namespace SIMDPP_ARCH_NAMESPACE
  107. } // namespace simdpp
  108. #endif