SSE2 Intrinsic usage with Visual Studio

H

Hipo

Hi.
For a project I have to load and store data to/from XMM registers.
Loading and operating on the data works perfectly, but every time I try
to store the data from the register to memory I get a message: "Access
violation reading location 0x0000000000000000."

I think I just made a little mistacke by writting the code, but I really
don't accomplish to fix the problem.

Here would be my simplified code:

__m128i xmm0 = _mm_load_si128((__m128i*)input);
_mm_storeu_si128((__m128i*)input, xmm0);

Can anyone give me an hint where my problem could be located?

bye, Hipo
 
G

Gianni Mariani

Hipo said:
Hi.
For a project I have to load and store data to/from XMM registers.
Loading and operating on the data works perfectly, but every time I try
to store the data from the register to memory I get a message: "Access
violation reading location 0x0000000000000000."

I think I just made a little mistacke by writting the code, but I really
don't accomplish to fix the problem.

Here would be my simplified code:

__m128i xmm0 = _mm_load_si128((__m128i*)input);
_mm_storeu_si128((__m128i*)input, xmm0);

Can anyone give me an hint where my problem could be located?

This is off-topic for this NG.

The hint for you is memory alignment.
 
N

Noah Roberts

Hipo said:
Hi.
For a project I have to load and store data to/from XMM registers.
Loading and operating on the data works perfectly, but every time I try
to store the data from the register to memory I get a message: "Access
violation reading location 0x0000000000000000."

I think I just made a little mistacke by writting the code, but I really
don't accomplish to fix the problem.

Here would be my simplified code:

__m128i xmm0 = _mm_load_si128((__m128i*)input);
_mm_storeu_si128((__m128i*)input, xmm0);

Can anyone give me an hint where my problem could be located?

I implemented a bitset class in my chess engine using sse2. You can
download it at sourceforge called xiangqi-engine and the actual
download itself is junfa. I don't know what your problem is but you
can see how I did it there.
 
H

Hipo

Gianni said:
This is off-topic for this NG.

The hint for you is memory alignment.

I do not understand how alignment lead to an error at writing the
content of a register to memory. It's just about bit sequenzes, which
are independent to each other, so there is no interpretation of data or
something else.
Or do I suffer from an elemental mistake ?

bye, Hipo
 
G

Gianni Mariani

Hipo wrote:
....
Or do I suffer from an elemental mistake ?

yes. It's a requirement of the CPU that addresses be aligned for
certain types of instructions.

Another hint may be that "input" is pointing to a page that is read only.

A compilable chunk-o-code that demonstrates the problem would be good.

G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top