Hello,
I want to read a memory location without polluting the cache. I am working on X86 Linux machine. I tried using MOVNTDQA assembler instruction:
asm("movntdqa %[source], %[dest] \n\t"
: [dest] "=x" (my_var) : [source] "m" (my_mem[0]) : "memory");
my_mem is an int* allocated with new, my_var is an int.
I have two problems with this approach:
- The code compiles but I am getting "Illegal Instruction" error when running it. Any ideas why?
- I am not sure what type of memory is allocated with new. I would assume that WB. According to documentation, the MOVNTDQA instruction will work only will USWC memory type. How can I know what memory type I am working on?
To summarize, my question is:
How can I read a memory location without polluting the cache on an X86 machine? Is my approach in the right direction, and can it be fixed to work?
Thanks.