We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Optimizer bug needs to be fixed for this test case (optimizer effectively creates a NOP!):
#include <stdio.h> #include <stdlib.h> void bubblesort(float *c, int n) { float v1, v2; int i, done; do { done = 1; // --n; v1 = c[0]; for (i=1; i<n; ++i) { v2 = c[i]; if (v1 > v2) { c[i-1] = v2; c[i] = v1; done = 0; } else v1 = v2; } } while (!done); } int main() { int i; float val[20]; for (i=0; i<20; ++i) val[i] = (float) rand(); bubblesort(val, 20); for (i=0; i<20; ++i) printf("%f\n", val[i]); printf("\n"); return 0; }
The text was updated successfully, but these errors were encountered:
Interestingly, the integer version of the function works fine when optimized:
void bubblesort(int *c, int n) { int v1, v2; int i, done; do { done = 1; // --n; v1 = c[0]; for (i=1; i<n; ++i) { v2 = c[i]; if (v1 > v2) { c[i-1] = v2; c[i] = v1; done = 0; } else v1 = v2; } } while (!done); }
I think I just forgot to carry over some of the integer optimiation to the floating point code.
Sorry, something went wrong.
No branches or pull requests
Optimizer bug needs to be fixed for this test case (optimizer effectively creates a NOP!):
The text was updated successfully, but these errors were encountered: