1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2015 Benoit Steiner <benoit.steiner.goog@gmail.com>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_TYPE_CASTING_AVX_H
11#define EIGEN_TYPE_CASTING_AVX_H
12
13namespace Eigen {
14
15namespace internal {
16
17// For now we use SSE to handle integers, so we can't use AVX instructions to cast
18// from int to float
19template <>
20struct type_casting_traits<float, int> {
21  enum {
22    VectorizedCast = 0,
23    SrcCoeffRatio = 1,
24    TgtCoeffRatio = 1
25  };
26};
27
28template <>
29struct type_casting_traits<int, float> {
30  enum {
31    VectorizedCast = 0,
32    SrcCoeffRatio = 1,
33    TgtCoeffRatio = 1
34  };
35};
36
37
38
39template<> EIGEN_STRONG_INLINE Packet8i pcast<Packet8f, Packet8i>(const Packet8f& a) {
40  return _mm256_cvtps_epi32(a);
41}
42
43template<> EIGEN_STRONG_INLINE Packet8f pcast<Packet8i, Packet8f>(const Packet8i& a) {
44  return _mm256_cvtepi32_ps(a);
45}
46
47} // end namespace internal
48
49} // end namespace Eigen
50
51#endif // EIGEN_TYPE_CASTING_AVX_H
52