1

Is there an instruction using which I can move a variable to/from memory and registers without it being stored in cache? I don't want to disable caching entirely by using CD bit, I only want to do this for individual memory accesses.

0fnt
  • 8,211
  • 9
  • 45
  • 62

1 Answers1

2

movnt stores bypass cache, but movntdqa loads may not do that for normal (write-back) memory regions.

The instruction-set reference manual is very clear that it might not be any different from movdqa on WB memory, but IDK what actually happens on any current microarchitectures.

movntdqa is intended to speed up stuff like reading from WC video RAM, e.g. copying the results of a hardware video decoder back to main memory.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • Aha, that's last sentence is most enlightening. I could never figure out what possible use `movntdqa reg,[mem]` could have, considering...... – Johan Aug 25 '16 at 21:14
  • @Johan: see also http://stackoverflow.com/questions/32103968/non-temporal-loads-and-the-hardware-prefetcher-do-they-work-together, where my answer has more details and links. (Including a link to an Intel article illustrating copying from video RAM to main memory, bouncing through a small buffer that stays hot in L1 cache to keep NT loads and NT stores from stepping on each other and flushing with a partial line). – Peter Cordes Aug 25 '16 at 23:21