cmp_ge.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Copyright (C) 2013-2014 Povilas Kanapickas <[email protected]>
  2. Distributed under the Boost Software License, Version 1.0.
  3. (See accompanying file LICENSE_1_0.txt or copy at
  4. http://www.boost.org/LICENSE_1_0.txt)
  5. */
  6. #ifndef LIBSIMDPP_SIMDPP_CORE_CMP_GE_H
  7. #define LIBSIMDPP_SIMDPP_CORE_CMP_GE_H
  8. #ifndef LIBSIMDPP_SIMD_H
  9. #error "This file must be included through simd.h"
  10. #endif
  11. #include <simdpp/types.h>
  12. #include <simdpp/detail/insn/cmp_ge.h>
  13. #include <simdpp/core/detail/scalar_arg_impl.h>
  14. namespace simdpp {
  15. namespace SIMDPP_ARCH_NAMESPACE {
  16. /** Compares the values of two signed int16x8 vectors for greater-than
  17. @code
  18. r0 = (a0 >= b0) ? ~0x0 : 0x0
  19. ...
  20. rN = (aN >= bN) ? ~0x0 : 0x0
  21. @endcode
  22. */
  23. template<unsigned N, class E1, class E2> SIMDPP_INL
  24. mask_int8<N,expr_empty> cmp_ge(const int8<N,E1>& a,
  25. const int8<N,E2>& b)
  26. {
  27. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  28. }
  29. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, int8)
  30. template<unsigned N, class E1, class E2> SIMDPP_INL
  31. mask_int8<N,expr_empty> cmp_ge(const uint8<N,E1>& a,
  32. const uint8<N,E2>& b)
  33. {
  34. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  35. }
  36. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int8, uint8)
  37. template<unsigned N, class E1, class E2> SIMDPP_INL
  38. mask_int16<N,expr_empty> cmp_ge(const int16<N,E1>& a,
  39. const int16<N,E2>& b)
  40. {
  41. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  42. }
  43. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, int16)
  44. template<unsigned N, class E1, class E2> SIMDPP_INL
  45. mask_int16<N,expr_empty> cmp_ge(const uint16<N,E1>& a,
  46. const uint16<N,E2>& b)
  47. {
  48. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  49. }
  50. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int16, uint16)
  51. template<unsigned N, class E1, class E2> SIMDPP_INL
  52. mask_int32<N,expr_empty> cmp_ge(const int32<N,E1>& a,
  53. const int32<N,E2>& b)
  54. {
  55. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  56. }
  57. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, int32)
  58. template<unsigned N, class E1, class E2> SIMDPP_INL
  59. mask_int32<N,expr_empty> cmp_ge(const uint32<N,E1>& a,
  60. const uint32<N,E2>& b)
  61. {
  62. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  63. }
  64. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int32, uint32)
  65. template<unsigned N, class E1, class E2> SIMDPP_INL
  66. mask_int64<N,expr_empty> cmp_ge(const int64<N,E1>& a,
  67. const int64<N,E2>& b)
  68. {
  69. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  70. }
  71. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int64, int64)
  72. template<unsigned N, class E1, class E2> SIMDPP_INL
  73. mask_int64<N,expr_empty> cmp_ge(const uint64<N,E1>& a,
  74. const uint64<N,E2>& b)
  75. {
  76. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  77. }
  78. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_int64, uint64)
  79. /** Compares the values of two float32x4 vectors for greater-than or equal
  80. @code
  81. r0 = (a0 >= b0) ? 0xffffffff : 0x0
  82. ...
  83. rN = (aN >= bN) ? 0xffffffff : 0x0
  84. @endcode
  85. @par 256-bit version:
  86. @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
  87. */
  88. template<unsigned N, class E1, class E2> SIMDPP_INL
  89. mask_float32<N,expr_empty> cmp_ge(const float32<N,E1>& a,
  90. const float32<N,E2>& b)
  91. {
  92. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  93. }
  94. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_float32, float32)
  95. /** Compares the values of two float64x2 vectors for greater-than
  96. @code
  97. r0 = (a0 >= b0) ? 0xffffffffffffffff : 0x0
  98. ...
  99. rN = (aN >= bN) ? 0xffffffffffffffff : 0x0
  100. @endcode
  101. @par 128-bit version:
  102. @novec{NEON, ALTIVEC}
  103. @par 256-bit version:
  104. @novec{NEON, ALTIVEC}
  105. @icost{SSE2-SSE4.1, 2}
  106. */
  107. template<unsigned N, class E1, class E2> SIMDPP_INL
  108. mask_float64<N,expr_empty> cmp_ge(const float64<N,E1>& a,
  109. const float64<N,E2>& b)
  110. {
  111. return detail::insn::i_cmp_ge(a.eval(), b.eval());
  112. }
  113. SIMDPP_SCALAR_ARG_IMPL_VEC(cmp_ge, mask_float64, float64)
  114. } // namespace SIMDPP_ARCH_NAMESPACE
  115. } // namespace simdpp
  116. #endif