Prefetching Examples?

前端 未结 5 654
南旧
南旧 2020-11-27 10:44

Can anyone give an example or a link to an example which uses __builtin_prefetch in GCC (or just the asm instruction prefetcht0 in general) to gain a substantia

5条回答
  •  Happy的楠姐
    2020-11-27 11:26

    From the documentation:

          for (i = 0; i < n; i++)
            {
              a[i] = a[i] + b[i];
              __builtin_prefetch (&a[i+j], 1, 1);
              __builtin_prefetch (&b[i+j], 0, 1);
              /* ... */
            }
    

提交回复
热议问题