Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2018-09-19 15:19:22 +0300
committerGitHub <noreply@github.com>2018-09-19 15:19:22 +0300
commitefd29b5cf854679349066e22ef9038b8cfe76d94 (patch)
tree2de750c1ac8a487d7f6d149592a6362ade6a5a77 /src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs
parentf9124d69e41d42196510dd7234b2d53fed48ad4c (diff)
parent49f9ed0e66fc2d4cd682821396c6af5e80182048 (diff)
Merge pull request #25 from ntherning/bump-corert
Bump to latest upstream
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs
new file mode 100644
index 000000000..48744bb5e
--- /dev/null
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using Internal.Runtime.CompilerServices;
+
+namespace System.Runtime.Intrinsics
+{
+ [Intrinsic]
+ [DebuggerDisplay("{DisplayString,nq}")]
+ [DebuggerTypeProxy(typeof(Vector256DebugView<>))]
+ [StructLayout(LayoutKind.Sequential, Size = 32)]
+ public readonly struct Vector256<T> where T : struct
+ {
+ // These fields exist to ensure the alignment is 8, rather than 1.
+ // This also allows the debug view to work https://github.com/dotnet/coreclr/issues/15694)
+ private readonly ulong _00;
+ private readonly ulong _01;
+ private readonly ulong _02;
+ private readonly ulong _03;
+
+ private unsafe string DisplayString
+ {
+ get
+ {
+ // The IsPrimitive check ends up working for `bool`, `char`, `IntPtr`, and `UIntPtr`
+ // which are not actually supported by any current architecture. This shouldn't be
+ // an issue however and greatly simplifies the check
+
+ if (typeof(T).IsPrimitive)
+ {
+ var items = new T[32 / Unsafe.SizeOf<T>()];
+ Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref items[0]), this);
+ return $"({string.Join(", ", items)})";
+ }
+ else
+ {
+ return SR.NotSupported_Type;
+ }
+ }
+ }
+ }
+}