Guest User

Untitled

a guest
Oct 6th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. typedef signed char schar;
  4.  
  5. __attribute__((noinline, noclone, noipa)) void foo(schar *__restrict a,
  6. schar *__restrict b,
  7. schar *__restrict c, int n,
  8. int step) {
  9. for (int j = 0; j < n; ++j) {
  10. for (int i = 0; i < 16; ++i)
  11. a[i] = (b[i] + c[i]) >> 1;
  12. a += step;
  13. b += step;
  14. c += step;
  15. }
  16. }
  17.  
  18. #define N 10000000
  19. schar a[N];
  20. schar b[N];
  21. schar c[N];
  22. int main(void) {
  23. memset(a, 1, N);
  24. memset(b, 5, N);
  25. memset(c, 8, N);
  26. for (int i = 0; i < N; ++i) {
  27. foo(a, b, c, 128, 4);
  28. }
  29.  
  30. asm volatile("" : : "g"(a) : "memory");
  31. asm volatile("" : : "g"(b) : "memory");
  32. asm volatile("" : : "g"(c) : "memory");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment