i_sub.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_I_SUB_OPERATOR_H
  8. #define LIBSIMDPP_SIMDPP_CORE_I_SUB_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/expr/i_sub.h>
  14. #include <simdpp/core/detail/get_expr_uint.h>
  15. #include <simdpp/core/detail/scalar_arg_impl.h>
  16. #include <simdpp/core/detail/get_expr_uint.h>
  17. namespace simdpp {
  18. namespace SIMDPP_ARCH_NAMESPACE {
  19. /** Subtracts 8-bit integer values.
  20. @code
  21. r0 = a0 - b0
  22. ...
  23. rN = aN - bN
  24. @endcode
  25. @par 256-bit version:
  26. @icost{SSE2-AVX, NEON, ALTIVEC, 2}
  27. */
  28. template<unsigned N, class V1, class V2> SIMDPP_INL
  29. typename detail::get_expr_uint<expr_isub, V1, V2>::type
  30. operator-(const any_int8<N,V1>& a,
  31. const any_int8<N,V2>& b)
  32. {
  33. return { { a.wrapped(), b.wrapped() } };
  34. }
  35. SIMDPP_SCALAR_ARG_IMPL_INT_UNSIGNED(operator-, expr_isub, any_int8, int8)
  36. /** Subtracts 16-bit integer values.
  37. @code
  38. r0 = a0 - b0
  39. ...
  40. rN = aN - bN
  41. @endcode
  42. @par 256-bit version:
  43. @icost{SSE2-AVX, NEON, ALTIVEC, 2}
  44. */
  45. template<unsigned N, class V1, class V2> SIMDPP_INL
  46. typename detail::get_expr_uint<expr_isub, V1, V2>::type
  47. operator-(const any_int16<N,V1>& a,
  48. const any_int16<N,V2>& b)
  49. {
  50. return { { a.wrapped(), b.wrapped() } };
  51. }
  52. SIMDPP_SCALAR_ARG_IMPL_INT_UNSIGNED(operator-, expr_isub, any_int16, int16)
  53. /** Subtracts 32-bit integer values.
  54. @code
  55. r0 = a0 - b0
  56. ...
  57. rN = aN - bN
  58. @endcode
  59. @par 256-bit version:
  60. @icost{SSE2-AVX, NEON, ALTIVEC, 2}
  61. */
  62. template<unsigned N, class V1, class V2> SIMDPP_INL
  63. typename detail::get_expr_uint<expr_isub, V1, V2>::type
  64. operator-(const any_int32<N,V1>& a,
  65. const any_int32<N,V2>& b)
  66. {
  67. return { { a.wrapped(), b.wrapped() } };
  68. }
  69. SIMDPP_SCALAR_ARG_IMPL_INT_UNSIGNED(operator-, expr_isub, any_int32, int32)
  70. /** Subtracts 64-bit integer values.
  71. @code
  72. r0 = a0 - b0
  73. ...
  74. rN = aN - bN
  75. @endcode
  76. @par 128-bit version:
  77. @icost{ALTIVEC, 5-6}
  78. @par 256-bit version:
  79. @icost{SSE2-AVX, NEON, 2}
  80. @icost{ALTIVEC, 10-11}
  81. */
  82. template<unsigned N, class V1, class V2> SIMDPP_INL
  83. typename detail::get_expr_uint<expr_isub, V1, V2>::type
  84. operator-(const any_int64<N,V1>& a,
  85. const any_int64<N,V2>& b)
  86. {
  87. return { { a.wrapped(), b.wrapped() } };
  88. }
  89. SIMDPP_SCALAR_ARG_IMPL_INT_UNSIGNED(operator-, expr_isub, any_int64, int64)
  90. } // namespace SIMDPP_ARCH_NAMESPACE
  91. } // namespace simdpp
  92. #endif