Search code examples
carmsimdintrinsicsneon

Accessing 32bit from 64bit using ARM Neon intrinsics


How to access lower 32bits or upper 32 bits from a 64 bit signed integer using ARM Neon Intrinsics? Also, I want to assign this extracted data into another 32bit variable. Is it possible?


Solution

  • static inline int32x2_t low32(int64x2_t in)
    {
        int32x2_t out;
    
        out = vmovn_s64(in); // vqmovn for saturating
    
        return out;
    }
    
    static inline int32x2_t high32(int64x2_t in)
    {
        int32x2_t out;
    
        out = vshrn_n_s64(in, 32);
    
        return out;
    }