Skip to content

Commit

Permalink
Merge pull request #594 from Cuda-Chen/add-infinity-test
Browse files Browse the repository at this point in the history
Add infinity test in `test_mm_{max,min}_{pd,sd}`
  • Loading branch information
jserv committed Apr 25, 2023
2 parents 32ad00d + b501ecd commit b7417bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ class SSE2NEONTestImpl : public SSE2NEONTest
}
}

if (test == it_mm_max_pd || test == it_mm_max_sd ||
test == it_mm_min_pd || test == it_mm_min_sd) {
// Make sure the positive/negative inifinity values are included
// in the testing one out of four times.
if ((rand() & 3) == 0) {
uint32_t r1 = ((rand() & 1) << 1) + 1;
uint32_t r2 = ((rand() & 1) << 1) + 1;
uint32_t r3 = ((rand() & 1) << 1) + 1;
uint32_t r4 = ((rand() & 1) << 1) + 1;
mTestFloatPointer1[r1] = INFINITY;
mTestFloatPointer2[r2] = INFINITY;
mTestFloatPointer1[r3] = -INFINITY;
mTestFloatPointer1[r4] = -INFINITY;
}
}

#if SSE2NEON_PRECISE_MINMAX
if (test == it_mm_max_ps || test == it_mm_max_ss ||
test == it_mm_min_ps || test == it_mm_min_ss) {
Expand Down

0 comments on commit b7417bc

Please sign in to comment.