Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Improve Intel hardware intrinsic APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
FeiPengIntel committed Jun 13, 2018
1 parent e6ebea2 commit 9f41e05
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 4,006 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,22 @@ public static class Avx
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
public static sbyte Extract(Vector256<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
public static int Extract(Vector256<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
public static byte Extract(Vector256<byte> value, byte index) { throw new PlatformNotSupportedException(); }
public static uint Extract(Vector256<byte> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
public static short Extract(Vector256<short> value, byte index) { throw new PlatformNotSupportedException(); }
public static int Extract(Vector256<short> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
public static ushort Extract(Vector256<ushort> value, byte index) { throw new PlatformNotSupportedException(); }
public static uint Extract(Vector256<ushort> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __int32 _mm256_extract_epi32 (__m256i a, const int index)
/// HELPER
Expand Down Expand Up @@ -638,45 +638,45 @@ public static class Avx
/// __m128 _mm_maskload_ps (float const * mem_addr, __m128i mask)
/// VMASKMOVPS xmm, xmm, m128
/// </summary>
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<uint> mask) { throw new PlatformNotSupportedException(); }
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<float> mask) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128d _mm_maskload_pd (double const * mem_addr, __m128i mask)
/// VMASKMOVPD xmm, xmm, m128
/// </summary>
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<ulong> mask) { throw new PlatformNotSupportedException(); }
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<double> mask) { throw new PlatformNotSupportedException(); }

/// <summary>
/// __m256 _mm256_maskload_ps (float const * mem_addr, __m256i mask)
/// VMASKMOVPS ymm, ymm, m256
/// </summary>
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<uint> mask) { throw new PlatformNotSupportedException(); }
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<float> mask) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256d _mm256_maskload_pd (double const * mem_addr, __m256i mask)
/// VMASKMOVPD ymm, ymm, m256
/// </summary>
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<ulong> mask) { throw new PlatformNotSupportedException(); }
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<double> mask) { throw new PlatformNotSupportedException(); }

/// <summary>
/// void _mm_maskstore_ps (float * mem_addr, __m128i mask, __m128 a)
/// VMASKMOVPS m128, xmm, xmm
/// </summary>
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<uint> source) { throw new PlatformNotSupportedException(); }
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<float> source) { throw new PlatformNotSupportedException(); }
/// <summary>
/// void _mm_maskstore_pd (double * mem_addr, __m128i mask, __m128d a)
/// VMASKMOVPD m128, xmm, xmm
/// </summary>
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<ulong> source) { throw new PlatformNotSupportedException(); }
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<double> source) { throw new PlatformNotSupportedException(); }

/// <summary>
/// void _mm256_maskstore_ps (float * mem_addr, __m256i mask, __m256 a)
/// VMASKMOVPS m256, ymm, ymm
/// </summary>
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<uint> source) { throw new PlatformNotSupportedException(); }
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<float> source) { throw new PlatformNotSupportedException(); }
/// <summary>
/// void _mm256_maskstore_pd (double * mem_addr, __m256i mask, __m256d a)
/// VMASKMOVPD m256, ymm, ymm
/// </summary>
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<ulong> source) { throw new PlatformNotSupportedException(); }
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<double> source) { throw new PlatformNotSupportedException(); }

/// <summary>
/// __m256 _mm256_max_ps (__m256 a, __m256 b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,59 +239,59 @@ public static class Avx
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
public static sbyte Extract(Vector256<sbyte> value, byte index)
public static int Extract(Vector256<sbyte> value, byte index)
{
unsafe
{
index &= 0x1F;
sbyte* buffer = stackalloc sbyte[32];
Store(buffer, value);
return buffer[index];
return (int)buffer[index];
}
}

/// <summary>
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
public static byte Extract(Vector256<byte> value, byte index)
public static uint Extract(Vector256<byte> value, byte index)
{
unsafe
{
index &= 0x1F;
byte* buffer = stackalloc byte[32];
Store(buffer, value);
return buffer[index];
return (uint)buffer[index];
}
}

/// <summary>
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
public static short Extract(Vector256<short> value, byte index)
public static int Extract(Vector256<short> value, byte index)
{
unsafe
{
index &= 0xF;
short* buffer = stackalloc short[16];
Store(buffer, value);
return buffer[index];
return (int)buffer[index];
}
}

/// <summary>
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
public static ushort Extract(Vector256<ushort> value, byte index)
public static uint Extract(Vector256<ushort> value, byte index)
{
unsafe
{
index &= 0xF;
ushort* buffer = stackalloc ushort[16];
Store(buffer, value);
return buffer[index];
return (uint)buffer[index];
}
}

Expand Down Expand Up @@ -825,45 +825,45 @@ public static Vector256<T> InsertVector128<T>(Vector256<T> value, Vector128<T> d
/// __m128 _mm_maskload_ps (float const * mem_addr, __m128i mask)
/// VMASKMOVPS xmm, xmm, m128
/// </summary>
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<uint> mask) => MaskLoad(address, mask);
public static unsafe Vector128<float> MaskLoad(float* address, Vector128<float> mask) => MaskLoad(address, mask);
/// <summary>
/// __m128d _mm_maskload_pd (double const * mem_addr, __m128i mask)
/// VMASKMOVPD xmm, xmm, m128
/// </summary>
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<ulong> mask) => MaskLoad(address, mask);
public static unsafe Vector128<double> MaskLoad(double* address, Vector128<double> mask) => MaskLoad(address, mask);

/// <summary>
/// __m256 _mm256_maskload_ps (float const * mem_addr, __m256i mask)
/// VMASKMOVPS ymm, ymm, m256
/// </summary>
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<uint> mask) => MaskLoad(address, mask);
public static unsafe Vector256<float> MaskLoad(float* address, Vector256<float> mask) => MaskLoad(address, mask);
/// <summary>
/// __m256d _mm256_maskload_pd (double const * mem_addr, __m256i mask)
/// VMASKMOVPD ymm, ymm, m256
/// </summary>
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<ulong> mask) => MaskLoad(address, mask);
public static unsafe Vector256<double> MaskLoad(double* address, Vector256<double> mask) => MaskLoad(address, mask);

/// <summary>
/// void _mm_maskstore_ps (float * mem_addr, __m128i mask, __m128 a)
/// VMASKMOVPS m128, xmm, xmm
/// </summary>
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<uint> source) => MaskStore(address, mask, source);
public static unsafe void MaskStore(float* address, Vector128<float> mask, Vector128<float> source) => MaskStore(address, mask, source);
/// <summary>
/// void _mm_maskstore_pd (double * mem_addr, __m128i mask, __m128d a)
/// VMASKMOVPD m128, xmm, xmm
/// </summary>
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<ulong> source) => MaskStore(address, mask, source);
public static unsafe void MaskStore(double* address, Vector128<double> mask, Vector128<double> source) => MaskStore(address, mask, source);

/// <summary>
/// void _mm256_maskstore_ps (float * mem_addr, __m256i mask, __m256 a)
/// VMASKMOVPS m256, ymm, ymm
/// </summary>
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<uint> source) => MaskStore(address, mask, source);
public static unsafe void MaskStore(float* address, Vector256<float> mask, Vector256<float> source) => MaskStore(address, mask, source);
/// <summary>
/// void _mm256_maskstore_pd (double * mem_addr, __m256i mask, __m256d a)
/// VMASKMOVPD m256, ymm, ymm
/// </summary>
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<ulong> source) => MaskStore(address, mask, source);
public static unsafe void MaskStore(double* address, Vector256<double> mask, Vector256<double> source) => MaskStore(address, mask, source);

/// <summary>
/// __m256 _mm256_max_ps (__m256 a, __m256 b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,12 @@ public static class Sse2
/// int _mm_extract_epi16 (__m128i a, int immediate)
/// PEXTRW reg, xmm, imm8
/// </summary>
public static short Extract(Vector128<short> value, byte index) { throw new PlatformNotSupportedException(); }
public static int Extract(Vector128<short> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// int _mm_extract_epi16 (__m128i a, int immediate)
/// PEXTRW reg, xmm, imm8
/// </summary>
public static ushort Extract(Vector128<ushort> value, byte index) { throw new PlatformNotSupportedException(); }
public static uint Extract(Vector128<ushort> value, byte index) { throw new PlatformNotSupportedException(); }

/// <summary>
/// __m128i _mm_insert_epi16 (__m128i a, int i, int immediate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ public static class Sse2
/// int _mm_extract_epi16 (__m128i a, int immediate)
/// PEXTRW reg, xmm, imm8
/// </summary>
public static short Extract(Vector128<short> value, byte index) => Extract(value, index);
public static int Extract(Vector128<short> value, byte index) => Extract(value, index);
/// <summary>
/// int _mm_extract_epi16 (__m128i a, int immediate)
/// PEXTRW reg, xmm, imm8
/// </summary>
public static ushort Extract(Vector128<ushort> value, byte index) => Extract(value, index);
public static uint Extract(Vector128<ushort> value, byte index) => Extract(value, index);

/// <summary>
/// __m128i _mm_insert_epi16 (__m128i a, int i, int immediate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ public static class Sse41
/// int _mm_extract_epi8 (__m128i a, const int imm8)
/// PEXTRB reg/m8, xmm, imm8
/// </summary>
public static sbyte Extract(Vector128<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
public static int Extract(Vector128<sbyte> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// int _mm_extract_epi8 (__m128i a, const int imm8)
/// PEXTRB reg/m8, xmm, imm8
/// </summary>
public static byte Extract(Vector128<byte> value, byte index) { throw new PlatformNotSupportedException(); }
public static uint Extract(Vector128<byte> value, byte index) { throw new PlatformNotSupportedException(); }
/// <summary>
/// int _mm_extract_epi32 (__m128i a, const int imm8)
/// PEXTRD reg/m32, xmm, imm8
Expand Down Expand Up @@ -283,7 +283,7 @@ public static class Sse41
/// __m128 _mm_insert_ps (__m128 a, __m128 b, const int imm8)
/// INSERTPS xmm, xmm/m32, imm8
/// </summary>
public static Vector128<float> Insert(Vector128<float> value, float data, byte index) { throw new PlatformNotSupportedException(); }
public static Vector128<float> Insert(Vector128<float> value, Vector128<float> data, byte index) { throw new PlatformNotSupportedException(); }

/// <summary>
/// __m128i _mm_max_epi8 (__m128i a, __m128i b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ public static class Sse41
/// int _mm_extract_epi8 (__m128i a, const int imm8)
/// PEXTRB reg/m8, xmm, imm8
/// </summary>
public static sbyte Extract(Vector128<sbyte> value, byte index) => Extract(value, index);
public static int Extract(Vector128<sbyte> value, byte index) => Extract(value, index);
/// <summary>
/// int _mm_extract_epi8 (__m128i a, const int imm8)
/// PEXTRB reg/m8, xmm, imm8
/// </summary>
public static byte Extract(Vector128<byte> value, byte index) => Extract(value, index);
public static uint Extract(Vector128<byte> value, byte index) => Extract(value, index);
/// <summary>
/// int _mm_extract_epi32 (__m128i a, const int imm8)
/// PEXTRD reg/m32, xmm, imm8
Expand Down Expand Up @@ -283,7 +283,7 @@ public static class Sse41
/// __m128 _mm_insert_ps (__m128 a, __m128 b, const int imm8)
/// INSERTPS xmm, xmm/m32, imm8
/// </summary>
public static Vector128<float> Insert(Vector128<float> value, float data, byte index) => Insert(value, data, index);
public static Vector128<float> Insert(Vector128<float> value, Vector128<float> data, byte index) => Insert(value, data, index);

/// <summary>
/// __m128i _mm_max_epi8 (__m128i a, __m128i b)
Expand Down
34 changes: 0 additions & 34 deletions tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_r.csproj

This file was deleted.

34 changes: 0 additions & 34 deletions tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_ro.csproj

This file was deleted.

Loading

0 comments on commit 9f41e05

Please sign in to comment.