Skip to content

[X86] Do not apply fast-math to the logic intriniscs #118603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/lib/Headers/avx512dqintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ _mm512_maskz_mullo_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
(__v8di)_mm512_setzero_si512());
}

#pragma float_control(push)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is just an experiment. Unfortunately it doesn't help with #118152, so I turn it into draft. Will be back to it if I find useful scenarios.

#pragma float_control(precise, on)
static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_xor_pd(__m512d __A, __m512d __B) {
return (__m512d)((__v8du)__A ^ (__v8du)__B);
Expand Down Expand Up @@ -318,6 +320,7 @@ _mm512_maskz_andnot_ps(__mmask16 __U, __m512 __A, __m512 __B) {
(__v16sf)_mm512_andnot_ps(__A, __B),
(__v16sf)_mm512_setzero_ps());
}
#pragma float_control(pop)

static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvtpd_epi64 (__m512d __A) {
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Headers/avxintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ _mm256_rcp_ps(__m256 __a)
/// \returns A 256-bit vector of [8 x float] containing the rounded down values.
#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)

#pragma float_control(push)
#pragma float_control(precise, on)
/* Logical */
/// Performs a bitwise AND of two 256-bit vectors of [4 x double].
///
Expand Down Expand Up @@ -692,6 +694,7 @@ _mm256_xor_ps(__m256 __a, __m256 __b)
{
return (__m256)((__v8su)__a ^ (__v8su)__b);
}
#pragma float_control(pop)

/* Horizontal arithmetic */
/// Horizontally adds the adjacent pairs of values contained in two
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Headers/xmmintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ _mm_max_ps(__m128 __a, __m128 __b)
return __builtin_ia32_maxps((__v4sf)__a, (__v4sf)__b);
}

#pragma float_control(push)
#pragma float_control(precise, on)
/// Performs a bitwise AND of two 128-bit vectors of [4 x float].
///
/// \headerfile <x86intrin.h>
Expand Down Expand Up @@ -497,6 +499,7 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR
_mm_xor_ps(__m128 __a, __m128 __b) {
return (__m128)((__v4su)__a ^ (__v4su)__b);
}
#pragma float_control(pop)

/// Compares two 32-bit float values in the low-order bits of both
/// operands for equality.
Expand Down
Loading