SSE2 Intrinsic usage with Visual Studio

Discussion in 'C++' started by Hipo, May 17, 2006.

  1. Hipo

    Hipo Guest

    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
    Hipo, May 17, 2006
    #1
    1. Advertising

  2. Hipo wrote:
    > Hi.
    > For a project I have to load and store data to/from XMM registers.


    This newsgroup deals with the C++ language itself, not all its possible
    uses. See
    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9 for some
    newsgroup where you could ask your question (make sure to also read
    their charter!)


    Jonathan
    Jonathan Mcdougall, May 17, 2006
    #2
    1. Advertising

  3. Hipo

    Hipo Guest

    Jonathan Mcdougall schrieb:
    > Hipo wrote:
    >> Hi.
    >> For a project I have to load and store data to/from XMM registers.

    >
    > This newsgroup deals with the C++ language itself, not all its possible
    > uses. See
    > http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9 for some
    > newsgroup where you could ask your question (make sure to also read
    > their charter!)
    >
    >
    > Jonathan
    >


    Thanks for the immediate reply containing the link.

    bye, Hipo.
    Hipo, May 17, 2006
    #3
  4. Re: SSE2 Intrinsic usage with Visual Studio - OT

    Hipo wrote:
    > 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.
    Gianni Mariani, May 17, 2006
    #4
  5. Hipo

    Noah Roberts Guest

    Hipo wrote:
    > 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.
    Noah Roberts, May 17, 2006
    #5
  6. Hipo

    Hipo Guest

    Re: SSE2 Intrinsic usage with Visual Studio -still OT I know

    Gianni Mariani schrieb:
    > Hipo wrote:
    >> 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.


    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
    Hipo, May 17, 2006
    #6
  7. Re: SSE2 Intrinsic usage with Visual Studio -still OT I know

    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
    Gianni Mariani, May 18, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    476
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    616
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    559
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    446
  5. xman
    Replies:
    1
    Views:
    542
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page