Skip to content

Commit 55bc639

Browse files
authored
Merge pull request #350 from johannes-menzel/jmenzel/fix-AVXFloat-type
Added vector_traits<simd::VectorAVXFloat> to correctly represent the properties of VectorAVXFloat
2 parents 1b605db + 65fb93e commit 55bc639

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

include/libint2/util/vector_x86.h

+39-14
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,40 @@ inline VectorAVXDouble erfc(VectorAVXDouble a) {
927927
return result;
928928
}
929929

930+
}; // namespace simd
931+
}; // namespace libint2
932+
933+
//@{ standard stream operations
934+
inline std::ostream& operator<<(std::ostream& os,
935+
libint2::simd::VectorAVXDouble a) {
936+
double ad[4];
937+
a.convert(ad);
938+
os << "{" << ad[0] << "," << ad[1] << "," << ad[2] << "," << ad[3] << "}";
939+
return os;
940+
}
941+
942+
namespace libint2 {
943+
944+
//@{ vector traits of VectorAVXDouble
945+
946+
template <>
947+
struct is_vector<simd::VectorAVXDouble> {
948+
static const bool value = true;
949+
};
950+
951+
template <>
952+
struct vector_traits<simd::VectorAVXDouble> {
953+
typedef double scalar_type;
954+
static const size_t extent = 4;
955+
};
956+
957+
//@}
958+
959+
} // namespace libint2
960+
961+
namespace libint2 {
962+
namespace simd {
963+
930964
/**
931965
* SIMD vector of 8 single-precision floating-point real numbers, operations on
932966
* which use AVX instructions available on recent x86 hardware from Intel
@@ -1149,15 +1183,6 @@ inline VectorAVXFloat erfc(VectorAVXFloat a) {
11491183
}; // namespace simd
11501184
}; // namespace libint2
11511185

1152-
//@{ standard stream operations
1153-
inline std::ostream& operator<<(std::ostream& os,
1154-
libint2::simd::VectorAVXDouble a) {
1155-
double ad[4];
1156-
a.convert(ad);
1157-
os << "{" << ad[0] << "," << ad[1] << "," << ad[2] << "," << ad[3] << "}";
1158-
return os;
1159-
}
1160-
11611186
//@{ standard stream operations
11621187
inline std::ostream& operator<<(std::ostream& os,
11631188
libint2::simd::VectorAVXFloat a) {
@@ -1171,17 +1196,17 @@ inline std::ostream& operator<<(std::ostream& os,
11711196

11721197
namespace libint2 {
11731198

1174-
//@{ vector traits of VectorAVXDouble
1199+
//@{ vector traits of VectorAVXFloat
11751200

11761201
template <>
1177-
struct is_vector<simd::VectorAVXDouble> {
1202+
struct is_vector<simd::VectorAVXFloat> {
11781203
static const bool value = true;
11791204
};
11801205

11811206
template <>
1182-
struct vector_traits<simd::VectorAVXDouble> {
1183-
typedef double scalar_type;
1184-
static const size_t extent = 4;
1207+
struct vector_traits<simd::VectorAVXFloat> {
1208+
typedef float scalar_type;
1209+
static const size_t extent = 8;
11851210
};
11861211

11871212
//@}

0 commit comments

Comments
 (0)