Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- typedef signed char schar;
- __attribute__((noinline, noclone, noipa)) void foo(schar *__restrict a,
- schar *__restrict b,
- schar *__restrict c, int n,
- int step) {
- for (int j = 0; j < n; ++j) {
- for (int i = 0; i < 16; ++i)
- a[i] = (b[i] + c[i]) >> 1;
- a += step;
- b += step;
- c += step;
- }
- }
- #define N 10000000
- schar a[N];
- schar b[N];
- schar c[N];
- int main(void) {
- memset(a, 1, N);
- memset(b, 5, N);
- memset(c, 8, N);
- for (int i = 0; i < N; ++i) {
- foo(a, b, c, 128, 4);
- }
- asm volatile("" : : "g"(a) : "memory");
- asm volatile("" : : "g"(b) : "memory");
- asm volatile("" : : "g"(c) : "memory");
- }
Advertisement
Add Comment
Please, Sign In to add comment