3

I want to know what is the equivalent instruction/code to SSE instruction in Neon instruction.

__m128i a,b,c;
c = _mm_packs_epi32(a, b);

Packs the 8 signed 32-bit integers from a and b into signed 16-bit integers and saturates.

I checked the equivalent instruction on ARM site but I didn't find any equivalent instruction. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Bcfjicfj.html

1
  • Also see sse_to_neon.h The header provides many of the common ones.
    – jww
    Jun 22, 2018 at 23:09

2 Answers 2

3

There is no instruction that directly does what you want, but all the building blocks to build one are there:

The saturation/narrow instruction is:

int16x4_t vqmovn_s32 (int32x4_t)  

This intrinsic saturates from signed 32 bit to signed 16 bit integers, returning the four narrowed integers in a 64 bit wide variable.

Combining these into your _mm_packs_epi32 is easy: Just do it for a and b, and combine the results:

  int32x4_t a,b;
  int16x8_t c;

  c = vcombine_s16 (vqmovn_s32(a), vqmovn_s32(b));

You may have to swap the order of the vcombine_s16 arguments.

2
  • can you please tell me one more neon instruction equivalent to _mm_storel_epi64.
    – TLE
    Oct 28, 2013 at 11:53
  • my solution is to use vget_lang( 64x2,1) to get lower 64 bit register, and then use vst1q to store. is it correct??
    – TLE
    Oct 28, 2013 at 15:39
2

This pack/saturate operation comes under the MOV instruction category in NEON:

VQMOVN (Vector Saturating Move and Narrow) copies each element of the operand vector to the corresponding element of the destination vector. The result element is half the width of the operand element, and values are saturated to the result width.

3
  • (psst, not sure if you flagged to migrate this steaming pile of dung, but I think superuser may put out a hit on you for it)
    – user1228
    Oct 28, 2013 at 13:01
  • can you please tell me, neon instruction equivalent to _mm_storel_epi64.
    – TLE
    Oct 28, 2013 at 14:38
  • my solution is to use vget_lang( int64x2_t ,1) to get lower 64 bit register, and then use vst1q to store. is it correct??
    – TLE
    Oct 28, 2013 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.