Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8173455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:09:50+00:00 2026-06-06T22:09:50+00:00

The SSE shift instructions I have found can only shift by the same amount

  • 0

The SSE shift instructions I have found can only shift by the same amount on all the elements:

  • _mm_sll_epi32()
  • _mm_slli_epi32()

These shift all elements, but by the same shift amount.

Is there a way to apply different shifts to the different elements? Something like this:

__m128i a,  __m128i b;  

r0:=    a0  <<  b0;
r1:=    a1  <<  b1;
r2:=    a2  <<  b2;
r3:=    a3  <<  b3;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:09:51+00:00Added an answer on June 6, 2026 at 10:09 pm

    There exists the _mm_shl_epi32() intrinsic that does exactly that.

    http://msdn.microsoft.com/en-us/library/gg445138.aspx

    However, it requires the XOP instruction set. Only AMD Bulldozer and Interlagos processors or later have this instruction. It is not available on any Intel processor.

    If you want to do it without XOP instructions, you will need to do it the hard way: Pull them out and do them one by one.

    Without XOP instructions, you can do this with SSE4.1 using the following intrinsics:

    • _mm_insert_epi32()
    • _mm_extract_epi32()

    http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011/compiler_c/intref_cls/common/intref_sse41_reg_ins_ext.htm

    Those will let you extract parts of a 128-bit register into regular registers to do the shift and put them back.

    If you go with the latter method, it’ll be horrifically inefficient. That’s why _mm_shl_epi32() exists in the first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I take the reciprocal (inverse) of floats with SSE instructions, but only
SSE and/or 3D now! have vector instructions, but what do they optimize in practice
I have noticed that sometimes MSVC 2010 doesn't reorder SSE instructions at all. I
I am new to optimizing code with SSE/SSE2 instructions and until now I have
Following my previous question (I assume that 64-bit compiler uses only SSE instructions for
Many SSE instructions allow the source operand to be a 16-byte aligned memory address.
I'm working on converting a bit of code to SSE, and while I have
I have to optimize a piece of code using SSE extensions. My target platforms
x86 does not have an SSE instruction to convert from unsigned int32 to floating
I have some problem with SSE on ubuntu linux system. example source code on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.