-
Notifications
You must be signed in to change notification settings - Fork 386
[UnitTests] Add initial set of tests with multiple early exits. #325
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
base: main
Are you sure you want to change the base?
Conversation
|
I took the initiative to approve #264 even though I am not in the reviewer list since none of the revierer's remarks seem to have been resolved. It will be much easier to review this one when I can see the actual diff. |
93608f8 to
5bb9dbc
Compare
fhahn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased and simplified a bit
| , A, B, C, for (unsigned I = 0; I < N; I++) { | ||
| if (A[I] == 0) | ||
| return I; | ||
| if (A[I] == B[I]) | ||
| return I + 1000; | ||
| } return -1;); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| , A, B, C, for (unsigned I = 0; I < N; I++) { | |
| if (A[I] == 0) | |
| return I; | |
| if (A[I] == B[I]) | |
| return I + 1000; | |
| } return -1;); | |
| , A, B, C, { for (unsigned I = 0; I < N; I++) { | |
| if (A[I] == 0) | |
| return I; | |
| if (A[I] == B[I]) | |
| return I + 1000; | |
| } return -1;}); |
braces may help clang-format to format this better as code:
DEFINE_SCALAR_AND_VECTOR_EARLY_EXIT_2(int A[N]; int B[N]; int C[N];, A, B, C, {
for (unsigned I = 0; I < N; I++) {
if (A[I] == 0)
return I;
if (A[I] == B[I])
return I + 1000;
}
return -1;
});| #include <stdint.h> | ||
|
|
||
| #define N 512 | ||
| // N_ODD is not divisible by common VFs (4, 8, 16) to test scalar epilogue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // N_ODD is not divisible by common VFs (4, 8, 16) to test scalar epilogue. | |
| /// N_ODD is not divisible by common VFs (4, 8, 16) to test scalar epilogue. |
| // N_SMALL is a small trip count divisible by common VFs, allowing the compiler | ||
| // to potentially eliminate the scalar remainder loop entirely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // N_SMALL is a small trip count divisible by common VFs, allowing the compiler | |
| // to potentially eliminate the scalar remainder loop entirely. | |
| /// N_SMALL is a small trip count divisible by common VFs, allowing the compiler | |
| /// to potentially eliminate the scalar remainder loop entirely. |
| #include <limits> | ||
| #include <stdint.h> | ||
|
|
||
| #define N 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It it is worth extracting out the constant, also give it a description of where it is used?
Extend the single-early exits tests (#264) to also test loops with multiple exits.
Depends on #264 (included in PR)