Esempio n. 1
0
 public static short8 nabs(short8 x)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(Sse2.sub_epi16(default(v128), Ssse3.abs_epi16(x)));
     }
     else if (Sse2.IsSse2Supported)
     {
         return(Mask.BlendV(-x, x, Sse2.cmpgt_epi16(default(v128), x)));
     }
     else
     {
         return(new short8((short)nabs((int)x.x0), (short)nabs((int)x.x1), (short)nabs((int)x.x2), (short)nabs((int)x.x3), (short)nabs((int)x.x4), (short)nabs((int)x.x5), (short)nabs((int)x.x6), (short)nabs((int)x.x7)));
     }
 }
Esempio n. 2
0
 public static short4 nabs(short4 x)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(Sse2.sub_epi16(default(v128), Ssse3.abs_epi16(x)));
     }
     else if (Sse2.IsSse2Supported)
     {
         return(Mask.BlendV(-x, x, Sse2.cmpgt_epi16(default(v128), x)));
     }
     else
     {
         return(new short4((short)nabs((int)x.x), (short)nabs((int)x.y), (short)nabs((int)x.z), (short)nabs((int)x.w)));
     }
 }
Esempio n. 3
0
        public static short8 abs(short8 x)
        {
            if (Ssse3.IsSsse3Supported)
            {
                return(Ssse3.abs_epi16(x));
            }
            else if (Sse2.IsSse2Supported)
            {
                v128 mask = Sse2.cmpgt_epi16(default(v128), x);

                return((x + mask) ^ mask);
            }
            else
            {
                return(new short8((short)math.abs(x.x0), (short)math.abs(x.x1), (short)math.abs(x.x2), (short)math.abs(x.x3), (short)math.abs(x.x4), (short)math.abs(x.x5), (short)math.abs(x.x6), (short)math.abs(x.x7)));
            }
        }
Esempio n. 4
0
        public static short4 abs(short4 x)
        {
            if (Ssse3.IsSsse3Supported)
            {
                return(Ssse3.abs_epi16(x));
            }
            else if (Sse2.IsSse2Supported)
            {
                v128 mask = Sse2.cmpgt_epi16(default(v128), x);

                return((x + mask) ^ mask);
            }
            else
            {
                return(new short4((short)math.abs(x.x), (short)math.abs(x.y), (short)math.abs(x.z), (short)math.abs(x.w)));
            }
        }