mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix warnings reported by NVHPC 26.1
libeigen/eigen!2324 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -474,8 +474,8 @@ struct dense_assignment_loop_impl<Kernel, LinearVectorizedTraversal, NoUnrolling
|
||||
static constexpr int SrcAlignment = Kernel::AssignmentTraits::JointAlignment;
|
||||
static constexpr int DstAlignment = plain_enum_max(Kernel::AssignmentTraits::DstAlignment, alignof(Scalar));
|
||||
static constexpr int RequestedAlignment = unpacket_traits<PacketType>::alignment;
|
||||
static constexpr bool Alignable =
|
||||
(DstAlignment >= RequestedAlignment) || ((RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
|
||||
static constexpr bool Alignable = (DstAlignment >= RequestedAlignment) ||
|
||||
(static_cast<std::size_t>(RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
|
||||
static constexpr int Alignment = Alignable ? RequestedAlignment : DstAlignment;
|
||||
static constexpr bool DstIsAligned = DstAlignment >= Alignment;
|
||||
static constexpr bool UsePacketSegment = Kernel::AssignmentTraits::UsePacketSegment;
|
||||
@@ -587,8 +587,8 @@ struct dense_assignment_loop_impl<Kernel, SliceVectorizedTraversal, NoUnrolling>
|
||||
static constexpr int SrcAlignment = Kernel::AssignmentTraits::JointAlignment;
|
||||
static constexpr int DstAlignment = plain_enum_max(Kernel::AssignmentTraits::DstAlignment, alignof(Scalar));
|
||||
static constexpr int RequestedAlignment = unpacket_traits<PacketType>::alignment;
|
||||
static constexpr bool Alignable =
|
||||
(DstAlignment >= RequestedAlignment) || ((RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
|
||||
static constexpr bool Alignable = (DstAlignment >= RequestedAlignment) ||
|
||||
(static_cast<std::size_t>(RequestedAlignment - DstAlignment) % sizeof(Scalar) == 0);
|
||||
static constexpr int Alignment = Alignable ? RequestedAlignment : DstAlignment;
|
||||
static constexpr bool DstIsAligned = DstAlignment >= Alignment;
|
||||
static constexpr bool UsePacketSegment = Kernel::AssignmentTraits::UsePacketSegment;
|
||||
|
||||
@@ -46,6 +46,7 @@ struct visitor_impl<Visitor, Derived, UnrollCount, Vectorize, false, ShortCircui
|
||||
|
||||
static constexpr bool CanVectorize(int K) {
|
||||
constexpr int InnerSizeAtCompileTime = RowMajor ? ColsAtCompileTime : RowsAtCompileTime;
|
||||
if (InnerSizeAtCompileTime <= 0) return false;
|
||||
if (InnerSizeAtCompileTime < PacketSize) return false;
|
||||
return Vectorize && (InnerSizeAtCompileTime - (K % InnerSizeAtCompileTime) >= PacketSize);
|
||||
}
|
||||
|
||||
@@ -2127,7 +2127,7 @@ EIGEN_STRONG_INLINE Packet8h ptrue(const Packet8h& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet8h pabs(const Packet8h& a) {
|
||||
const __m128i sign_mask = _mm_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
const __m128i sign_mask = _mm_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm_andnot_si128(sign_mask, a);
|
||||
}
|
||||
|
||||
@@ -2282,7 +2282,7 @@ EIGEN_STRONG_INLINE Packet8h pconj(const Packet8h& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet8h pnegate(const Packet8h& a) {
|
||||
Packet8h sign_mask = _mm_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
Packet8h sign_mask = _mm_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm_xor_si128(a, sign_mask);
|
||||
}
|
||||
|
||||
@@ -2561,7 +2561,7 @@ EIGEN_STRONG_INLINE Packet8bf ptrue(const Packet8bf& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet8bf pabs(const Packet8bf& a) {
|
||||
const __m128i sign_mask = _mm_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
const __m128i sign_mask = _mm_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm_andnot_si128(sign_mask, a);
|
||||
}
|
||||
|
||||
@@ -2654,7 +2654,7 @@ EIGEN_STRONG_INLINE Packet8bf pconj(const Packet8bf& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet8bf pnegate(const Packet8bf& a) {
|
||||
Packet8bf sign_mask = _mm_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
Packet8bf sign_mask = _mm_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm_xor_si128(a, sign_mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -2178,7 +2178,7 @@ EIGEN_STRONG_INLINE Packet16h ptrue(const Packet16h& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet16h pabs(const Packet16h& a) {
|
||||
const __m256i sign_mask = _mm256_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
const __m256i sign_mask = _mm256_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm256_andnot_si256(sign_mask, a);
|
||||
}
|
||||
|
||||
@@ -2275,7 +2275,7 @@ EIGEN_STRONG_INLINE Packet16h pconj(const Packet16h& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet16h pnegate(const Packet16h& a) {
|
||||
Packet16h sign_mask = _mm256_set1_epi16(static_cast<unsigned short>(0x8000));
|
||||
Packet16h sign_mask = _mm256_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm256_xor_si256(a, sign_mask);
|
||||
}
|
||||
|
||||
@@ -2766,7 +2766,7 @@ EIGEN_STRONG_INLINE Packet16bf pcmp_lt_or_nan(const Packet16bf& a, const Packet1
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet16bf pnegate(const Packet16bf& a) {
|
||||
Packet16bf sign_mask = _mm256_set1_epi16(static_cast<unsigned short>(0x8000));
|
||||
Packet16bf sign_mask = _mm256_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm256_xor_si256(a, sign_mask);
|
||||
}
|
||||
|
||||
@@ -2777,7 +2777,7 @@ EIGEN_STRONG_INLINE Packet16bf pconj(const Packet16bf& a) {
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet16bf pabs(const Packet16bf& a) {
|
||||
const __m256i sign_mask = _mm256_set1_epi16(static_cast<numext::uint16_t>(0x8000));
|
||||
const __m256i sign_mask = _mm256_set1_epi16(static_cast<short>(0x8000u));
|
||||
return _mm256_andnot_si256(sign_mask, a);
|
||||
}
|
||||
|
||||
|
||||
@@ -878,19 +878,17 @@ EIGEN_STRONG_INLINE Packet8h pnmsub(const Packet8h& a, const Packet8h& b, const
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet32h pnegate<Packet32h>(const Packet32h& a) {
|
||||
return _mm512_castsi512_ph(
|
||||
_mm512_xor_si512(_mm512_castph_si512(a), _mm512_set1_epi16(static_cast<std::uint16_t>(0x8000u))));
|
||||
return _mm512_castsi512_ph(_mm512_xor_si512(_mm512_castph_si512(a), _mm512_set1_epi16(static_cast<short>(0x8000u))));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet16h pnegate<Packet16h>(const Packet16h& a) {
|
||||
return _mm256_castsi256_ph(
|
||||
_mm256_xor_si256(_mm256_castph_si256(a), _mm256_set1_epi16(static_cast<std::uint16_t>(0x8000u))));
|
||||
return _mm256_castsi256_ph(_mm256_xor_si256(_mm256_castph_si256(a), _mm256_set1_epi16(static_cast<short>(0x8000u))));
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_STRONG_INLINE Packet8h pnegate<Packet8h>(const Packet8h& a) {
|
||||
return _mm_castsi128_ph(_mm_xor_si128(_mm_castph_si128(a), _mm_set1_epi16(static_cast<std::uint16_t>(0x8000u))));
|
||||
return _mm_castsi128_ph(_mm_xor_si128(_mm_castph_si128(a), _mm_set1_epi16(static_cast<short>(0x8000u))));
|
||||
}
|
||||
|
||||
// pconj
|
||||
|
||||
@@ -420,7 +420,7 @@ template <typename T>
|
||||
EIGEN_DEVICE_FUNC inline T* aligned_new(std::size_t size) {
|
||||
check_size_for_overflow<T>(size);
|
||||
T* result = static_cast<T*>(aligned_malloc(sizeof(T) * size));
|
||||
EIGEN_TRY { return default_construct_elements_of_array(result, size); }
|
||||
EIGEN_TRY { default_construct_elements_of_array(result, size); }
|
||||
EIGEN_CATCH(...) {
|
||||
aligned_free(result);
|
||||
EIGEN_THROW;
|
||||
@@ -432,7 +432,7 @@ template <typename T, bool Align>
|
||||
EIGEN_DEVICE_FUNC inline T* conditional_aligned_new(std::size_t size) {
|
||||
check_size_for_overflow<T>(size);
|
||||
T* result = static_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T) * size));
|
||||
EIGEN_TRY { return default_construct_elements_of_array(result, size); }
|
||||
EIGEN_TRY { default_construct_elements_of_array(result, size); }
|
||||
EIGEN_CATCH(...) {
|
||||
conditional_aligned_free<Align>(result);
|
||||
EIGEN_THROW;
|
||||
|
||||
@@ -293,7 +293,8 @@ void mixingtypes(int size = SizeAtCompileType) {
|
||||
}
|
||||
|
||||
EIGEN_DECLARE_TEST(mixingtypes) {
|
||||
g_called = false; // Silence -Wunneeded-internal-declaration.
|
||||
g_called = false; // Silence -Wunneeded-internal-declaration and set_but_not_used.
|
||||
VERIFY(true || g_called);
|
||||
for (int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST_1(mixingtypes<3>());
|
||||
CALL_SUBTEST_2(mixingtypes<4>());
|
||||
|
||||
@@ -298,7 +298,7 @@ struct test_cast_helper<SrcPacket, TgtPacket, SrcCoeffRatio, TgtCoeffRatio, true
|
||||
}
|
||||
|
||||
for (int i = 0; i < DataSize; ++i) {
|
||||
ref[i] = static_cast<const TgtScalar>(data1[i]);
|
||||
ref[i] = static_cast<TgtScalar>(data1[i]);
|
||||
}
|
||||
|
||||
pcast_array<SrcPacket, TgtPacket, SrcCoeffRatio, TgtCoeffRatio>::cast(data1, DataSize, data2);
|
||||
|
||||
Reference in New Issue
Block a user