Thread: Question re: SSE - shift-right, integer-divide(?)

  1. #1
    Registered User
    Join Date
    Mar 2010

    Question re: SSE - shift-right, integer-divide(?)

    I've just started looking at SSE but don't see how to accomplish a function we may need, namely, shift right (with a different shift count applied to each 32-bit register.) An integer-divide would work nicely too - if it was available.

    The application:
    We read thousands of double-words each bit-packed, and need to unpack them quickly. For instance, the high-order bit of first DW may represent one value, the next 5 bits another value and so on, the next DW is packed differently. No values span a DW boundary.

    I'm investigating using SSE to unpack values from four DWs at a time.
    One "pseudo-code" unpack-cycle might go as follows:
          PSRAW X bits //move next target-value to low-order bit
          ANDPS with Y    //discard irrelevant high-order bits
          MULPS by Z // scale as appropriate
          Store 4 Values
    Question: Does any version of SSE support a different 'X' for each XXM register?
    (If there was an integer divide, i think it would accomplish the same thing.)

    Any other ideas how SSE might be used to unpack this data?

    Streaming SIMD Extensions


  2. #2
    Registered User
    Join Date
    Jan 2010
    Since your data are all double-words and no values span across DW boundaries, I suppose you could use the x64 instruction set, with its 64-bit registers. That'll be a whole lot easier.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    If you are using MSVS you should research into the SSE/MMX intrinsic functions available to you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. checking if a char * is an integer
    By gregulator in forum C Programming
    Replies: 5
    Last Post: 04-16-2004, 09:12 AM
  2. Very large signed integer math question
    By Criz in forum C Programming
    Replies: 8
    Last Post: 12-01-2002, 12:43 PM
  3. question: how to divide two floats
    By mkappel in forum C++ Programming
    Replies: 1
    Last Post: 07-13-2002, 04:13 PM
  4. what does this warningmean???
    By kreyes in forum C Programming
    Replies: 5
    Last Post: 03-04-2002, 07:53 AM
  5. Newbies question about the integer type
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-17-2001, 08:09 PM