1/* Copyright (C) 2016 Povilas Kanapickas <povilas@radix.lt>
2
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
8#ifndef LIBSIMDPP_SIMDPP_CORE_I_REDUCE_MAX_H
9#define LIBSIMDPP_SIMDPP_CORE_I_REDUCE_MAX_H
10
11#ifndef LIBSIMDPP_SIMD_H
12 #error "This file must be included through simd.h"
13#endif
14
15#include <simdpp/types.h>
16#include <simdpp/detail/insn/i_reduce_max.h>
17
18namespace simdpp {
19namespace SIMDPP_ARCH_NAMESPACE {
20
21
22/** Computes the maximum of the elements in the vector
23
24 @code
25 r0 = max(a0, a1, a2, ...)
26 @endcode
27*/
28template<unsigned N, class E> SIMDPP_INL
29int8_t reduce_max(const int8<N,E>& a)
30{
31 return detail::insn::i_reduce_max(a.eval());
32}
33
34template<unsigned N, class E> SIMDPP_INL
35uint8_t reduce_max(const uint8<N,E>& a)
36{
37 return detail::insn::i_reduce_max(a.eval());
38}
39
40template<unsigned N, class E> SIMDPP_INL
41int16_t reduce_max(const int16<N,E>& a)
42{
43 return detail::insn::i_reduce_max(a.eval());
44}
45
46template<unsigned N, class E> SIMDPP_INL
47uint16_t reduce_max(const uint16<N,E>& a)
48{
49 return detail::insn::i_reduce_max(a.eval());
50}
51
52template<unsigned N, class E> SIMDPP_INL
53int32_t reduce_max(const int32<N,E>& a)
54{
55 return detail::insn::i_reduce_max(a.eval());
56}
57
58template<unsigned N, class E> SIMDPP_INL
59uint32_t reduce_max(const uint32<N,E>& a)
60{
61 return detail::insn::i_reduce_max(a.eval());
62}
63
64template<unsigned N, class E> SIMDPP_INL
65int64_t reduce_max(const int64<N,E>& a)
66{
67 return detail::insn::i_reduce_max(a.eval());
68}
69
70template<unsigned N, class E> SIMDPP_INL
71uint64_t reduce_max(const uint64<N,E>& a)
72{
73 return detail::insn::i_reduce_max(a.eval());
74}
75
76} // namespace SIMDPP_ARCH_NAMESPACE
77} // namespace simdpp
78
79#endif
80
81