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 8756921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:11:05+00:00 2026-06-13T14:11:05+00:00

The _mm_shuffle_ps() intrinsic allows one to interleave float inputs into low 2 floats and

  • 0

The _mm_shuffle_ps() intrinsic allows one to interleave float inputs into low 2 floats and high 2 floats of the output.

For example:

R = _mm_shuffle_ps(L1, H1, _MM_SHUFFLE(3,2,3,2))

will result in:

R[0] = L1[2];
R[1] = L1[3];
R[2] = H1[2];
R[3] = H1[3]

I wanted to know if there was a similar intrinsic available for the integer data type? Something that took two __m128i variables and a mask for interleaving?

The _mm_shuffle_epi32() intrinsic, takes just one 128-bit vector instead of two.

  • 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-13T14:11:07+00:00Added an answer on June 13, 2026 at 2:11 pm

    Nope, there is no integer equivalent to this. So you have to either emulate it, or cheat.

    One method is to use _mm_shuffle_epi32() on A and B. Then mask out the desired terms and OR them back together.

    That tends to be messy and has around 5 instructions. (Or 3 if you use the SSE4.1 blend instructions.)

    Here’s the SSE4.1 solution with 3 instructions:

    __m128i A = _mm_set_epi32(13,12,11,10);
    __m128i B = _mm_set_epi32(23,22,21,20);
    
    A = _mm_shuffle_epi32(A,2*1 + 3*4 + 2*16 + 3*64);
    B = _mm_shuffle_epi32(B,2*1 + 3*4 + 2*16 + 3*64);
    
    __m128i C = _mm_blend_epi16(A,B,0xf0);
    

    The method that I prefer is to actually cheat – and floating-point shuffle like this:

    __m128i Ai,Bi,Ci;
    __m128  Af,Bf,Cf;
    
    Af = _mm_castsi128_ps(Ai);
    Bf = _mm_castsi128_ps(Bi);
    Cf = _mm_shuffle_ps(Af,Bf,_MM_SHUFFLE(3,2,3,2));
    Ci = _mm_castps_si128(Cf);
    

    What this does is to convert the datatype to floating-point so that it can use the float-shuffle. Then convert it back.

    Note that these “conversions” are bitwise conversions (aka reinterpretations). No conversion is actually done and they don’t map to any instructions. In the assembly, there is no distinction between an integer or a floating-point SSE register. These cast intrinsics are just to get around the type-safety imposed by C/C++.

    However, be aware that this approach incurs extra latency for moving data back-and-forth between the integer and floating-point SIMD execution units. So it will be more expensive than just the shuffle instruction.

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

Sidebar

Related Questions

I'mm getting really long client ids one such example is below. Some of them
(dd/MM/yyyy HH)+ - + (x.Hour+1).ToString(); So here is example what I got and what
My locale dateformat is dd/mm/yyyy and Django is requering AAAA-MM-DD when the user inputs
convert MM-DD-YYYY TO MMDDYYYY infopath so for example date: 05-05-2011 would be 05052011 in
Input Date Format DD-MM-YYYY Example 15-01-2012 I have a booking date stored in Session
I have two time strings in HH:MM:SS format. For example, str1 contains 10:20:45 ,
I am making application in SAP MM. How to do transfer material from one
The code below has me slightly perplexed: function(__m128 foo) { __m128 bar = _mm_shuffle_ps(foo,
I have a date of the form mm-dd-yyyy. I need to convert into YYYY-MM-dd
Since mm displays the month, I wasn't sure Format(now + 1, mm) will now

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.