Skip to content
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

Fix lto2.test_avx_nontrapping #22911

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ jobs:
test_targets: "
lto2.test_dylink_syslibs_all
lto2.test_float_builtins
lto2.test_avx_nontrapping
lto0.test_exceptions_allowed_uncaught
lto0.test_longjmp_standalone_standalone
lto0.test_embind_i64_val
Expand Down
19 changes: 11 additions & 8 deletions system/include/compat/emmintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ _mm_cvtpd_epi32(__m128d __a)
int m[2];
for(int i = 0; i < 2; ++i)
{
int x = lrint(__a[i]);
if (x != 0 || fabs(__a[i]) < 2.0)
m[i] = (int)x;
double e = __a[i];
int x = lrint(e);
if ((x != 0 || fabs(e) < 2.0) && !isnan(e) && e <= INT_MAX && e >= INT_MIN)
m[i] = x;
else
m[i] = (int)0x80000000;
}
Expand All @@ -396,9 +397,10 @@ static __inline__ int __attribute__((__always_inline__, __nodebug__))
_mm_cvtsd_si32(__m128d __a)
{
// TODO: OPTIMIZE!
int x = lrint(__a[0]);
if (x != 0 || fabs(__a[0]) < 2.0)
return (int)x;
double e = __a[0];
int x = lrint(e);
if ((x != 0 || fabs(e) < 2.0) && !isnan(e) && e <= INT_MAX && e >= INT_MIN)
return x;
else
return (int)0x80000000;
}
Expand Down Expand Up @@ -1045,8 +1047,9 @@ _mm_cvtps_epi32(__m128 __a)
} u;
for(int i = 0; i < 4; ++i)
{
int x = lrint(__a[i]);
if (x != 0 || fabs(__a[i]) < 2.0)
double e = __a[i];
int x = lrint(e);
if ((x != 0 || fabs(e) < 2.0) && !isnan(e) && e <= INT_MAX && e >= INT_MIN)
u.x[i] = x;
else
u.x[i] = (int)0x80000000;
Expand Down
Loading