1/* Copyright (C) 2013-2014 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_DETAIL_EXPR_I_MUL_H
9#define LIBSIMDPP_SIMDPP_DETAIL_EXPR_I_MUL_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/get_expr.h>
17#include <simdpp/detail/insn/i_mul_lo.h>
18#include <simdpp/detail/insn/i_mul_hi.h>
19
20namespace simdpp {
21namespace SIMDPP_ARCH_NAMESPACE {
22namespace detail {
23
24template<class R, class E1, class E2>
25struct expr_eval<R, expr_mul_lo<E1, E2>> {
26 static SIMDPP_INL R eval(const expr_mul_lo<E1, E2>& e)
27 {
28 using E = get_expr_uint_impl<E1, E2>;
29 return (R) insn::i_mul_lo(
30 eval_maybe_scalar<typename E::v1_final_type, E1>::eval(e.a),
31 eval_maybe_scalar<typename E::v2_final_type, E2>::eval(e.b));
32 }
33};
34
35template<class R, class E1, class E2>
36struct expr_eval<R, expr_mul_hi<E1, E2>> {
37 static SIMDPP_INL R eval(const expr_mul_hi<E1, E2>& e)
38 {
39 using E = get_expr2_same<E1, E2>;
40 return (R) insn::i_mul_hi(
41 eval_maybe_scalar<typename E::v1_final_type, E1>::eval(e.a),
42 eval_maybe_scalar<typename E::v2_final_type, E2>::eval(e.b));
43 }
44};
45
46} // namespace detail
47} // namespace SIMDPP_ARCH_NAMESPACE
48} // namespace simdpp
49
50#endif
51
52